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 83856 - WSDL does not validate if large number of changes are made in the Source Editor mode
Summary: WSDL does not validate if large number of changes are made in the Source Edit...
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: XDM (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nam Nguyen
URL:
Keywords:
Depends on:
Blocks: 85654
  Show dependency tree
 
Reported: 2006-08-30 23:51 UTC by hemant_bedekar
Modified: 2007-04-10 23:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
wsdl (2.12 KB, application/octet-stream)
2006-09-21 00:31 UTC, Ritesh Adval
Details
xsd (842 bytes, application/octet-stream)
2006-09-21 00:31 UTC, Ritesh Adval
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hemant_bedekar 2006-08-30 23:51:12 UTC
WSDL does not validate if large number of changes are made in the Source Editor
mode. 

Open a valid WSDL file. Switch to source editor view. Make a large number of
changes making sure the file is valid. When you try to switch to the graphical
mode, it complains that the WSDL file is invalid and that it connect display the
graphical view, when in fact the WSDL file is valid.

Restart Netbeans IDE. Same WSDL file will now validate and the graphical view
will display it w/o problem.

Best way to reproduce would be to take 2 different and valid WSDL files.
Validate both using external editor like XML Spy. Open one WSDL in Netbeans WSDL
editor. Switch to source view. Select everything and delete. Copy text from the
second WSDL file using simple text editor like notepad. Paste into Netbeans WSDL
Editor's Source View. Try switching to Graphical view. It will complain that
WSDL is not valid. Restart Netbeans. The WSDL will now validate successfully and
the graphical editor will display it.
Comment 1 Ritesh Adval 2006-09-21 00:30:31 UTC
This a bug in 

int start = schema.findPosition();

see line 92 in org.netbeans.modules.xml.wsdl.validator.WSDLInlineSchemaValidator

in wsdlmodel.

The problem is that this start postion is not pointing to start of <schema> tag 
in inline schema of a wsdl file.

so String schemaTop = text.substring(start, index); //get the schema definition.
line 98 returns an invalid fragment  and does not point to valid <schema> tag.


To reproduce copy attached wsdl and xsd file to a bpel project.
create another blank wsdl and copy the content of attached wsdl to it
and try to validate.

you will see following error:

C:/Documents and Settings/radval/ActionTests/NSTest/src/test.wsdl:1,39
Content is not allowed in prolog.

and this is because line 122
source = new SAXSource(new InputSource(new StringReader(strBuf.toString())));
strBuf is supposed to have valid inline <schema> but it does not due to bug in

findPosition()

Comment 2 Ritesh Adval 2006-09-21 00:31:08 UTC
Created attachment 34288 [details]
wsdl
Comment 3 Ritesh Adval 2006-09-21 00:31:40 UTC
Created attachment 34289 [details]
xsd
Comment 4 Nam Nguyen 2006-09-23 15:57:55 UTC
The content of inlineSchemaBug.wsdl is missing prolog, hence the output
validation error is correct.
I will verify issue raise by this bug by inserting the prolog:
<?xml version="1.0" encoding="UTF-8"?> properly.
I will file a separate P3 issue on XDM does not raise not_wellformed errors.
Comment 5 Nam Nguyen 2006-09-23 16:49:25 UTC
Actually the orginal wsdl with omission of prolog validate fine.  Prolog is
optional.  
The issue here is that pasting a prolog-less content over a document with-prolog
somehow cause the new in-memory document root also having the prolog tokens.  I
will keep this issue as XDM issue.
Comment 6 Nam Nguyen 2006-09-23 17:12:59 UTC
The issue here is during parsing the new content XMLSyntaxParser insert the
prolog tokens if is not there (this was for some earlier bug fix).  This become
issue about fidelity, and mismatch between document tree and document buffer.
The easy fix probably to check for mismatch document tokens and flush the model.
On the other hand this probably a candidate for waived consider the limited hit.
Comment 7 Nam Nguyen 2006-09-23 17:19:50 UTC
Reassign to Ayub for history, risk evaluation.
Comment 8 Nam Nguyen 2006-09-25 17:45:57 UTC
I can reproduce this reordering bug with regular cut and paste text.
To aleviate Ayub's bug load, I am going to work on this one.
Comment 9 Nam Nguyen 2006-09-25 22:46:53 UTC
This could be a bug in diff and merge code.
Comment 10 Nam Nguyen 2006-09-26 16:33:40 UTC
The issue is caused by document node are skipped during diff, merge and mutate.
Fix is somewhat straight forward and does not affect much of xdm sync/mutate
code path.

Fixes checked in release55_dev:
http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/XDMModel.java?r1=1.2.2.45.2.1&r2=1.2.2.45.2.2&sortby=date&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/diff/MergeDiff.java?r1=1.2.2.13&r2=1.2.2.13.2.1&sortby=date&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/diff/Attic/Change.java?r1=1.1.2.9&r2=1.1.2.9.2.1&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/diff/DiffFinder.java?r1=1.2.2.20&r2=1.2.2.20.2.1&sortby=date&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/diff/Attic/Difference.java?r1=1.1.2.7&r2=1.1.2.7.2.1&sortby=date&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xdm/src/org/netbeans/modules/xml/xdm/diff/Attic/NodeInfo.java?r1=1.1.2.8&r2=1.1.2.8.2.1&sortby=date&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xdm/test/unit/src/org/netbeans/modules/xml/xam/Attic/AbstractModelTest.java?r1=1.1.2.30&r2=1.1.2.30.2.1&sortby=date&only_with_tag=release55_dev
http://www.netbeans.org/source/browse/xml/xam/src/org/netbeans/modules/xml/xam/ModelAccess.java?r1=1.2.2.8&r2=1.2.2.8.6.1&sortby=date&only_with_tag=release55_dev
Comment 11 Nam Nguyen 2006-09-27 00:55:51 UTC
Fixes also checked in release55 branch.
Comment 12 tonybeckham 2007-04-10 23:17:45 UTC
fix VERIFIED in NetBeans IDE Dev (Build 200704091800)