This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 105236 - java.lang.NumberFormatException when setting proxy port
Summary: java.lang.NumberFormatException when setting proxy port
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Options&Settings (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jiri Skrivanek
URL:
Keywords: NETFIX, SIMPLEFIX
Depends on:
Blocks:
 
Reported: 2007-05-31 10:25 UTC by Jaromir Uhrik
Modified: 2009-09-21 19:51 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log attached... (26.42 KB, image/png)
2007-05-31 10:27 UTC, Jaromir Uhrik
Details
bugzilla panel with input error shown (51.22 KB, image/png)
2009-08-07 08:14 UTC, tusharvjoshi
Details
Error label position and working in options dialog (30.14 KB, image/png)
2009-08-11 16:35 UTC, tusharvjoshi
Details
Error label on advanced proxy dialog (16.40 KB, image/png)
2009-08-11 16:36 UTC, tusharvjoshi
Details
Implementation of the error labels (21.33 KB, patch)
2009-08-11 17:04 UTC, tusharvjoshi
Details | Diff
Patch with suggested changes + binary error icon (23.47 KB, patch)
2009-08-12 11:47 UTC, tusharvjoshi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaromir Uhrik 2007-05-31 10:25:59 UTC
NetBeans IDE Dev (Build 200705301800)
1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
Mac OS X version 10.4.9 running on i386
en_US (nb); MacRoman

I have set the proxy port to ":8080" and pushed OK on the Options dialog. Then
the following exception appeared in Exception dialog:
java.lang.NumberFormatException: For input string: ":8080"
Comment 1 Jaromir Uhrik 2007-05-31 10:27:30 UTC
Created attachment 43018 [details]
messages.log attached...
Comment 2 Milan Kubec 2008-01-09 14:03:33 UTC
Reassigning back to owner.
Comment 3 Antonin Nebuzelsky 2008-04-15 17:07:11 UTC
Reassigning to new module owner jskrivanek.
Comment 4 Jiri Kovalsky 2009-03-30 14:43:24 UTC
Jiri Skrivanek agreed that he would review and integrate a patch for this issue contributed by the NetFIX [1] team.

[1] http://wiki.netbeans.org/NetFIX
Comment 5 Michel Graciano 2009-07-16 03:25:04 UTC
It looks like to be already fixed. I can't reproduce it anymore for 6.7. Probably should be closed as FIXED.
Comment 6 Jiri Kovalsky 2009-07-16 09:34:35 UTC
It's still being thrown in development builds. You can't see the exception in 6.7 FCS because it's only an
AssertionError which is hidden in FCS on purpose.
Comment 7 Michel Graciano 2009-07-16 17:45:22 UTC
which should be the behaviour when the value is invalid? Just ignore the value or some message should be showed? If yes,
when should this message should be shown?

Regards
Comment 8 Jiri Kovalsky 2009-07-17 11:45:23 UTC
In my opinion if user enters "aaa" or ":8080" as port, IDE should display a modal warning that "Proxy port you specified
is invalid. Please use only digits e.g. 8080", value should be cleared and dialog should NOT close. What do others think?
Comment 9 Jaromir Uhrik 2009-08-03 11:29:58 UTC
I can reproduce in the following build:
Product Version: NetBeans IDE Dev (Build 200908022240)
Java: 1.5.0_19; Java HotSpot(TM) Client VM 1.5.0_19-137
System: Mac OS X version 10.5.7 running on i386; MacRoman; en_US (nb)

IMHO the port textfield should accept only numbers. If other char than a number is typed then it should be ignored at
the textfield.
Comment 10 tusharvjoshi 2009-08-07 08:13:31 UTC
I checked the Miscelleneous > Issue Tracking panel.  The bugzilla panel has implemented number validation for the fields
named "Refresh open queries every" and when we type something like "aa" in that field they show a red colored label in
the panel saying invalid input and the OK button is greyed/disabled.

I found this way of input validation a better way.  The isValid() method is supported in the GeneralOptionsController
which is delegated to GeneralOptionsPanel in the core.ui project and this method plainly returns true.  I can change
this implementation to make it like the bugzilla panel.  I am attaching the screenshot of the bugzilla panel with error
notification after this comment.

Please confirm my understanding and comment so I can proceed with the fix.

with regards
Tushar Joshi, Nagpur
NetFIX Team
Comment 11 tusharvjoshi 2009-08-07 08:14:41 UTC
Created attachment 85944 [details]
bugzilla panel with input error shown
Comment 12 Jiri Skrivanek 2009-08-10 10:35:39 UTC
Question is where to put red error label. Otherwise it is OK. Also advanced proxy options dialog (click More.. button)
should be treated the same way.
Comment 13 tusharvjoshi 2009-08-10 10:39:22 UTC
Ok, regarding where to put the red label, I will put one label and attach the screen-shot here.  As the overall idea is
accepted I will work on this locally and will show screen-shots first for the layout, then will attach the patch.

Thanks for the input, I am able to proceed with this much input.

with regards
Tushar Joshi, Nagpur
NetFIX Team
Comment 14 Michel Graciano 2009-08-10 14:48:51 UTC
IMHO, this kind of message is really better than just don't accept OK button click. AFAIK user should always be notified 
about the problem even misconfiguration values. I really liked the idea.

Regards
Comment 15 tusharvjoshi 2009-08-11 16:35:38 UTC
Created attachment 86109 [details]
Error label position and working in options dialog
Comment 16 tusharvjoshi 2009-08-11 16:36:12 UTC
Created attachment 86110 [details]
Error label on advanced proxy dialog
Comment 17 tusharvjoshi 2009-08-11 16:41:11 UTC
I have implemented the error label in the mail options dialog and also in the advanced proxy dialog.  For general 
options panel I introduced a new label and manipulated it.  For manipulating the OK button I implemented property 
listeners on GeneralOptionsPanel which was not implemented.

For advanced proxy dialog as the dialog was shown with Dialog API DialogDisplayer and DialogDescriptor I used the usual 
way of NotificationLineSupport to show the error label and also manipulate the OK button.

Please check the screenshots of both windows I have attached and comment.  If the location of the label in general 
options dialog is ok I will attach the patch of this implementation.

with regards
Tushar Joshi, Nagpur
NetFIX Team.
Comment 18 Jiri Kovalsky 2009-08-11 16:41:19 UTC
I like the proposal.
Comment 19 Michel Graciano 2009-08-11 16:49:59 UTC
I really liked the proposal. The only concern is that we need to be consistent, so, IMHO will be important use the same 
image. Maybe it should be available in a common space where all module should look at about it? The same for colors. 
Maybe we need an proposal to change options dialog to support some way to show error and warning messages. IMO we just 
copy the image to this module to make everything consistent but in the future it should be reviewed. What do you think 
(probably here is not the right place to this discussion :)?
Comment 20 tusharvjoshi 2009-08-11 17:04:34 UTC
Created attachment 86111 [details]
Implementation of the error labels
Comment 21 tusharvjoshi 2009-08-11 17:07:27 UTC
I have attached the patch for the error label implementations I have done as explained in earlier comment.

@Michel
I have kept the color of the label same as the NotificationLineSupport type label only the icon is missing.  The 
position of the label is also custom position as there is no standard NotificationLineSupport for the general options 
dialog yet.  Adding an icon may be too much for me at this starting level.  If I add that icon how will it be added with 
the patch? as the file will be an PNG file, hence I have not done the icon part at this stage.

with regards
Tushar Joshi, Nagpur
NetFIX Team.
Comment 22 Jiri Kovalsky 2009-08-11 17:12:09 UTC
Jirko, can you please review the patch? If it's okay would you be willing to add the Stop image? Thanks!
Comment 23 Michel Graciano 2009-08-11 17:13:44 UTC
The image is included in the patch as binary data. In theory, no extra work at least for cvs and svn. HG I've never 
exported patches with binary data before. Thanks for your help and congratulations for the patch.

Regards
Comment 24 Jiri Skrivanek 2009-08-12 09:40:57 UTC
The patch looks promising. To include a new file to a patch (including binary file) use 'hg add' and then 'hg diff'. My
comments:

JS01: Please, keep NetBeans formatting. Use Alt+Shift+F (Format) for newly added blocks of code. Also move private
member methods like AdvancedProxyPanel.setDialogDescriptor behind constructors and public methods. Also add missing
@Override annotations.
JS02: GeneralOptionsPanel.errorLabel should be aligned to the right, IMO. To get correct color use

                    Color nbErrorForeground = UIManager.getColor("nb.errorForeground"); //NOI18N
                    if (nbErrorForeground == null) {
                        nbErrorForeground = new Color(255, 0, 0);
                    }
org.openide.awt.Mnemonics.setLocalizedText(errorLabel... not needed. Then also remove
GeneralOptionsPanel.errorLabel.text from Bundle.
Comment 25 Jiri Kovalsky 2009-08-12 09:55:39 UTC
Thanks a lot Jirko. Tushar?
Comment 26 tusharvjoshi 2009-08-12 10:06:53 UTC
Thanks for the review.  I will work on the suggested modifications and re-submit the patch.

with regards
Tushar
Comment 27 tusharvjoshi 2009-08-12 11:47:24 UTC
Created attachment 86145 [details]
Patch with suggested changes + binary error icon
Comment 28 tusharvjoshi 2009-08-12 11:48:29 UTC
Hi,

I have made all the suggested changes.  Added the error.png file same as used in the Core.Windows dialogs.
Please review

with regards
Tushar Joshi, Nagpur
NetFIX Team
Comment 29 tusharvjoshi 2009-09-01 08:56:44 UTC
Can this patch be added for next RC of NB6.8?  
Comment 30 Jiri Skrivanek 2009-09-02 11:10:41 UTC
Great! I have no objection to apply the patch.
Comment 31 Jiri Kovalsky 2009-09-16 19:27:40 UTC
Jirko, could you please integrate the patch as soon as possible? Thanks a lot!
Comment 32 Jiri Skrivanek 2009-09-17 09:47:09 UTC
Patch applied. Thank you tusharvjoshi.
core-main #eab44c9b9204
Comment 33 Quality Engineering 2009-09-18 22:29:15 UTC
Integrated into 'main-golden', will be available in build *200909181401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/eab44c9b9204
User: Jiri Skrivanek <jskrivanek@netbeans.org>
Log: #105236 - Validate port number.
Comment 34 Michel Graciano 2009-09-21 19:51:25 UTC
v. 200909210201