harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r694634 - in /harmony/enhanced/classlib/trunk/modules/jndi/src: main/java/org/apache/harmony/jndi/internal/parser/ test/java/org/apache/harmony/jndi/internal/ test/java/org/apache/harmony/jndi/internal/parser/
Date Fri, 12 Sep 2008 07:49:46 GMT
Author: tonywu
Date: Fri Sep 12 00:49:46 2008
New Revision: 694634

URL: http://svn.apache.org/viewvc?rev=694634&view=rev
Log:
Apply patch for HARMONY-5978 [classlib][jndi] - javax.naming.ldap.LdapName.endsWith and startsWith
are not threadsafe

Added:
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/parser/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/parser/LdapRdnParserTest.java
Modified:
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java?rev=694634&r1=694633&r2=694634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java
Fri Sep 12 00:49:46 2008
@@ -30,7 +30,7 @@
  */
 public class LdapRdnParser implements LdapParser {
 
-    private static String name = null;
+    private String name = null;
 
     LdapTypeAndValueList list = new LdapTypeAndValueList();
 
@@ -45,9 +45,9 @@
      */
     public LdapRdnParser(String name) {
         if (name.endsWith("+")) {
-            LdapRdnParser.name = name.substring(0, name.lastIndexOf('+'));
+            this.name = name.substring(0, name.lastIndexOf('+'));
         } else {
-            LdapRdnParser.name = name;
+            this.name = name;
         }
     }
 

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/parser/LdapRdnParserTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/parser/LdapRdnParserTest.java?rev=694634&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/parser/LdapRdnParserTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/internal/parser/LdapRdnParserTest.java
Fri Sep 12 00:49:46 2008
@@ -0,0 +1,38 @@
+/* 
+ *  Licensed to the Apache Software Foundation (ASF) under one or more 
+ *  contributor license agreements.  See the NOTICE file distributed with 
+ *  this work for additional information regarding copyright ownership. 
+ *  The ASF licenses this file to You under the Apache License, Version 2.0 
+ *  (the "License"); you may not use this file except in compliance with 
+ *  the License.  You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ *  Unless required by applicable law or agreed to in writing, software 
+ *  distributed under the License is distributed on an "AS IS" BASIS, 
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ *  See the License for the specific language governing permissions and 
+ *  limitations under the License. 
+ */
+
+
+package org.apache.harmony.jndi.internal.parser;
+
+import java.util.List;
+
+import javax.naming.directory.Attribute;
+
+import junit.framework.TestCase;
+
+public class LdapRdnParserTest extends TestCase {
+    public void test_getList() throws Exception {
+        LdapRdnParser parser1 = new LdapRdnParser("cn=test");
+        LdapRdnParser parser2 = new LdapRdnParser("o=harmony+sn=test");
+
+        List list = parser1.getList();
+
+        assertEquals(1, list.size());
+        assertEquals("cn", ((Attribute) list.get(0)).getID()); 
+        assertEquals("test", ((Attribute) list.get(0)).get());
+    }
+}



Mime
View raw message