leemic2004 / daisydiff

Automatically exported from code.google.com/p/daisydiff
0 stars 0 forks source link

IndexOutOfBoundsException in Tag mode #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run java -jar daisydiff.jar a.html b.html --type=tag

What is the expected output? What do you see instead?
The expected output is any result.

Instead there is an exception

..java.lang.IndexOutOfBoundsException: There is no Atom with index 3
        at org.outerj.daisy.diff.tag.TagComparator.getAtom(Unknown Source)
        at org.outerj.daisy.diff.tag.TagDiffer.preProcess(Unknown Source)
        at org.outerj.daisy.diff.tag.TagDiffer.diff(Unknown Source)
        at org.outerj.daisy.diff.DaisyDiff.diffTag(Unknown Source)
        at org.outerj.daisy.diff.Main.main(Unknown Source)

Applies in DaisyDiff 1.0 and 1.1. Also notice that if the order of the 
input files is reversed, there is NO exception. The files themselves are 
really simple.

Original issue reported on code.google.com by kkape...@gmail.com on 26 Mar 2010 at 2:56

Attachments:

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
java -jar daisydiff.jar old.html new.html --type=tag

What is the expected output? What do you see instead?
..java.lang.IndexOutOfBoundsException: There is no Atom with index 12
    at org.outerj.daisy.diff.tag.TagComparator.getAtom(Unknown Source)
    at org.outerj.daisy.diff.tag.TagDiffer.preProcess(Unknown Source)
    at org.outerj.daisy.diff.tag.TagDiffer.diff(Unknown Source)
    at org.outerj.daisy.diff.DaisyDiff.diffTag(Unknown Source)
    at org.outerj.daisy.diff.Main.main(Unknown Source)

Original comment by be...@parkflyer.ru on 31 Aug 2011 at 7:20

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Bug fix
TagDiffer.java
line 185

Old:
while ((leftComparator.getAtom(temp) instanceof DelimiterAtom || 
(bridgelength-- > 0))
                        && temp < differences[i + 1].leftStart()) {

                    temp++;
                }
New:

while (temp < differences[i + 1].leftStart() && (leftComparator.getAtom(temp) 
instanceof DelimiterAtom || (bridgelength-- > 0)) ) {

                    temp++;
                }

Original comment by be...@parkflyer.ru on 1 Sep 2011 at 9:03

GoogleCodeExporter commented 9 years ago
Aha! Thanks for submitting this patch. If it is so simple and testcases finish 
successfully it will be committed to trunk.

Original comment by kkape...@gmail.com on 1 Sep 2011 at 5:24

GoogleCodeExporter commented 9 years ago
Committed patch in subversion r171

Original comment by kkape...@gmail.com on 13 Sep 2011 at 9:57