Build: NetBeans IDE Dev (Build 200906221401)
VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08
OS: Windows XP, 5.1, x86
dynamite: I was manually editing the XML schema and converting a element from having an inline type to a declared type. I errantly typed a non-numeric string (the type) into the attribute minOccurs which expected an integer and got this exception. Red underlining of the attribute would be better.
java.lang.NumberFormatException: For input string: "tns:key"
Created attachment 83919 [details]
Daniel, can you still reproduce this issue? It works fine for me i.e. no exception was thrown but also no red underlining. :-\
If you can't reproduce it, let's close the bug. If you can, don't you want to try NetFIX it? ;-)
This issue was added to the list of NetFIX  candidates. If module owner does not agree, please speak up. Thanks!
Created attachment 96385 [details]
The problem shows when the "XML Schema and WSDL" module is installed. The minOccurs shows in the design view. The existing code looks up the minOccurs as an integer, but if the document is invalid then it may be non-integer text.
Nikita, please review the suggested fix and apply if everything is correct.
As I understand right, the patch helps to get rid of the exception. But an incorrectly typed value will appear in the property sheet.
It looks well from one side because it helps avoid the exception appearing. But
it can confuse the user with appearing incorrect value in property sheet.
Maybe it's better continue calling getMinOccuresEffective() inside of AdvancedLocalElementNode.getHtmlDisplayName() but with catching the NumberFormatException. In case of exception the HTML text can be colored in red (with HTML tags) and shows a text like "Incorrect value".
There is another advantage of the method getMinOccuresEffective(). It returns a default value in case the attribute isn't defined at all. With your path the property will show "null" if there isn't the attribute.
Created attachment 96553 [details]
updated patch including error in red text
Updated patch to match the above comment. When minOccurs is not an integer then it is now shown in red.
Nikita, any update on this? Thanks a lot!
Fixed in trunk http://hg.netbeans.org/main/rev/ee5d954b53a0
I applied the latest suggested update with some restrictions.
Adding new method LocalElement.getMinOccursText() is an API modification.
It requires more serious efforts and motivations and I remove it from the fix.
There is another problem. An incorrect (non numeric) minOccur value causes exception anyway. So the fix cover only part of problem. The exception happens if click on the erroneous value in property sheet. Unfortunately, it doesn't look like easy to fix.
Great, thanks for your review & integration Nikita and special thanks to Daniel for the patch!
Integrated into 'main-golden', will be available in build *201004140201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Log: #167525 - NumberFomatException while entering non numeric value for minValue