From 0e6b671c2373c14ca1e50519d906555271e2f152 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 31 Jan 2011 07:02:31 +0100 Subject: Fix: VersionNumber compare shall throw ClassCastException if argument is of different kind --- src/java/com/jogamp/common/util/VersionNumber.java | 6 ++++-- 1 file 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; -- cgit v1.2.3