harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhouke...@apache.org
Subject svn commit: r938332 - in /harmony/enhanced/java/trunk/classlib/modules/security/src: main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java
Date Tue, 27 Apr 2010 06:52:21 GMT
Author: zhoukevin
Date: Tue Apr 27 06:52:20 2010
New Revision: 938332

URL: http://svn.apache.org/viewvc?rev=938332&view=rev
Log:
org.apache.harmony.security.DefaultPolicyScanner.readPrincipalEntry(StreamTokenizer) should
ignore whitespace of in PrincipalEntry.name

Modified:
    harmony/enhanced/java/trunk/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
    harmony/enhanced/java/trunk/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java?rev=938332&r1=938331&r2=938332&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/security/src/main/java/common/org/apache/harmony/security/DefaultPolicyScanner.java
Tue Apr 27 06:52:20 2010
@@ -271,7 +271,16 @@ public class DefaultPolicyScanner {
             st.nextToken();
         }
         if (st.ttype == '"') {
-            pe.name = st.sval;
+            StringBuilder sb = new StringBuilder();
+            String[] elements = st.sval.split("[,]"); //$NON-NLS-1$
+            int endIndex = elements.length - 1;
+            for (int index = 0; index < endIndex; index++) {
+                sb.append(elements[index].trim() + ',');
+            }
+            if (endIndex > -1) {
+                sb.append(elements[endIndex].trim());
+            }
+            pe.name = sb.toString();
         } else if (st.ttype == '*') {
             pe.name = PrincipalEntry.WILDCARD;
         } else {

Modified: harmony/enhanced/java/trunk/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java?rev=938332&r1=938331&r2=938332&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/security/src/test/impl/java.injected/org/apache/harmony/security/DefaultPolicyScannerTest.java
Tue Apr 27 06:52:20 2010
@@ -264,6 +264,10 @@ public class DefaultPolicyScannerTest ex
         pe = scanner.readPrincipalEntry(getST("clazz *"));
         assertEquals(DefaultPolicyScanner.PrincipalEntry.WILDCARD, pe.name);
         assertEquals("clazz", pe.klass);
+
+        pe = scanner.readPrincipalEntry(getST("\"a, b, c, d\""));
+        assertEquals("a,b,c,d", pe.name);
+        assertNull(pe.klass);
     }
 
     /**



Mime
View raw message