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 236846 - org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'compilation-unit'. One of '{"http://www.netbeans.org/ns/freeform-project-java/4":compilation-uni
Summary: org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was fo...
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Freeform (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal (vote)
Assignee: Milos Kleint
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2013-10-07 16:16 UTC by MackSix
Modified: 2013-12-11 13:03 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 204411


Attachments
stacktrace (3.95 KB, text/plain)
2013-10-07 16:16 UTC, MackSix
Details
Project to use for reproduction. (380.99 KB, application/x-zip-compressed)
2013-10-07 16:48 UTC, MackSix
Details
stacktrace (3.95 KB, text/plain)
2013-11-18 03:00 UTC, rhlrx85
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-10-07 16:16:20 UTC
Build: NetBeans IDE 7.4 (Build 201310012201)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.0-b56, Java(TM) SE Runtime Environment, 1.7.0_40-b43
OS: Windows 7

User Comments:
MackSix: 1. Source Level is 1.8 in Java Freeform Project while JDK is JDK 1.4.
2. Changed source level to 1.6 and this exception was thrown.




Stacktrace: 
org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'compilation-unit'. One of '{"http://www.netbeans.org/ns/freeform-project-java/4":compilation-unit}' is expected.
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
   at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
   at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
   at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458)
Comment 1 MackSix 2013-10-07 16:16:21 UTC
Created attachment 140865 [details]
stacktrace
Comment 2 MackSix 2013-10-07 16:45:28 UTC
1. Open attached free-form project.
2. Open context menu and go to Properties >> Java Source Classpath >> Java Platform and change JDK platform from 1.8 to 1.7.
3. This exception is thrown.
4. Open context menu again and JDK plataform is set back to 1.8.
5. Go to Java Source and change the Source Level to 1.7 or 1.6.
6. This exception is thrown.

Workaround: None that I know of.

Product Version: NetBeans IDE 7.4 (Build 201310012201)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 3 MackSix 2013-10-07 16:48:14 UTC
Created attachment 140866 [details]
Project to use for reproduction.
Comment 4 Tomas Danek 2013-10-08 08:20:51 UTC
It's reproducible just by changing project source level to 1.8. This forces use of http://netbeans.org/ns/freeform-project-java/4.xsd; any further downgrade of source level throws exception.

Workaround is easy: change you project.xml manually:
change 
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
to
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">

and 
<source-level>1.8</source-level>
to 
<source-level>1.7</source-level>
Comment 5 MackSix 2013-10-08 15:53:25 UTC
How am I supposed to change Java Platform to 1.6?
Comment 6 MackSix 2013-10-08 16:01:00 UTC
I can't even change Java Platform from one version of JDK 7 to another now after changing the source level entries in project xml. I was able to do it a couple of times and now it throws the exception and won't change.
Comment 7 MackSix 2013-10-08 16:03:23 UTC
I rebooted NetBeans and it now allows me to change Java Platforms between different JDK 7 versions again.
Comment 8 MackSix 2013-10-08 16:08:26 UTC
(In reply to Tomas Danek from comment #4)
> It's reproducible just by changing project source level to 1.8. This forces
> use of http://netbeans.org/ns/freeform-project-java/4.xsd; any further
> downgrade of source level throws exception.
> 
> Workaround is easy: change you project.xml manually:
> change 
> <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/4">
> to
> <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
> 
> and 
> <source-level>1.8</source-level>
> to 
> <source-level>1.7</source-level>

Plus you may have to Reboot NetBeans to allow the Java Platform to be changed from 1.8 to 1.7, between 1.7 versions or a 1.6 version.
Comment 9 MackSix 2013-10-08 17:19:39 UTC
If I have JDK Platform set to JDK1.6.0_45 and try to change source level to 1.5, it throws this exception too.

org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'compilation-unit'. One of '{"http://www.netbeans.org/ns/freeform-project-java/3":compilation-unit}' is expected.
Comment 10 Milos Kleint 2013-10-09 06:38:33 UTC
jlahoda: there's an duplicate issue that you had assigned to yourself?
Comment 11 MackSix 2013-11-15 18:59:49 UTC
I can't believe this isn't a patch1 candidate. ;)
Comment 12 rhlrx85 2013-11-18 03:00:49 UTC
Created attachment 142295 [details]
stacktrace

This is a FreeForm Java project.  I was trying to add and remove jars from the Project Properties src class path.
The last time I did this, it forgot my new settings and reverted back to the old ones.
This was more or less the first thing I did when I started up NetBeans.  The project was already opened.
Comment 13 Exceptions Reporter 2013-11-18 03:00:55 UTC
This bug already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=204411
Comment 14 Milos Kleint 2013-11-22 08:59:56 UTC
http://hg.netbeans.org/core-main/rev/4f2f7a42b1bd
Comment 15 Milos Kleint 2013-12-04 10:50:39 UTC
http://hg.netbeans.org/releases/rev/3620babf9fb6
Comment 16 Quality Engineering 2013-12-05 01:32:57 UTC
Integrated into 'releases/release74', will be available in build *201312042201* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/3620babf9fb6
User: Milos Kleint <mkleint@netbeans.org>
Log: #236846 once negotiated what namespace is necessary and what is used, always consistently use the existing namespace when creating elements
Comment 17 david_kral 2013-12-11 13:03:38 UTC
verified in patch 2