CADbloke / daisydiff

Automatically exported from code.google.com/p/daisydiff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexOutOfBoundsException in Tag mode

GoogleCodeExporter opened this issue · comments

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:

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

  • Added labels: ****
  • Removed labels: ****

Attachments:

[deleted comment]
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

  • Added labels: ****
  • Removed labels: ****
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

  • Changed state: Started
  • Added labels: ****
  • Removed labels: ****
Committed patch in subversion r171

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

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****