intelligen / java-diff-utils

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

IndexOutOfBoundsException for seemingly correct patch #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Pls see attached files: I have a Patcher java which I use to apply a sequence 
of patches to the source code and I have a PatcherTest that fails with the 
following stack trace:

java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at difflib.Chunk.verify(Chunk.java:85)
    at difflib.ChangeDelta.verify(ChangeDelta.java:78)
    at difflib.ChangeDelta.applyTo(ChangeDelta.java:44)
    at difflib.Patch.applyTo(Patch.java:43)
    at difflib.DiffUtils.patch(DiffUtils.java:70)
    at com.klocwork.bonobo.Patcher.patch(Patcher.java:31)
    at com.klocwork.bonobo.PatcherTest.test(PatcherTest.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:64)

Original issue reported on code.google.com by shotwave@gmail.com on 10 Nov 2010 at 4:31

Attachments:

GoogleCodeExporter commented 9 years ago
Please checkout attached tarball of the project: I have added a tst for the 
issue and fixed the code (see DiffUtils.generateUnifiedDiff, lines 143-145). 
Prior to the fix empty lines were ignored, however they were produced by 
unified diff as a part of context if the original source contained empty lines. 
Hope this helps.

I would like to further contribute to the project, can I get access?

Original comment by shotwave@gmail.com on 2 Dec 2010 at 4:06

Attachments:

GoogleCodeExporter commented 9 years ago
Hi

Sorry for being late. Please, don't hesitate to ping my via email if you need a 
faster response.

I will check your patch today/tomorrow and add you to project contributors w/o 
problem.

Big thanks,
Dmitry 

Original comment by dm.naume...@gmail.com on 7 Dec 2010 at 12:44

GoogleCodeExporter commented 9 years ago
fixed in r26

Original comment by shotwave@gmail.com on 9 Dec 2010 at 7:11