5 minutes ago

java-diff-utils is a library for comparing texts: computing diffs, applying patches, generating unified diffs,...


Issue 10: https://code.google.com/p/java-diff-utils/issues/detail?id=10&can=1

We have 1 original text file and a patch file for it, when apply patch for the original text, we get an exception with this stack trace:

You can get the input files in the above link of this issue

Analyzed Result

2 minutes ago

Result from Ziyuan:

The predicate is output to the users:

line.isEmpty == false (difflib.DiffUtils:137)


91 seconds ago

Explanation for the bug:
In the function DiffUtils.parseUnifiedDiff(List diff), when parsing the patch file, in case the line is empty, it was not added to rawChunk. As a result, the patch and the original text have a different number of lines, which later causes the exception.
This is the fix for the bug:


We feed the passed test cases from Ziyuan to Daikon. After a while, Daikon creates a lot of invariants (file). We check the invariants inside the function parseUnifiedDiff(). However, no useful invariants has been found.


The input of FailureDoc is a sequence. In this case, we manually create below sequence as its input. However, FailureDoc says that the sequence has not error and does not give any explanation.


var0 = cons : issues.issue10.TestIssue10.<init>() :

var1 = prim : java.lang.String:"original1" :

var2 = method : issues.issue10.TestIssue10.getFile(java.lang.String) : var0 var1

var3 = cons : issues.issue10.Patcher.<init>(java.lang.String) : var2

var4 = prim : java.lang.String:"patch1.1" :

var5 = method : issues.issue10.TestIssue10.getFile(java.lang.String) : var0 var4

var6 = method : issues.issue10.Patcher.patch(java.lang.String) : var3 var5