db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1611546 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java
Date Fri, 18 Jul 2014 06:59:48 GMT
Author: kahatlen
Date: Fri Jul 18 06:59:48 2014
New Revision: 1611546

URL: http://svn.apache.org/r1611546
Log:
DERBY-6617: Make MissingPermissionsTest run cleanly on IBM

The error message of the AccessControlException on IBM is the string
"Access denied" (with capital A), whereas the expected message was
"access denied" (lowercase a). Adjust the regular expressions used to
check the messages so that they accept both.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java?rev=1611546&r1=1611545&r2=1611546&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/junit/MissingPermissionsTest.java
Fri Jul 18 06:59:48 2014
@@ -244,13 +244,15 @@ public class MissingPermissionsTest exte
 
         // The actual message may vary. On Java 6, the names are not quoted,
         // whereas newer versions double-quote them. On Windows, the directory
-        // separator is different. Use a regular expression that matches any
-        // variant.
+        // separator is different. Also, different JVM vendors capitalize
+        // the "access denied" message differently.
+        //
+        // Use a regular expression that matches all known variants.
         final String expectedMessageOnConsole =
             "(?s).*The file or directory system.nested could not be created " +
             "due to a security exception: " +
-            "java.security.AccessControlException: access denied " +
-            "\\(\"?java.io.FilePermission\"? \"?system.nested\"? " +
+            "java\\.security\\.AccessControlException: [Aa]ccess denied " +
+            "\\(\"?java\\.io\\.FilePermission\"? \"?system.nested\"? " +
             "\"?write\"?\\).*";
 
         final String output = spawned.getFullServerOutput(); // ignore
@@ -267,11 +269,13 @@ public class MissingPermissionsTest exte
     private String makeMessage(String property) {
         // A variable part in the message is whether or not the names are
         // double-quoted. In Java 6 they are not. In newer versions they are.
+        // Another variable part is that the captitalization of "access denied"
+        // varies depending on the JVM vendor.
         final StringBuilder sb = new StringBuilder();
         sb.append("(?s).*WARNING: the property ");
         sb.append(Pattern.quote(property));
         sb.append(" could not be read due to a security exception: ");
-        sb.append("java\\.security\\.AccessControlException: access denied \\(");
+        sb.append("java\\.security\\.AccessControlException: [Aa]ccess denied \\(");
         sb.append("\"?java\\.util\\.PropertyPermission\"? \"?");
         sb.append(Pattern.quote(property));
         sb.append("\"? \"?read\"?.*");



Mime
View raw message