--- a/test/jdk/java/io/FilePermission/SpecTests.java Mon Oct 14 18:48:10 2019 -0700
+++ b/test/jdk/java/io/FilePermission/SpecTests.java Wed Oct 16 14:32:17 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,11 +22,10 @@
*/
/**
- *
* @test
- * @bug 4955804
- * @summary Tests for FilePermission constructor spec for null
- * and empty String parameters
+ * @bug 4955804 8230407
+ * @summary Tests for FilePermission constructor spec for null,
+ * empty and misformated String parameters
*/
import java.io.*;
@@ -37,10 +36,11 @@
String ILE = "java.lang.IllegalArgumentException";
String NPE = "java.lang.NullPointerException";
- String names[] = {"", null, "foo", "foo", "foo", "foo"};
+ String names[] = {"", null, "foo", "foo", "foo", "foo", "foo"};
String actions[] = {"read", "read", "", null, "junk",
- "read,write,execute,delete,rename"};
- String exps[] = { null, NPE, ILE, ILE, ILE, ILE };
+ "read,write,execute,delete,rename",
+ ",read"};
+ String exps[] = { null, NPE, ILE, ILE, ILE, ILE, ILE };
FilePermission permit;
for (int i = 0; i < names.length; i++) {
@@ -54,15 +54,19 @@
" for name:" + names[i] +
" actions:" + actions[i]);
} else {
- System.out.println(names[i] + ", [" + actions[i] + "] " +
- "resulted in " + exps[i] + " as Expected");
+ System.out.println(names[i] + ", [" + actions[i] + "] " +
+ "resulted in " + exps[i] + " as Expected");
+ continue;
}
- }
- if (exps[i] == null) {
+ }
+ if (exps[i] == null) {
System.out.println(names[i] + ", [" + actions[i] + "] " +
- "resulted in No Exception as Expected");
+ "resulted in No Exception as Expected");
+ } else {
+ throw new Exception("Expecting: " + exps[i] +
+ " for name:" + names[i] +
+ " actions:" + actions[i]);
}
}
-
}
}