Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D8FD1114DB for ; Fri, 18 Jul 2014 07:00:10 +0000 (UTC) Received: (qmail 66258 invoked by uid 500); 18 Jul 2014 07:00:10 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 66232 invoked by uid 500); 18 Jul 2014 07:00:10 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 66214 invoked by uid 99); 18 Jul 2014 07:00:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2014 07:00:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2014 07:00:09 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E10122388906; Fri, 18 Jul 2014 06:59:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140718065948.E10122388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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\"?.*");