Skip to content

Commit

Permalink
Version: Throw InvalidVersionException for invalid versions
Browse files Browse the repository at this point in the history
  • Loading branch information
alvasw committed Oct 20, 2024
1 parent 31167e0 commit 27f1a6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package bisq.common.platform;

public class InvalidVersionException extends RuntimeException {
public InvalidVersionException(String message) {
super(message);
}
}
4 changes: 2 additions & 2 deletions common/src/main/java/bisq/common/platform/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
public class Version implements Comparable<Version> {
public static void validate(String versionAsString) {
if (versionAsString == null || versionAsString.isEmpty()) {
throw new IllegalArgumentException("Version must not be null or empty");
throw new InvalidVersionException("Version must not be null or empty");
}
if (!versionAsString.matches("[0-9]+(\\.[0-9]+)*")) {
throw new IllegalArgumentException("Invalid version format. version=" + versionAsString);
throw new InvalidVersionException("Invalid version format. version=" + versionAsString);
}
}

Expand Down

0 comments on commit 27f1a6a

Please sign in to comment.