Put a default value for version

This commit is contained in:
stom79 2017-11-09 18:54:15 +01:00
parent 7d1b2aae72
commit 1a3983d65e
1 changed files with 2 additions and 2 deletions

View File

@ -17,10 +17,10 @@ public class Version implements Comparable<Version> {
public Version(String version) {
if(version == null)
throw new IllegalArgumentException("Version can not be null");
version = "2.0";
version = version.replaceAll("[^\\d.]", "");
if(!version.matches("[0-9]+(\\.[0-9]+)*"))
throw new IllegalArgumentException("Invalid version format");
version = "2.0";
this.version = version;
}