changeset 4046:f326a018fd3f

7029680: fix test/sun/misc/Version/Version.java build parsing Reviewed-by: ohair
author smarks
date Thu, 24 Mar 2011 17:26:40 -0700
parents 632a96f5752d
children 4a64eefbfd7a
files test/sun/misc/Version/Version.java
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test/sun/misc/Version/Version.java	Thu Mar 24 11:40:13 2011 -0700
+++ b/test/sun/misc/Version/Version.java	Thu Mar 24 17:26:40 2011 -0700
@@ -142,15 +142,21 @@
                 // non-product VM will have -debug|-release appended
                 cs = cs.subSequence(1, cs.length());
                 String[] res = cs.toString().split("-");
-                for (String s : res) {
+                for (int i = res.length - 1; i >= 0; i--) {
+                    String s = res[i];
                     if (s.charAt(0) == 'b') {
-                        build =
-                            Integer.valueOf(s.substring(1, s.length())).intValue();
-                        break;
+                        try {
+                            build = Integer.parseInt(s.substring(1, s.length()));
+                            break;
+                        } catch (NumberFormatException nfe) {
+                            // ignore
+                        }
                     }
                 }
             }
         }
-        return new VersionInfo(major, minor, micro, update, special, build);
+        VersionInfo vi = new VersionInfo(major, minor, micro, update, special, build);
+        System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi);
+        return vi;
     }
 }