diff options
author | Sven Gothel <[email protected]> | 2011-01-31 07:02:31 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-01-31 07:02:31 +0100 |
commit | 0e6b671c2373c14ca1e50519d906555271e2f152 (patch) | |
tree | cd8ec3ca5e081c9ab90d0a2a3aaa7aef52b9fc86 | |
parent | 429e4121d4fcb0ff4e18e15d647e922ff4618ab0 (diff) |
Fix: VersionNumber compare shall throw ClassCastException if argument is of different kind
-rw-r--r-- | src/java/com/jogamp/common/util/VersionNumber.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java/com/jogamp/common/util/VersionNumber.java b/src/java/com/jogamp/common/util/VersionNumber.java index 8c997e6..f0ba820 100644 --- a/src/java/com/jogamp/common/util/VersionNumber.java +++ b/src/java/com/jogamp/common/util/VersionNumber.java @@ -54,9 +54,11 @@ public class VersionNumber implements Comparable { } public final int compareTo(Object o) { - if( ! ( o instanceof VersionNumber ) ) { - return -1; + if ( ! ( o instanceof VersionNumber ) ) { + Class c = (null != o) ? o.getClass() : null ; + throw new ClassCastException("Not a Capabilities object: " + c); } + VersionNumber vo = (VersionNumber) o; if (major > vo.major) { return 1; |