test/serviceability/dcmd/CodeCacheTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-comp Sdiff test/serviceability/dcmd

test/serviceability/dcmd/CodeCacheTest.java

Print this page
rev 7050 : 8058479: serviceability/dcmd/CodeCacheTest.java fails
Summary: Don't parse really large hex values into a long
Revied-by:


  63 
  64         // Validate first line
  65         String line;
  66         line = r.readLine();
  67         Matcher m = line1.matcher(line);
  68         if (m.matches()) {
  69             for(int i = 1; i <= 4; i++) {
  70                 int val = Integer.parseInt(m.group(i));
  71                 if (val < 0) {
  72                     throw new Exception("Failed parsing dcmd codecache output");
  73                 }
  74             }
  75         } else {
  76             throw new Exception("Regexp 1 failed");
  77         }
  78 
  79         // Validate second line
  80         line = r.readLine();
  81         m = line2.matcher(line);
  82         if (m.matches()) {
  83             long start = Long.parseLong(m.group(1), 16);
  84             if (start < 0) {




  85                 throw new Exception("Failed parsing dcmd codecache output");
  86             }
  87             long mark = Long.parseLong(m.group(2), 16);
  88             if (mark < 0) {
  89                 throw new Exception("Failed parsing dcmd codecache output");
  90             }
  91             long top = Long.parseLong(m.group(3), 16);
  92             if (top < 0) {
  93                 throw new Exception("Failed parsing dcmd codecache output");
  94             }
  95             if (start > mark) {
  96                 throw new Exception("Failed parsing dcmd codecache output");
  97             }
  98             if (mark > top) {
  99                 throw new Exception("Failed parsing dcmd codecache output");
 100             }
 101         } else {
 102             throw new Exception("Regexp 2 failed line: " + line);
 103         }
 104 
 105         // Validate third line
 106         line = r.readLine();
 107         m = line3.matcher(line);
 108         if (m.matches()) {
 109             int blobs = Integer.parseInt(m.group(1));
 110             if (blobs <= 0) {
 111                 throw new Exception("Failed parsing dcmd codecache output");
 112             }
 113             int nmethods = Integer.parseInt(m.group(2));
 114             if (nmethods <= 0) {
 115                 throw new Exception("Failed parsing dcmd codecache output");
 116             }
 117             int adapters = Integer.parseInt(m.group(3));
 118             if (adapters <= 0) {




  63 
  64         // Validate first line
  65         String line;
  66         line = r.readLine();
  67         Matcher m = line1.matcher(line);
  68         if (m.matches()) {
  69             for(int i = 1; i <= 4; i++) {
  70                 int val = Integer.parseInt(m.group(i));
  71                 if (val < 0) {
  72                     throw new Exception("Failed parsing dcmd codecache output");
  73                 }
  74             }
  75         } else {
  76             throw new Exception("Regexp 1 failed");
  77         }
  78 
  79         // Validate second line
  80         line = r.readLine();
  81         m = line2.matcher(line);
  82         if (m.matches()) {
  83             String start = m.group(1);
  84             String mark  = m.group(2);
  85             String top   = m.group(3);
  86 
  87             // Lexical compare of hex numbers to check that they look sane.
  88             if (start.compareTo(mark) > 1) {
  89                 throw new Exception("Failed parsing dcmd codecache output");
  90             }
  91             if (mark.compareTo(top) > 1) {











  92                 throw new Exception("Failed parsing dcmd codecache output");
  93             }
  94         } else {
  95             throw new Exception("Regexp 2 failed line: " + line);
  96         }
  97 
  98         // Validate third line
  99         line = r.readLine();
 100         m = line3.matcher(line);
 101         if (m.matches()) {
 102             int blobs = Integer.parseInt(m.group(1));
 103             if (blobs <= 0) {
 104                 throw new Exception("Failed parsing dcmd codecache output");
 105             }
 106             int nmethods = Integer.parseInt(m.group(2));
 107             if (nmethods <= 0) {
 108                 throw new Exception("Failed parsing dcmd codecache output");
 109             }
 110             int adapters = Integer.parseInt(m.group(3));
 111             if (adapters <= 0) {


test/serviceability/dcmd/CodeCacheTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File