Skip to content

changePosition NULL on UnifiedDiffReader.parseUnifiedDiff #117

@elanzini

Description

@elanzini

I was testing the tool and I picked a random commit from this repo to do so. Let's take 5338313. I accessed the diff of it by adding a .diff at the end of the URL and saved it into diff.txt file. I then used the tool to parse it in the following way:

public static void main(String[] args) throws IOException {
    var stream = new FileInputStream(new File("/path/to/diff.txt"));
    var patch  = UnifiedDiffReader.parseUnifiedDiff(stream);

    patch.getFiles().forEach(f -> {
        System.out.println("File: " + f.getFromFile());
        f.getPatch().getDeltas().forEach(delta -> {

            System.out.println("Source: ");
            System.out.println(delta.getSource().getPosition());
            delta.getSource().getChangePosition().forEach(System.out::print);

            System.out.println("Target: ");
            System.out.println(delta.getTarget().getPosition());
            delta.getTarget().getChangePosition().forEach(System.out::print);
        });
    });
}

The delta getChangePosition is just null. Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions