JPlag icon indicating copy to clipboard operation
JPlag copied to clipboard

Incorrect file names in report JSON for single-file submissions when multiple submissions directories exist

Open Medo3G opened this issue 9 months ago • 1 comments

For the following directory structure:

1/
├── File1.java
└── Sub1/
    └── File2.java
2/
├── File3.java
└── Sub2/
    └── File4.java

Opening comparison view for a submission related to File1.java or File3.java results in Could not load comparison: Cannot read properties of undefined (reading 'matchedTokenCount').

However, the comparison between File2.java and File4.java loads correctly. The issue does not occur when running JPlag on a single directory.

This function call returns undefined due to incorrect file names. https://github.com/jplag/JPlag/blob/e1b4d6ec85bcdab58542cdfe0a75bc1c7ed41086/report-viewer/src/model/factories/ComparisonFactory.ts#L35

These incorrect file names are in both the comparison files and submissionFileIndex.json. overview.json is seemingly unaffected.

For example "1_File.java": { "1_File1.java\\1_File1.java": { "token_count": 479 } }, should be "1_File.java": { "1_File1.java\\File1.java": { "token_count": 479 } },

I wasn't able to debug it myself, but I suspect the issue stems from this method https://github.com/jplag/JPlag/blob/e1b4d6ec85bcdab58542cdfe0a75bc1c7ed41086/core/src/main/java/de/jplag/reporting/FilePathUtil.java#L24

This issue used to exist in #981, was fixed, but seems to be broken again.

Medo3G avatar Apr 28 '24 15:04 Medo3G

From what I could see this might be the same issue as https://github.com/jplag/JPlag/issues/1610 and was fixed in https://github.com/jplag/JPlag/pull/1645

An example with the same folder structure worked for me when using the current develop build, so I would say the bug was also fixed with that PR. @Medo3G To run an example with that folder structure you can either build from the sources of the develop branch

Kr0nox avatar Apr 28 '24 16:04 Kr0nox

I built from the develop branch and indeed it worked as expected. So it seems like the PR indeed fixed it. Thanks a lot.

Medo3G avatar May 01 '24 22:05 Medo3G