db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1295507 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Date Thu, 01 Mar 2012 10:56:38 GMT
Author: kristwaa
Date: Thu Mar  1 10:56:37 2012
New Revision: 1295507

URL: http://svn.apache.org/viewvc?rev=1295507&view=rev
Log:
DERBY-5631: Extend SecurityManagerSetup to add extra privileges to the set of default privileges
(merge two policy files)

The previous commit for this issue (revision 1295436) broke all test-cases
using no security policy ("<NONE>").
Fixed handling of NO_POLICY.

Patch file: derby-5631-1d-merge_policy_files-fix.diff

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

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?rev=1295507&r1=1295506&r2=1295507&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
Thu Mar  1 10:56:37 2012
@@ -485,19 +485,22 @@ public final class SecurityManagerSetup 
      *
      * @param policy1 first policy
      * @param policy2 second policy (may be {@code null})
-     * @return The location of a policy resource.
+     * @return The location of a policy resource, or {@linkplain #NO_POLICY}.
      * @throws IOException if reading or writing a policy resource fails
      */
     private static String getEffectivePolicyResource(String policy1,
                                                      String policy2)
             throws IOException {
-        URL url1 = BaseTestCase.getTestResource(policy1);
-        String resource = url1.toExternalForm();
-        if (policy2 != null) {
-            URL url2 = BaseTestCase.getTestResource(policy2);
-            // Don't use URL.equals - it blocks and goes onto the network.
-            if (!url1.toExternalForm().equals(url2.toExternalForm())) {
-                resource = mergePolicies(url1, url2);
+        String resource = policy1;
+        if (!NO_POLICY.equals(resource)) {
+            URL url1 = BaseTestCase.getTestResource(policy1);
+            resource = url1.toExternalForm();
+            if (policy2 != null) {
+                URL url2 = BaseTestCase.getTestResource(policy2);
+                // Don't use URL.equals - it blocks and goes onto the network.
+                if (!url1.toExternalForm().equals(url2.toExternalForm())) {
+                    resource = mergePolicies(url1, url2);
+                }
             }
         }
         return resource;



Mime
View raw message