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 142230 - extension element is not being generated
Summary: extension element is not being generated
Status: VERIFIED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Ant Project (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords:
: 142667 142670 142695 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-30 14:32 UTC by Lukas Jungmann
Modified: 2008-08-07 13:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ide log (125.98 KB, text/plain)
2008-07-30 14:35 UTC, Lukas Jungmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Jungmann 2008-07-30 14:32:21 UTC
-create new web service in a web project

=> ProjectManager.getDefault().saveProject(prj) throws:

java.io.IOException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'extension'. One of
'{"http://www.netbeans.org/ns/ant-build-extender/1":extension}' is expected.
	at org.netbeans.spi.project.support.ant.AntProjectHelper.saveXml(AntProjectHelper.java:321)
	at org.netbeans.spi.project.support.ant.AntProjectHelper.save(AntProjectHelper.java:589)
	at org.netbeans.spi.project.support.ant.AntProjectHelper.access$100(AntProjectHelper.java:99)
	at org.netbeans.spi.project.support.ant.AntProjectHelper$1.save(AntProjectHelper.java:137)
	at org.netbeans.modules.project.ant.AntBasedProjectFactorySingleton.saveProject(AntBasedProjectFactorySingleton.java:217)
	at org.netbeans.api.project.ProjectManager$7.run(ProjectManager.java:611)
...

which results in no build extension element in project.xml and thus no relationship between build-impl.xml and
jaxws-build.xml scripts although everything except project.xml is generated correctly

(I'm using netbeans-hudson-trunk-3126-java.zip)
Comment 1 Lukas Jungmann 2008-07-30 14:33:58 UTC
maybe issue 140640 and this are related
Comment 2 Lukas Jungmann 2008-07-30 14:35:10 UTC
Created attachment 66056 [details]
ide log
Comment 3 Jesse Glick 2008-07-30 14:38:08 UTC
Yes, same problem as what I reopened issue #140640 for. I will close that one so we have just one tracker.
Comment 4 Jesse Glick 2008-07-30 14:40:12 UTC
Never mind, already fixed it seems.

*** This issue has been marked as a duplicate of 140640 ***
Comment 5 Milos Kleint 2008-07-30 14:42:50 UTC
http://hg.netbeans.org/main/rev/f0e20f45bb1a

well I actually tried webstart, groovy and webservices before pushing the initial schema change. Just shows how the
schema verification thing is fragile and shall not have been pushed in production code at all.
Comment 6 Jesse Glick 2008-07-30 15:00:48 UTC
What's fragile? Apparently you did not try "create new web service in a web project". The schema declared that there
must be at least one extension, which clearly did not match what the code actually did.
Comment 7 Milos Kleint 2008-07-30 17:59:51 UTC
I did create a new webservice, in j2se project though. The fact that each behaves differently just highlights how many
other boobytraps of seldom used generation code we can run into in the future. another case for having the schema as
relaxed as possible, rather than restrictive.

Comment 8 Jesse Glick 2008-07-30 20:02:11 UTC
The schema should match what you need to generate, and what you intend to read.

The generation code in question here is hardly "seldom used"; adding WS support to a web project is a basic use case
which should should get tested (whether by developers, functional tests, QE, or users) on a regular basis.
Comment 9 Lukas Jungmann 2008-07-31 12:21:01 UTC
well, works fine on jdk1.5.0_15, not on jdk1.6.0_10-b27, thus reopening...
Comment 10 Milos Kleint 2008-07-31 12:38:59 UTC
confirmed. The stuff works under 1.5 but fails under 1.6.

with rather absurd message:
java.io.IOException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'extension'. One of
'{"http://www.netbeans.org/ns/ant-build-extender/1":extension}' is expected.

If anyone has any idea how to fix, please speak up. Othewise I'm just going to delete the schema file and pretend it
never existed.


Comment 11 Jesse Glick 2008-07-31 20:15:10 UTC
The message is indeed not very helpful but likely points to a real error - in the code generating the XML, not the
validator.

Element child = doc.createElement(AntBuildExtenderAccessor.ELEMENT_EXTENSION);

is incorrect. It should I think be

Element child = doc.createElementNS(AntBuildExtenderAccessor.AUX_NAMESPACE, AntBuildExtenderAccessor.ELEMENT_EXTENSION);

Check other parts of your code for accidental calls to DOM Level 1 methods (e.g. I see one place later in the same
method), which can behave rather erratically in the various versions of JAXP. The nasty part is that XML serialization
will normally proceed without so much as a warning in case an element with a namespace has a child with no namespace,
yet DOM inspection of the in-memory XML tree with distinguish the two.
Comment 12 Milos Kleint 2008-08-01 09:37:38 UTC
http://hg.netbeans.org/main/rev/64d614f5b4a6

well, I consider that a bug in the memory model DOM inspection.
Comment 13 Jesse Glick 2008-08-01 17:24:38 UTC
It's hard to say; the spec is pretty complicated. I think the DOM model is behaving correctly, it is the serialization
which fails to issue an error. (Such a document cannot be serialized correctly AFAIK.)

One other namespace oddity:

<a xmlns="n">
  <b x="y"/>
</a>

the names "a" and "b" are in the namespace "n", but the attribute name "x" is in the default namespace! That is, only
element names, not attribute names, inherit a namespace from context.
Comment 14 Quality Engineering 2008-08-02 16:09:20 UTC
Integrated into 'main-golden', available in build *200808021401* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/64d614f5b4a6
User: Milos Kleint <mkleint@netbeans.org>
Log: #142230 have all elements the correct namespace
Comment 15 Milos Kleint 2008-08-04 07:13:34 UTC
*** Issue 142667 has been marked as a duplicate of this issue. ***
Comment 16 Milan Kubec 2008-08-04 09:01:54 UTC
*** Issue 142670 has been marked as a duplicate of this issue. ***
Comment 17 Milos Kleint 2008-08-04 09:30:46 UTC
*** Issue 142695 has been marked as a duplicate of this issue. ***
Comment 18 Lukas Jungmann 2008-08-07 13:29:43 UTC
v.