qiuwei / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
1 stars 1 forks source link

ConcurrentModificationException with repeated element names #111

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The attached XML causes trang to crash when attempting to create a schema
from an existing instance document. I think the problem is related to the
repetition of the element <acm> within two different subtrees of the
document, as well as the creation of a group. If I rename this element, or
the <criteria> element within the second instance of <acm>, then the crash
does not occur, so I think it's the combined situation that causes the problem.

I would expect to see the program create the RNG schema, but instead it
crashes with an exception:
$ java -jar /home/dantliff/src/trang-20081028/trang.jar -I xml -O rng
test2.xml test2.rng
Exception in thread "main" java.util.ConcurrentModificationException
        at
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
        at java.util.AbstractList$Itr.next(AbstractList.java:343)
        at com.thaiopensource.relaxng.input.xml.Inferrer.<init>(Unknown Source)
        at com.thaiopensource.relaxng.input.xml.Inferrer.infer(Unknown Source)
        at com.thaiopensource.relaxng.input.xml.XmlInputFormat.load(Unknown
Source)
        at
com.thaiopensource.relaxng.input.AbstractMultiInputFormat.load(Unknown Source)
        at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source)
        at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source)

I am using trang-20081028 on Ubuntu Linux 10.04 with java "1.6.0_20-b02".

I can currently work around the problem by changing the name of the second
<acm> element, but of course the inference of the group is incorrect and
needs to be manually fixed.

<?xml version="1.0"?>
<configuration>
  <modem>
    <acm>
      <prenotification-frames>8</prenotification-frames>
    </acm>
  </modem>      
  <thresholds>
    <acm>
      <degrade>
        <criteria>PVG610_CRITERIA_NA_E</criteria>
      </degrade>
      <improve>
        <criteria>PVG610_CRITERIA_MSE_ONLY_E</criteria>
      </improve>
    </acm>
  </thresholds>
</configuration>

Original issue reported on code.google.com by david.an...@gmail.com on 19 May 2010 at 11:42

Attachments:

GoogleCodeExporter commented 8 years ago
Please try to see if you reproduce this with the 20091111 version. I quickly 
tried
from oXygen (which includes the latest version) and I cannot reproduce the 
problem.

Original comment by georgebina76 on 24 May 2010 at 2:47

GoogleCodeExporter commented 8 years ago
I cannot reproduce this with the latest jing-trang 20091111. This was probably 
fixed
by r2307. 

Original comment by georgebina76 on 25 May 2010 at 11:53

GoogleCodeExporter commented 8 years ago
I can confirm that this problem appears to be fixed in 20091111. 

Is this 20091111 release stable? The website suggests that the current version 
is
20081028 - I wasn't aware of 20091111 until you mentioned it.

Original comment by david.an...@gmail.com on 25 May 2010 at 10:16

GoogleCodeExporter commented 8 years ago
AFAIK all the releases after 20081028 are stable, we use them in oXygen XML 
Editor.
Since 20091111 there were four issues fixed, issue 95, issue 104, issue 105 and 
issue
108. You can look to see if these issues do not affect your usage and then just 
get
the 20091111 release. If they affect your usage then you can build Jing and 
Trang
very easily, just checkout the project and run ant in the root folder.

Original comment by georgebina76 on 26 May 2010 at 12:40

GoogleCodeExporter commented 8 years ago
It is fixed, but the way it is fixed is ridiculous!
In the example above we have 2 different <acm> blocks:

<acm>
  <prenotification-frames>8</prenotification-frames>
</acm>

AND 

<acm>
      <degrade>
        <criteria>PVG610_CRITERIA_NA_E</criteria>
      </degrade>
      <improve>
        <criteria>PVG610_CRITERIA_MSE_ONLY_E</criteria>
      </improve>
    </acm>

In 20091111 trang just combines (makes an intersection) these 2 different tags 
into one:

<xsd:element name="acm"> with sub-tags and attributes taken from BOTH <acm>'s.

Thus we have a wrong schema.

Original comment by yuri.pet...@gmail.com on 15 Apr 2011 at 11:27

GoogleCodeExporter commented 8 years ago
Please file a separate bug about the output being wrong.

Original comment by jjc.jclark.com on 15 Apr 2011 at 11:32

GoogleCodeExporter commented 8 years ago
This looks like correct behaviour?  How would expect trang to behave?

Original comment by ocallagh...@gmail.com on 9 Dec 2011 at 2:04