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.
Second time this has come up doing the same thing. While manually editing an XSD (XML Schema file; File -> new -> xml -> Schema) after entering text between double quotes inserted by the autocomplete, advancing the cursor using the right arrow throws the BigDecimal cast exception. Should be a quick fix. JSD PS: I don't know where this came from but this isn't my stack trace (close thought): Build: NetBeans IDE 6.5 (Build 200811100001) VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33 OS: Windows XP, 5.1, x86 User comments: STACKTRACE: (first 10 lines) java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String at org.netbeans.modules.xml.schema.completion.util.CompletionUtil.getAttributeValues(CompletionUtil.java:316) at org.netbeans.modules.xml.schema.completion.CompletionQuery.getCompletionItems(CompletionQuery.java:122) at org.netbeans.modules.xml.schema.completion.CompletionQuery.query(CompletionQuery.java:87) at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:218) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
This issue already has 10 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=144357
This issue already has 13 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=144357
This issue already has 14 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=144357
Alex, please take a look
I'd like to NetFIX [1] this bug. Is it possible? [1] http://wiki.netbeans.org/NetFIX The bug seems to be because some attributes such as minOccurs are integers.
Created attachment 96386 [details] proposed patch
Alex, can you please review & integrate this patch? Thanks a lot!
I've looked at the proposed patch - it's very simple and clear. But before integration of this patch into repository I'd like to reproduce this bug. Unfortunately now I'm not able to reproduce it on the latest NB 6.9 build (http://smetiste.czech.sun.com/builds/netbeans/trunk/daily/latest). It seems that the original scenario doesn't work now: "While manually editing an XSD (XML Schema file; File -> new -> xml -> Schema) after entering text between double quotes inserted by the autocomplete, advancing the cursor using the right arrow throws the BigDecimal cast exception." I was able to: 1. Create new project, add new XML Schema file and open it 2. In the source editor add new element via code completion (for example, <xsd:element name="Item" minOccurs="0" maxOccurs="unbounded">) 3. Type any values inside "" for all attributes and move the caret to the right by the key [->] I didn't get any exception. Please provide a correct scenario for reproducing of this bug.
@alexpetrov: I do not see " File -> new -> xml -> Schema" in version 6.8 or 6.1M1. Has this feature been removed?
Still fails for me against a newly updated and clean main-silver. Pick say an empty string inside minOccurs="". Put the caret between the quotes and then ctrl-space. @theshadow27: You'll need to install the "Xml Schema and WSDL" module to get the new -> xml -> schema. Note that this module is unusual in that it installs in the IDE's installed directory rather than the user directory and so you'll need to re-install this module every time you install a new version of NB.
@dynamite: Thanks - I have installed the plugin on a fresh install of 6.9M1, and I can not reproduce the error either. I did however run up against IZ 181266 while trying to reproduce it (unrelated, AFICT)
I've tried to reproduce this bug on the build: Product Version: NetBeans IDE Dev (Build 201004140201) Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b13 System: Windows XP version 5.1 running on x86; (the latest build is available on http://smetiste.czech.sun.com/builds/netbeans/trunk/daily/latest) I've attached screen shots related to my steps: 1. Create new project (a simple empty Java project), create new XML schema by using the appropriate NB wizard. Open this schema in the source editor. Add new XML schema element by using code completion (see the screen shot Step1_NewElement.PNG). 2. Add new attribute minOccurs to this element. Put the caret inside quotes ("") and press Ctrl-Space. (see screen shots Step2_NewAttr_MinOccurs.PNG, Step3_MinOccursValue_Ctrl-Space.PNG). 3. Add new attribute maxOccurs to this element. Put the caret inside quotes ("") and press Ctrl-Space. (see screen shots Step4_NewAttr_MaxOccurs.PNG, Step5_MaxOccursValue_Ctrl-Space.PNG). I didn't get any exception. If you're still able to reproduce this bug, please provide info about: - used NB build - all steps for bug reproducing (all details are important, for example, prefixes "xsd:" or "xs:", etc.)
Created attachment 97481 [details] Step1_NewElement.PNG
Created attachment 97482 [details] Step2_NewAttr_MinOccurs.PNG
Created attachment 97483 [details] Step3_MinOccursValue_Ctrl-Space.PNG
Created attachment 97484 [details] Step4_NewAttr_MaxOccurs.PNG
Created attachment 97485 [details] Step5_MaxOccursValue_Ctrl-Space.PNG
If you're still able to reproduce this bug, please attach a screen shot with an exception dialog and the related stack trace.
Well, to try to reproduce it I installed the plugin XML Schema and WSDL from update center. I tried to reproduce it with no success. You need to send us more details about your xsd file to make possible reproduce it. I will continue to try to reproduce but no success for now :(
Product Version: NetBeans IDE Dev (Build 100416-9f404f994006) Java: 1.6.0_19; Java HotSpot(TM) Client VM 16.2-b04 System: Linux version 2.6.31-21-generic-pae running on i386; UTF-8; pt_BR (nb)
Created attachment 97555 [details] show problem
I have attached a simplified file that shows the issue for me. It seems that the element needs to be nested under <xsd:complexType><xsd:all>. <xsd:sequence> will not show the issue, and hence the difficulty in reproducing it.
OK, now I've reproduce this bug on the following XML file: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.netbeans.org/schema/bugXmlSchema" xmlns:tns="http://xml.netbeans.org/schema/bugXmlSchema" elementFormDefault="qualified"> <xsd:element name="el"> <xsd:complexType> <xsd:all> <xsd:element minOccurs=""/> </xsd:all> </xsd:complexType> </xsd:element> </xsd:schema> Put the caret inside quotes in the attribute minOccurs="|" and press Ctrl-Space. Stack trace: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String at org.netbeans.modules.xml.schema.completion.util.CompletionUtil.getAttributeValues(CompletionUtil.java:317) at org.netbeans.modules.xml.schema.completion.CompletionQuery.getCompletionItems(CompletionQuery.java:125) at org.netbeans.modules.xml.schema.completion.CompletionQuery.query(CompletionQuery.java:81) at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:220) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1417) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1955) I'll integrate the proposed patch into the trunk repository on Monday (Apr, 19th).
I was also able to duplicate the issue with the "show_problem" code - good test case dynamite!
Great, so can the patch be applied now? Thanks Alex!
Fixed in trunk: http://hg.netbeans.org/main/rev/b5a2509b92cd
I can reproduce it without the patch with the proposed use case and the Alex push fixed the problem for me.
Great, thank you Alex for review & integration and special thanks to Daniel for your persistence in giving us a patch and then a scenario it was fixing! :-)
Integrated into 'main-golden', will be available in build *201004200200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/b5a2509b92cd User: Alex Petrov <alexpetrov@netbeans.org> Log: Fix for issue [#157342]. ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String