Skip to content

ManifestContentHandler compares the "old" file against itself, failing to detect changes. #8

@nsalvi-afea

Description

@nsalvi-afea

A bug has been identified in the ManifestContentHandler class (responsible for comparing MANIFEST.MF files).

Currently, the diff method parses the manifest file from the first archive (zipIndexEntry) and then, incorrectly, parses the exact same file (zipIndexEntry) again for the comparison, instead of parsing the file from the second archive (otherZipIndexEntry).

This causes the comparison to always be performed between a file and itself. As a result, the tool will never detect any changes in MANIFEST.MF files, even if they are different.

Code Snippet Affected: https://github.com/cbuschka/zipdiff/blob/ce248bd9ba82cb3edd7dd5fd4ce4d8edb07a2357/core/src/main/java/com/github/cbuschka/zipdiff/content_diff/ManifestContentHandler.java#L42C2-L56C1

Proposed Solution

Modify the line 47 to use otherZipIndexEntry.getDataStream():

Map<String, String> otherManifest = this.parser.read(new BufferedReader(new InputStreamReader(otherZipIndexEntry.getDataStream(), StandardCharsets.UTF_8)));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions