ArrayIndexOutOfBoundsException when both original and revision List is empty
Closed this issue · 4 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. Call DiffUtils.diff(new ArrayList<String>(), new ArrayList<String>())
2. java.lang.ArrayIndexOutOfBoundsException: 3
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
1.2
Please provide any additional information below.
Full stacktrace:
java.lang.ArrayIndexOutOfBoundsException: 3
at difflib.myers.MyersDiff.buildPath(MyersDiff.java:140)
at difflib.myers.MyersDiff.diff(MyersDiff.java:106)
at difflib.myers.MyersDiff.diff(MyersDiff.java:94)
at difflib.DiffUtils.diff(DiffUtils.java:58)
at difflib.DiffUtils.diff(DiffUtils.java:46)
Original issue reported on code.google.com by xuantinh@gmail.com
on 5 Oct 2010 at 5:08
GoogleCodeExporter commented
This code snippet caused the problem: with M=0 and N=0
// these are local constants
final int N = orig.length;
final int M = rev.length;
final int MAX = N + M + 1;
final int size = 1 + 2 * MAX;
final int middle = (size + 1) / 2;
final PathNode diagonal[] = new PathNode[size];
diagonal[middle + 1] = new Snake(0, -1, null); <--- die at this line :)
Original comment by xuantinh@gmail.com
on 5 Oct 2010 at 5:11
GoogleCodeExporter commented
[deleted comment]
GoogleCodeExporter commented
Original comment by dm.naume...@gmail.com
on 15 Oct 2010 at 11:36
- Changed state: Started
GoogleCodeExporter commented
Thanks, was fixed in the latest commits. I will update you when these changes
will be released.
Original comment by dm.naume...@gmail.com
on 15 Oct 2010 at 11:56
- Changed state: Fixed