src/java.base/share/classes/sun/misc/Version.java.template

Print this page




 266     private static boolean jvmVersionInfoAvailable;
 267     private static synchronized void initVersions() {
 268         if (versionsInitialized) {
 269             return;
 270         }
 271         jvmVersionInfoAvailable = getJvmVersionInfo();
 272         if (!jvmVersionInfoAvailable) {
 273             // parse java.vm.version for older JVM before the
 274             // new JVM_GetVersionInfo is added.
 275             // valid format of the version string is:
 276             // n.n.n[_uu[c]][-<identifer>]-bxx
 277             CharSequence cs = System.getProperty("java.vm.version");
 278             if (cs.length() >= 5 &&
 279                 Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
 280                 Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' &&
 281                 Character.isDigit(cs.charAt(4))) {
 282                 jvm_major_version = Character.digit(cs.charAt(0), 10);
 283                 jvm_minor_version = Character.digit(cs.charAt(2), 10);
 284                 jvm_micro_version = Character.digit(cs.charAt(4), 10);
 285                 cs = cs.subSequence(5, cs.length());
 286                 if (cs.charAt(0) == '_' && cs.length() >= 3 &&
 287                     Character.isDigit(cs.charAt(1)) &&
 288                     Character.isDigit(cs.charAt(2))) {
 289                     int nextChar = 3;









 290                     try {
 291                         String uu = cs.subSequence(1, 3).toString();
 292                         jvm_update_version = Integer.valueOf(uu).intValue();
 293                         if (cs.length() >= 4) {
 294                             char c = cs.charAt(3);
 295                             if (c >= 'a' && c <= 'z') {
 296                                 jvm_special_version = Character.toString(c);
 297                                 nextChar++;
 298                             }
 299                         }
 300                     } catch (NumberFormatException e) {
 301                         // not conforming to the naming convention
 302                         return;
 303                     }
 304                     cs = cs.subSequence(nextChar, cs.length());
 305                 }
 306                 if (cs.charAt(0) == '-') {
 307                     // skip the first character
 308                     // valid format: <identifier>-bxx or bxx
 309                     // non-product VM will have -debug|-release appended
 310                     cs = cs.subSequence(1, cs.length());
 311                     String[] res = cs.toString().split("-");
 312                     for (String s : res) {
 313                         if (s.charAt(0) == 'b' && s.length() == 3 &&
 314                             Character.isDigit(s.charAt(1)) &&




 266     private static boolean jvmVersionInfoAvailable;
 267     private static synchronized void initVersions() {
 268         if (versionsInitialized) {
 269             return;
 270         }
 271         jvmVersionInfoAvailable = getJvmVersionInfo();
 272         if (!jvmVersionInfoAvailable) {
 273             // parse java.vm.version for older JVM before the
 274             // new JVM_GetVersionInfo is added.
 275             // valid format of the version string is:
 276             // n.n.n[_uu[c]][-<identifer>]-bxx
 277             CharSequence cs = System.getProperty("java.vm.version");
 278             if (cs.length() >= 5 &&
 279                 Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
 280                 Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' &&
 281                 Character.isDigit(cs.charAt(4))) {
 282                 jvm_major_version = Character.digit(cs.charAt(0), 10);
 283                 jvm_minor_version = Character.digit(cs.charAt(2), 10);
 284                 jvm_micro_version = Character.digit(cs.charAt(4), 10);
 285                 cs = cs.subSequence(5, cs.length());
 286                 if (cs.charAt(0) == '_' && cs.length() >= 3) {
 287                     int nextChar = 0;
 288                     if (Character.isDigit(cs.charAt(1)) &&
 289                         Character.isDigit(cs.charAt(2)) &&
 290                         Character.isDigit(cs.charAt(3)))
 291                     {
 292                         nextChar = 4;
 293                     } else if (Character.isDigit(cs.charAt(1)) &&
 294                         Character.isDigit(cs.charAt(2)))
 295                     {
 296                         nextChar = 3;
 297                     }
 298 
 299                     try {
 300                         String uu = cs.subSequence(1, nextChar).toString();
 301                         jvm_update_version = Integer.valueOf(uu).intValue();
 302                         if (cs.length() >= nextChar + 1) {
 303                             char c = cs.charAt(nextChar);
 304                             if (c >= 'a' && c <= 'z') {
 305                                 jvm_special_version = Character.toString(c);
 306                                 nextChar++;
 307                             }
 308                         }
 309                     } catch (NumberFormatException e) {
 310                         // not conforming to the naming convention
 311                         return;
 312                     }
 313                     cs = cs.subSequence(nextChar, cs.length());
 314                 }
 315                 if (cs.charAt(0) == '-') {
 316                     // skip the first character
 317                     // valid format: <identifier>-bxx or bxx
 318                     // non-product VM will have -debug|-release appended
 319                     cs = cs.subSequence(1, cs.length());
 320                     String[] res = cs.toString().split("-");
 321                     for (String s : res) {
 322                         if (s.charAt(0) == 'b' && s.length() == 3 &&
 323                             Character.isDigit(s.charAt(1)) &&