java-diff-utils / java-diff-utils

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.

Home Page:https://java-diff-utils.github.io/java-diff-utils/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

this place will throw Exception

90ji opened this issue · comments

if (position + fuzz > target.size() || last - fuzz > target.size()) {

If the size of target is exactly 5

and fuzz =0 and position = 5

this place will throw exception

    List<String> list1 = new ArrayList<>();
    list1.add("1");
    list1.add("123");
    list1.add("1234");
    list1.add("123456");
    list1.add("1234567");

    List<String> list2 = new ArrayList<>();
    list2.add("10");
    list2.add("123");
    list2.add("1234");
    list2.add("12345699");
    list2.add("1234567");

    List<String> list3 = new ArrayList<>();
    list3.add("12");
    list3.add("123");
    list3.add("1234");

    Patch<String> patch = DiffUtils.diff(list1, list2);
    List<String> strings = patch.applyTo(list3);

code like this

You are right. What kind of behaviour do you propose?

Stale issue message