Skip to content

Fix #141: read all lines of version text files - #158

Open
elharo wants to merge 2 commits into
masterfrom
fix-msjar-141-read-all-lines
Open

Fix #141: read all lines of version text files#158
elharo wants to merge 2 commits into
masterfrom
fix-msjar-141-read-all-lines

Conversation

@elharo

@elharo elharo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #141

Problem

TextFileExposer only read the first line of a version text file:

String line = br.readLine();
if (line != null && !line.isEmpty()) {
    textVersions.add(line);
}

Version files with multi-line content (e.g. key=value pairs, multi-line version headers) lose all data beyond line 1.

Fix

Read all lines in a loop:

String line;
while ((line = br.readLine()) != null) {
    if (!line.isEmpty()) {
        textVersions.add(line);
    }
}

Test

Added TextFileExposerTest with two tests that build jars containing multi-line version files and assert all lines are exposed. Both fail on the old code (only first line returned) and pass with the fix.

elharo and others added 2 commits August 7, 2026 14:21
TextFileExposer only read the first line of a version text file, losing
all data beyond line 1 (e.g. key=value pairs, multi-line version headers).
Read all non-empty lines in a loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextFileExposer only reads first line of version text files

1 participant