< prev index next >

test/hotspot/jtreg/runtime/cds/appcds/customLoader/ClassListFormatA.java

Print this page

 86             dumpShouldFail(
 87                 "TESTCASE A5: bad input - bad ID (integer too big)",
 88                 appJar, classlist(
 89                     "Hello",
 90                     "java/lang/Object id: 21474836489" // bigger than 32-bit!
 91                 ),
 92                 "Error: expected integer");
 93         }
 94 
 95         // Good input:
 96         dumpShouldPass(
 97             "TESTCASE A6: extraneous spaces, tab characters and trailing new line characters",
 98             appJar, classlist(
 99                 "Hello   ",                   // trailing spaces
100                 "java/lang/Object\tid:\t1",   // \t instead of ' '
101                 "CustomLoadee id: 2 super: 1 source: " + customJarPath,
102                 "CustomInterface2_ia id: 3 super: 1 source: " + customJarPath + " ",
103                 "CustomInterface2_ib id: 4 super: 1 source: " + customJarPath + "\t\t\r" ,
104                 "CustomLoadee2 id: 5 super: 1 interfaces: 3 4 source: " + customJarPath      // preceding spaces
105             ));



106 
107         int _max_allowed_line = 4096; // Must match ClassListParser::_max_allowed_line in C code.
108         int _line_buf_extra = 10;     // Must match ClassListParser::_line_buf_extra in C code.
109         StringBuffer sbuf = new StringBuffer();
110         for (int i=0; i<_max_allowed_line+1; i++) {
111           sbuf.append("x");
112         }
113 
114         dumpShouldFail(
115             "TESTCASE A7: bad input - line too long",
116             appJar, classlist(
117                 sbuf.toString()
118             ),
119             "input line too long (must be no longer than " + _max_allowed_line + " chars");
120 
121         for (int i=0; i<_line_buf_extra + 1000; i++) {
122           sbuf.append("X");
123         }
124 
125         dumpShouldFail(
126             "TESTCASE A8: bad input - line too long: try to overflow C buffer",
127             appJar, classlist(
128                 sbuf.toString()
129             ),
130             "input line too long (must be no longer than " + _max_allowed_line + " chars");


131     }
132 }

 86             dumpShouldFail(
 87                 "TESTCASE A5: bad input - bad ID (integer too big)",
 88                 appJar, classlist(
 89                     "Hello",
 90                     "java/lang/Object id: 21474836489" // bigger than 32-bit!
 91                 ),
 92                 "Error: expected integer");
 93         }
 94 
 95         // Good input:
 96         dumpShouldPass(
 97             "TESTCASE A6: extraneous spaces, tab characters and trailing new line characters",
 98             appJar, classlist(
 99                 "Hello   ",                   // trailing spaces
100                 "java/lang/Object\tid:\t1",   // \t instead of ' '
101                 "CustomLoadee id: 2 super: 1 source: " + customJarPath,
102                 "CustomInterface2_ia id: 3 super: 1 source: " + customJarPath + " ",
103                 "CustomInterface2_ib id: 4 super: 1 source: " + customJarPath + "\t\t\r" ,
104                 "CustomLoadee2 id: 5 super: 1 interfaces: 3 4 source: " + customJarPath      // preceding spaces
105             ));
106         /*
107 
108           FIXME:leyden-premain : these test cases are disabled because ClassListParser can handle much longer lines now
109 
110         int _max_allowed_line = 4096; // Must match ClassListParser::_max_allowed_line in C code.
111         int _line_buf_extra = 10;     // Must match ClassListParser::_line_buf_extra in C code.
112         StringBuffer sbuf = new StringBuffer();
113         for (int i=0; i<_max_allowed_line+1; i++) {
114           sbuf.append("x");
115         }
116 
117         dumpShouldFail(
118             "TESTCASE A7: bad input - line too long",
119             appJar, classlist(
120                 sbuf.toString()
121             ),
122             "input line too long (must be no longer than " + _max_allowed_line + " chars");
123 
124         for (int i=0; i<_line_buf_extra + 1000; i++) {
125           sbuf.append("X");
126         }
127 
128         dumpShouldFail(
129             "TESTCASE A8: bad input - line too long: try to overflow C buffer",
130             appJar, classlist(
131                 sbuf.toString()
132             ),
133             "input line too long (must be no longer than " + _max_allowed_line + " chars");
134 
135         */
136     }
137 }
< prev index next >