Skip to content

Support for partial version strings? #27

Description

@ilg-ul

I did not check the specs, but in my application I must process partial version strings, like "1.2".

The current parser accepts only "1.2.0".

I patched the VersionParser.parseVersionCore() to:

    private NormalVersion parseVersionCore() {
        int major = Integer.parseInt(numericIdentifier());
        consumeNextCharacter(DOT);
        int minor = Integer.parseInt(numericIdentifier());
        int patch;
        try {
            consumeNextCharacter(DOT);
            patch = Integer.parseInt(numericIdentifier());
        } catch (UnexpectedCharacterException e) {
            patch = 0;
        }
        return new NormalVersion(major, minor, patch);
    }

but perhaps there are better solution.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions