< prev index next >

test/hotspot/jtreg/runtime/appcds/sharedStrings/InvalidFileFormat.java

Print this page




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /*
  26  * @test
  27  * @summary Check most common errors in file format
  28  * @requires vm.cds.archived.java.heap
  29  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  30  * @modules java.base/jdk.internal.misc
  31  * @modules java.management
  32  *          jdk.jartool/sun.tools.jar
  33  * @build HelloString
  34  * @run main InvalidFileFormat


  35  */
  36 
  37 import jdk.test.lib.process.OutputAnalyzer;
  38 import java.io.File;
  39 
  40 // Checking most common error use cases
  41 // This file is not an exhastive test of various shared data file corruption
  42 // Note on usability intent: the shared data file is created and handled by
  43 // the previledge person in the server environment.
  44 public class InvalidFileFormat {
  45     public static void main(String[] args) throws Exception {
  46         SharedStringsUtils.buildJar("HelloString");
  47 
  48         test("NonExistentFile.txt", "Unable to get hashtable dump file size");
  49         test("InvalidHeader.txt", "wrong version of hashtable dump file");
  50         test("InvalidVersion.txt", "wrong version of hashtable dump file");
  51         test("CorruptDataLine.txt", "Unknown data type. Corrupted at line 2");
  52         test("InvalidSymbol.txt", "Unexpected character. Corrupted at line 2");
  53         test("InvalidSymbolFormat.txt", "Unrecognized format. Corrupted at line 9");
  54         test("OverflowPrefix.txt", "Num overflow. Corrupted at line 4");


  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 /*
  26  * @test
  27  * @summary Check most common errors in file format
  28  * @requires vm.cds.archived.java.heap
  29  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  30  * @modules java.base/jdk.internal.misc
  31  * @modules java.management
  32  *          jdk.jartool/sun.tools.jar
  33  * @build HelloString
  34  * @run main InvalidFileFormat
  35  * @run main/othervm -XX:+UseStringDeduplication InvalidFileFormat
  36  * @run main/othervm -XX:-CompactStrings InvalidFileFormat
  37  */
  38 
  39 import jdk.test.lib.process.OutputAnalyzer;
  40 import java.io.File;
  41 
  42 // Checking most common error use cases
  43 // This file is not an exhastive test of various shared data file corruption
  44 // Note on usability intent: the shared data file is created and handled by
  45 // the previledge person in the server environment.
  46 public class InvalidFileFormat {
  47     public static void main(String[] args) throws Exception {
  48         SharedStringsUtils.buildJar("HelloString");
  49 
  50         test("NonExistentFile.txt", "Unable to get hashtable dump file size");
  51         test("InvalidHeader.txt", "wrong version of hashtable dump file");
  52         test("InvalidVersion.txt", "wrong version of hashtable dump file");
  53         test("CorruptDataLine.txt", "Unknown data type. Corrupted at line 2");
  54         test("InvalidSymbol.txt", "Unexpected character. Corrupted at line 2");
  55         test("InvalidSymbolFormat.txt", "Unrecognized format. Corrupted at line 9");
  56         test("OverflowPrefix.txt", "Num overflow. Corrupted at line 4");
< prev index next >