aboutsummaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rwxr-xr-xapi/src/main/java/org/semver/Version.java4
-rwxr-xr-xapi/src/test/java/org/semver/VersionTest.java5
2 files changed, 3 insertions, 6 deletions
diff --git a/api/src/main/java/org/semver/Version.java b/api/src/main/java/org/semver/Version.java
index a6bb770..a878043 100755
--- a/api/src/main/java/org/semver/Version.java
+++ b/api/src/main/java/org/semver/Version.java
@@ -97,7 +97,9 @@ public final class Version implements Comparable<Version> {
} else {
patch = 0;
}
- return new Version(major, minor, patch, matcher.group(4), matcher.group(5));
+ final String separator = matcher.group(4);
+ final String special = matcher.group(5);
+ return new Version(major, minor, patch, separator, "".equals(special) ? null : special);
}
/**
diff --git a/api/src/test/java/org/semver/VersionTest.java b/api/src/test/java/org/semver/VersionTest.java
index ab32892..11f3d00 100755
--- a/api/src/test/java/org/semver/VersionTest.java
+++ b/api/src/test/java/org/semver/VersionTest.java
@@ -63,11 +63,6 @@ public class VersionTest {
@Test(expected=IllegalArgumentException.class)
public void shouldInvalidVersion2NotBeParsed() {
- Version.parse("1.2.3.4");
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void shouldInvalidVersion3NotBeParsed() {
Version.parse("a.2.3");
}