intelligen / java-diff-utils

Automatically exported from code.google.com/p/java-diff-utils
0 stars 0 forks source link

ArrayIndexOutOfBoundsException in DiffUtils.generateUnifiedDiff #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
public class testGenerateUnifiedDiffWithZeroDiffs extends TestCase {
    String myContent = "abc";

    public void testDiffRowGenerator() {
        Patch patch = DiffUtils.diff(myContent, myContent);
                DiffUtils.generateUnifiedDiff("myContent.txt", "myContent.txt", myContent, patch, 0));
    }
}

What is the expected output? What do you see instead?
I would expect to see no diffs. Instead I see an ArrayIndexOutOfBoundsException.

What version of the product are you using? On what operating system?
Version 1.2 on Windows XP

Please provide any additional information below.
The issue is with this line:
    Delta delta = patchDeltas.get(0);
which tries to get the first delta without testing to see if there are are any 
deltas.

Original issue reported on code.google.com by KI4...@gmail.com on 18 Feb 2011 at 6:40

GoogleCodeExporter commented 9 years ago
Fixed. Thanks for the info!

Original comment by dm.naume...@gmail.com on 25 May 2011 at 11:13