directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r923455 - in /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap: name/DN.java util/AttributeUtils.java util/LdapURL.java util/NamespaceTools.java
Date Mon, 15 Mar 2010 21:59:28 GMT
Author: kayyagari
Date: Mon Mar 15 21:59:28 2010
New Revision: 923455

URL: http://svn.apache.org/viewvc?rev=923455&view=rev
Log:
o updated the code to use either new exceptions or to catch the new exceptions and throw the
jndi exception to keep the interface
compatible for the time being 

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java?rev=923455&r1=923454&r2=923455&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
Mon Mar 15 21:59:28 2010
@@ -33,10 +33,8 @@ import java.util.NoSuchElementException;
 
 import javax.naming.InvalidNameException;
 import javax.naming.Name;
-import javax.naming.NamingException;
 
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
@@ -264,7 +262,7 @@ public class DN implements Name, Externa
      * @param oidsMap The OID mapping
      * @return A valid DN
      * @throws InvalidNameException If the DN is invalid.
-     * @throws NamingException If something went wrong.
+     * @throws LdapInvalidDnException If something went wrong.
      */
     public static Name normalize( String name, Map<String, OidNormalizer> oidsMap )
throws LdapInvalidDnException
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=923455&r1=923454&r2=923455&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
Mon Mar 15 21:59:28 2010
@@ -40,6 +40,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.entry.client.DefaultClientEntry;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
@@ -268,16 +269,23 @@ public class AttributeUtils
 
         if ( type.getSyntax().isHumanReadable() )
         {
-            String comparedStr = normalizer.normalize( compared.getString() );
-
-            for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements();
/**/)
+            try
             {
-                String value = ( String ) values.nextElement();
-                if ( comparedStr.equals( normalizer.normalize( value ) ) )
+                String comparedStr = normalizer.normalize( compared.getString() );
+                
+                for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements();
/**/)
                 {
-                    return true;
+                    String value = ( String ) values.nextElement();
+                    if ( comparedStr.equals( normalizer.normalize( value ) ) )
+                    {
+                        return true;
+                    }
                 }
             }
+            catch( LdapInvalidDnException e )
+            {
+                throw new NamingException( e.getMessage() );
+            }
         }
         else
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java?rev=923455&r1=923454&r2=923455&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/LdapURL.java
Mon Mar 15 21:59:28 2010
@@ -29,14 +29,13 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import javax.naming.InvalidNameException;
-
 import org.apache.directory.shared.asn1.codec.binary.Hex;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.util.HttpClientError;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
 import org.apache.directory.shared.ldap.codec.util.URIException;
 import org.apache.directory.shared.ldap.codec.util.UrlDecoderException;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
 import org.apache.directory.shared.ldap.name.DN;
@@ -770,7 +769,7 @@ public class LdapURL
         {
             return -1;
         }
-        catch ( InvalidNameException de )
+        catch ( LdapInvalidDnException de )
         {
             return -1;
         }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java?rev=923455&r1=923454&r2=923455&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/NamespaceTools.java
Mon Mar 15 21:59:28 2010
@@ -20,15 +20,16 @@
 package org.apache.directory.shared.ldap.util;
 
 
-import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.name.DN;
-
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.naming.Name;
 import javax.naming.NamingException;
 
+import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.name.DN;
+
 
 /**
  * Tools dealing with common Naming operations.
@@ -123,7 +124,14 @@ public class NamespaceTools
         }
         else
         {
-            rdn = new DN( descendant.toString() );
+            try
+            {
+                rdn = new DN( descendant.toString() );
+            }
+            catch( LdapInvalidDnException e )
+            {
+                throw new NamingException( e.getMessage() );
+            }
         }
 
         if ( rdn.startsWith( ancestor ) )



Mime
View raw message