Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 172663 - AssertionError at org.netbeans.modules.xml.xdm.diff.MergeDiff.applyChildrenDiffs
AssertionError at org.netbeans.modules.xml.xdm.diff.MergeDiff.applyChildrenDiffs
Status: VERIFIED FIXED
Product: xml
Classification: Unclassified
Component: XDM
6.x
All All
: P1 (vote)
: 6.x
Assigned To: _ alexpetrov
issues@xml
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT 67patch2-verified
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-21 10:51 UTC by Marek Fukala
Modified: 2009-11-30 08:31 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (941 bytes, text/plain)
2009-09-21 10:51 UTC, Marek Fukala
Details
stacktrace (1.29 KB, text/plain)
2009-10-23 19:57 UTC, neilg
Details
stacktrace (941 bytes, text/plain)
2009-11-12 04:14 UTC, Jaroslav Pospisil
Details
stacktrace (941 bytes, text/plain)
2009-11-15 03:39 UTC, Michal Mocnak
Details
stacktrace (941 bytes, text/plain)
2009-11-16 03:39 UTC, Michal Mocnak
Details
stacktrace (941 bytes, text/plain)
2009-11-16 04:05 UTC, Marek Fukala
Details
stacktrace (941 bytes, text/plain)
2009-11-16 04:16 UTC, Jindrich Sedek
Details
stacktrace (941 bytes, text/plain)
2009-11-16 04:22 UTC, Jindrich Sedek
Details
stacktrace (941 bytes, text/plain)
2009-11-18 03:27 UTC, Vitaly Bychkov
Details
stacktrace (941 bytes, text/plain)
2009-11-18 04:25 UTC, Vitaly Bychkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2009-09-21 10:51:29 UTC
Build: NetBeans IDE Dev (Build 090915)
VM: Java HotSpot(TM) 64-Bit Server VM, 1.6.0_07-b06-57, Java(TM) SE Runtime Environment, 1.6.0_07-b06-153
OS: Mac OS X, 10.5.7, x86_64

User Comments:
mfukala: just opened new faces-config.xml, immediately typed < and invoked completion

tomasandersen: I was editing an XSL file.

GUEST: Adding comment to faces-config.xml

GUEST: editong a .xsd file

and i get this all the time, no matter which version of the latest netbeans i seem to be using

GUEST: Still working on a schema file

GUEST: Trying to validate a schema with an obvious error (two xs:schemas elements, first of which empty)



Stacktrace: 
java.lang.AssertionError
        at org.netbeans.modules.xml.xdm.diff.MergeDiff.applyChildrenDiffs(MergeDiff.java:142)
        at org.netbeans.modules.xml.xdm.diff.MergeDiff.merge(MergeDiff.java:108)
        at org.netbeans.modules.xml.xdm.XDMModel.mergeDiff(XDMModel.java:251)
        at org.netbeans.modules.xml.xdm.XDMModel.finishSync(XDMModel.java:218)
        at org.netbeans.modules.xml.xdm.XDMModel.sync(XDMModel.java:158)
        at org.netbeans.modules.xml.xdm.xam.XDMAccess.sync(XDMAccess.java:141)
Comment 1 Marek Fukala 2009-09-21 10:51:39 UTC
Created attachment 88006 [details]
stacktrace
Comment 2 Exceptions Reporter 2009-09-21 10:51:53 UTC
This issue already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 3 Sergey Lunegov 2009-09-22 11:11:01 UTC
Alex, please take a look.
Comment 4 Exceptions Reporter 2009-10-22 14:22:23 UTC
This issue already has 12 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 5 neilg 2009-10-23 19:57:12 UTC
Build: NetBeans IDE 6.8 Beta (Build 200910212001)
VM: Java HotSpot(TM) 64-Bit Server VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux, 2.6.28-15-generic, amd64

User Comments: 
editing pom file

Stacktrace: 
java.lang.AssertionError
        at org.netbeans.modules.xml.xdm.diff.MergeDiff.applyChildrenDiffs(MergeDiff.java:142)
        at org.netbeans.modules.xml.xdm.diff.MergeDiff.merge(MergeDiff.java:108)
        at org.netbeans.modules.xml.xdm.XDMModel.mergeDiff(XDMModel.java:251)
        at org.netbeans.modules.xml.xdm.XDMModel.finishSync(XDMModel.java:218)
        at org.netbeans.modules.xml.xdm.XDMModel.sync(XDMModel.java:158)
        at org.netbeans.modules.xml.xdm.xam.XDMAccess.sync(XDMAccess.java:141)
Comment 6 neilg 2009-10-23 19:57:16 UTC
Created attachment 90024 [details]
stacktrace
Comment 7 Exceptions Reporter 2009-10-23 19:57:24 UTC
This issue already has 14 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 8 Jaroslav Pospisil 2009-11-12 04:14:51 UTC
Created attachment 90888 [details]
stacktrace
Comment 9 _ alexpetrov 2009-11-12 11:38:20 UTC
I'm not able to reproduce this bug on:

Product Version: NetBeans IDE Dev (Build 200911091156)
Java: 1.5.0_22; Java HotSpot(TM) Client VM 1.5.0_22-b03
System: Linux version 2.6.31-14-generic running on i386; UTF-8; en_US (nb)

Product Version: NetBeans IDE Dev (Build 200911091156)
Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16
System: Linux version 2.6.31-14-generic running on i386; UTF-8; en_US (nb)

If it still appears please provide exact steps for a bug reproducing.
Comment 10 Michal Mocnak 2009-11-15 03:39:39 UTC
Created attachment 91051 [details]
stacktrace
Comment 11 Michal Mocnak 2009-11-16 03:39:08 UTC
Created attachment 91072 [details]
stacktrace
Comment 12 Michal Mocnak 2009-11-16 03:45:59 UTC
Reopening it's still reproducible. According to previous exception report.

Steps:

- create web (jee6) project with jsf 2
- create faces-config.xml
- work with

Actually it's happened when i was using cc in faces-config
Comment 13 Marek Fukala 2009-11-16 04:05:57 UTC
Created attachment 91075 [details]
stacktrace
Comment 14 Marek Fukala 2009-11-16 04:10:15 UTC
I just created a new faces-config.xml file in a web project, opened it and type < inside the faces-config tag. Then the exception reappears almost after each modification => Editor almost unusable => P1.
Comment 15 Marek Fukala 2009-11-16 04:12:00 UTC
There is currently 49 duplicates, 50 is the limit for P1, so please fix this!
Comment 16 Jindrich Sedek 2009-11-16 04:16:57 UTC
Created attachment 91076 [details]
stacktrace
Comment 17 Exceptions Reporter 2009-11-16 04:17:04 UTC
This issue already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 18 Marek Fukala 2009-11-16 04:22:36 UTC
It looks like once the UI editor appears the issue is not reproducible. After creating a new FC the editor opens in the XML mode directly. Then you almost cannot edit.
Comment 19 Jindrich Sedek 2009-11-16 04:22:57 UTC
Created attachment 91077 [details]
stacktrace
Comment 20 Exceptions Reporter 2009-11-16 04:23:04 UTC
This issue already has 51 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 21 _ alexpetrov 2009-11-17 09:46:05 UTC
Guys, who used faces-config.xml for reproducing of this bug, please attach your project containing this "reproducible" .xml file.
The following help will be appreciated very much - if it's possible could you describe your steps in this format:
1. Start  "clear" Netbeans with "clear" userdir
2. Create new clear (JavaEE+JSF) project
3. Add new JSF Config file to the project
4. Other 
.  steps
.  for 
.  reproducing
.  of this bug

I'm still not able to reproduce this bug on

Product Version: NetBeans IDE Dev (Build 200911091156)
Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16
System: Linux version 2.6.31-14-generic running on i386; UTF-8; en_US (nb), 

using given descriptions

1.
- create web (jee6) project with jsf 2
- create faces-config.xml
- work with

2.
I just created a new faces-config.xml file in a web project, opened it and type
< inside the faces-config tag. 

3.
After creating a new FC the editor opens in the XML mode directly. Then you almost cannot edit.

I always get a correct code completion box or a message "No suggestions".
Please, help.
Comment 22 Marek Fukala 2009-11-18 02:35:16 UTC
I cannot say more than I already said:

Using the #2 steps I can perfectly reproduce.

I have questions for you:
1) what platform, what OS, what *exact* build, or when fetched&rebuild for the last time? If self build - from what repository do you fetch? As for me it is web-main.
2) do you use some non standart module? (extensions to the xml support)
3) is the RAW XML editor opened for you when you follows the steps:
   1. Start  "clear" Netbeans with "clear" userdir
   2. Create new clear (JavaEE+JSF) project
   3. Add new JSF Config file to the project
  
   As I've already said the issues disappears once you switch to the UI editor.
   I recon it may be some timing issue as well (not sure how you initializes the models in the background)

I'll try to fetch&build web-main again right now and give it another try. BTW did you changed anything which may affect the involved code recently, I mean in last few days?
Comment 23 Sergey Lunegov 2009-11-18 02:58:26 UTC
Marek, we can NOT reproduce this issue at all. We'll try to do it on different machines, platforms etc. But for now (even if GUI editor is not used from the beginning) issue is not reproducible. Code wasn't changed recently.
Comment 24 Sergey Lunegov 2009-11-18 03:15:59 UTC
And there is the workaround as Marek mentioned: open GUI editor. So not P1.
Comment 25 Vitaly Bychkov 2009-11-18 03:27:18 UTC
Created attachment 91227 [details]
stacktrace
Comment 26 Exceptions Reporter 2009-11-18 03:27:25 UTC
This issue already has 53 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 27 Marek Fukala 2009-11-18 03:52:28 UTC
Still reproducible I am affraid:

web-main repository
1) ant clean && hg fetch && ant == clean fresh nb build. *only j2ee cluster*
2) run with a new userdir
3) create new web project, select javaee6, add glassfish v3, select jsf framework
4) create new faces-config.xml from template
5) open it
=> there is NO MULTIVIEW, just the raw xml editor
6) do any modification, e.g. type a whitespace anywhere. But for you to have a precise steps, type < inside the absolute-ordering tag body
7) wait for a few seconds
Following exception is thrown:
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.xml.xam.AbstractModel$1
java.lang.AssertionError
	at org.netbeans.modules.xml.xdm.diff.MergeDiff.applyChildrenDiffs(MergeDiff.java:142)
	at org.netbeans.modules.xml.xdm.diff.MergeDiff.merge(MergeDiff.java:108)
	at org.netbeans.modules.xml.xdm.XDMModel.mergeDiff(XDMModel.java:251)
	at org.netbeans.modules.xml.xdm.XDMModel.finishSync(XDMModel.java:218)
	at org.netbeans.modules.xml.xdm.XDMModel.sync(XDMModel.java:158)
	at org.netbeans.modules.xml.xdm.xam.XDMAccess.sync(XDMAccess.java:141)
	at org.netbeans.modules.xml.xam.AbstractModel.sync(AbstractModel.java:259)
	at org.netbeans.modules.xml.xam.AbstractModel$1.run(AbstractModel.java:652)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:602)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1084)
Caused: org.openide.util.RequestProcessor$FastItem: task failed due to

This repeats after each subsequent modification.

8) close the file
9) restart netbeans
10) open the file
=> the UI editor is there
=> editing the XML itsef works fine.

Apparently the xml model is initialized by the "UI" view and since this doesn't happen for the first time for new faces-config.xml file, the assertion error is thrown.

From looking into the code, the MergeDiff.applyChildrenDiffs(final Set<Difference> diffs, Node target) methods gets an instance of Document as the target, instead of the expected Element instance. Then the Difference.getNewParent().getId() is different and the assertion fails. Proper node type is passed to the method when the UI editor is opened (after step #8)

I guess there is a bug in the TextEditorSupport since following message is writeen to the IDe log during creating the faces-config.xml for the first time. I recon this is the real cause of the issue.

WARNING [org.openide.text.CloneableEditorSupport]: org.netbeans.modules.xml.text.TextEditorSupport should override asynchronousOpen(). See http://bits.netbeans.org/dev/javadoc/org-openide-text/apichanges.html#CloneableEditorSupport.asynchronousOpen

Please do not try to convince me you still cannot reproduce it :-). This is likely not platform specific, look at the exception reports.
Comment 28 Sergey Lunegov 2009-11-18 04:00:42 UTC
Not P1 in anyway.
Comment 29 Vitaly Bychkov 2009-11-18 04:25:18 UTC
Created attachment 91232 [details]
stacktrace
Comment 30 Exceptions Reporter 2009-11-18 04:25:27 UTC
This issue already has 54 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7415
Comment 31 _ alexpetrov 2009-11-18 12:34:18 UTC
Steps to reproduce:

1. Start "clear" Netbeans with "clear" userdir
2. Create new clear (Java Web + Web Application) project, using (Glassfish V3 + JavaEE 6)
3. Add New -> Other -> JavaServer Faces -> JSF Managed Bean to the project
4. Add New -> Other -> JavaServer Faces -> JSF Configuration  to the project
Comment 32 _ alexpetrov 2009-11-18 13:10:32 UTC
Sorry for the wrong previous comment, it was not finished. Button "Commit" was pressed accidentally.
Comment 33 Nikita Krjukov 2009-11-19 10:55:03 UTC
The reason of exception is the violation of uniqueness of IDs inside of XDM model. So now we know the reason, but unfortunately it's still unclear what was the motivation of those who added the code, which leads to models' corruption. It's definitely has been added intentionally. 

There is another simpler way to reproduce the exception: 
It's necessary to prepare the XML file at first. 
-- Create a new XML Schema file in any project 
-- Add many comments at the beginning. You can copy the following line to the document BEFORE the root element <xsd:schema>. Do it SEVERAL times (5-10 for example)
   <!-- aaa --> <!-- aaa --> <!-- aaa --> <!-- aaa --> <!-- aaa --> 
-- Save the schema and close NetBeans. 

Now you have the XSD file with multiple comments. You don't need to repeat preparation steps again. 

-- Open the NetBeans and the XSD file in source view. 
-- For other case wait till NetBeans finish loading.
-- You can try validating it to be sure that it is valid.
-- Select root element <xsd:schema>, copy it to buffer and delete. 
-- Wait 2-4 seconds (to give XDM model a time be synchronized)
-- Add it back to the document. 
-- Wait 2-4 seconds 
-- At this time the document already corrupted because it has repeated IDs. The IDs for pasted part of document was regenerated starting from 1.
-- Try adding anything inside of root element and you get the same AssertionException. 
-- The XSD remain corrupted until NebBenas is reloaded.
Comment 34 Marek Fukala 2009-11-20 01:37:53 UTC
Supernikita, just FYI

1) all the reports are agains exception from XML file editing, in particular from faces-config.xml, not regarding xsd

2) the issue appear is super simple scenario, nothing so complicated as you described above

The issue you've just desribed (if only reproducible this way) sound like at most P3 to me, whilst what are all the more than fifty duplicates about sound more serious.

I perfectly understand that you are affraid modifying the involved code in the CF if you do not have a perfect knowledge of it. The consequences may be sometimes unpredictible. OTOH isn't the XAM/XDM well covered with unit tests?
Comment 35 Sergey Lunegov 2009-11-20 02:29:43 UTC
Marek, we definitely have a number (rather big) of unit test. However the successful passing of those tests does not guarantee something else will be corrupted. Nikita added another scenario just as result of our attempts to understand root cause of the problem. So the most scaring thing to me personally is that why this issue is not 100% reproducible. In other owrds we don't know know why in some cases algorithm works correctly. Will continue to investigate.
Comment 36 Michal Mocnak 2009-11-23 03:36:49 UTC
P1 - based on discussion with Michal, it's regression since NB 6.8 Beta (Michal
will confirm today)
Comment 37 _ alexpetrov 2009-11-23 08:17:19 UTC
Fixed in trunk: http://hg.netbeans.org/main/rev/eb9e210ddb70
Comment 38 Quality Engineering 2009-11-24 19:03:06 UTC
Integrated into 'main-golden', will be available in build *200911241400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/eb9e210ddb70
User: Alex Petrov <alexpetrov@netbeans.org>
Log: Fix for issue [#172663]. AssertionError at org.netbeans.modules.xml.xdm.diff.MergeDiff.applyChildrenDiffs.
Comment 39 _ alexpetrov 2009-11-25 07:53:43 UTC
Fixed in release68: http://hg.netbeans.org/release68/rev/b679f1ce67fd
Comment 40 _ alexpetrov 2009-11-25 07:54:41 UTC
Key word has been changed.
Comment 41 Nikita Krjukov 2009-11-26 08:56:45 UTC
Verified in trunk with build 26.11.2009
Comment 42 Nikita Krjukov 2009-11-26 09:10:45 UTC
It's necessary to migrate the changes to NetBeans 6.7.1 branch
Comment 43 pgebauer 2009-11-26 15:20:33 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/dc07309633cf
Comment 44 Nikita Krjukov 2009-11-30 07:44:39 UTC
I've verified the fix in NetBeans 6.7 after downloading updated modules from the update center.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo