From ef8949d4bdfb21bbe423acc661affaf59369f859 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 31 May 2013 06:52:32 +0200 Subject: Complete/Fix GLVersionNumber (81afec4e963ac4372dc2b604d6f91237b81ee6f2): Set 'valid' flag, always set major/minor and strEnd. Also: Add negative tests to unit test. --- src/jogl/classes/jogamp/opengl/GLVersionNumber.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index a32fdfa77..0ce34a60d 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -60,6 +60,7 @@ public class GLVersionNumber extends VersionNumberString { int[] val = new int[] { 0, 0, 0 }; int strEnd = 0; short state = 0; + boolean valid = false; if (versionString != null && versionString.length() > 0) { try { final java.util.regex.Pattern versionPattern; @@ -69,13 +70,12 @@ public class GLVersionNumber extends VersionNumberString { versionPattern = VersionNumberString.getDefaultVersionNumberPattern(); } final VersionNumberString version = new VersionNumberString(versionString, versionPattern); - if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component! - val[0] = version.getMajor(); - val[1] = version.getMinor(); - strEnd = version.endOfStringMatch(); - state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | - ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); - } + strEnd = version.endOfStringMatch(); + val[0] = version.getMajor(); + val[1] = version.getMinor(); + state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | + ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); + valid = version.hasMajor() && version.hasMinor(); // Requires at least a defined major and minor version component! } catch (Exception e) { e.printStackTrace(); System.err.println("Info: ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.: " + e); @@ -83,7 +83,7 @@ public class GLVersionNumber extends VersionNumberString { val[1] = 0; } } - return new GLVersionNumber(val, strEnd, state, versionString, false); + return new GLVersionNumber(val, strEnd, state, versionString, valid); } public final boolean isValid() { -- cgit v1.2.3