directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1665870 - in /directory/shared/trunk/ldap: client/api/src/main/java/org/apache/directory/ldap/client/api/ model/src/main/java/org/apache/directory/api/ldap/model/schema/
Date Wed, 11 Mar 2015 13:25:56 GMT
Author: elecharny
Date: Wed Mar 11 13:25:55 2015
New Revision: 1665870

URL: http://svn.apache.org/r1665870
Log:
Applied Radovan's patches (https://github.com/apache/directory-shared/pull/1/files)

Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultSchemaLoader.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/DitStructureRule.java

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultSchemaLoader.java?rev=1665870&r1=1665869&r2=1665870&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/DefaultSchemaLoader.java
Wed Mar 11 13:25:55 2015
@@ -113,12 +113,27 @@ public class DefaultSchemaLoader extends
      */
     public DefaultSchemaLoader( LdapConnection connection ) throws LdapException
     {
+        this( connection, false );
+    }
+
+
+    /**
+     * Creates a new instance of DefaultSchemaLoader.
+     *
+     * @param connection the LDAP connection
+     * @param initial setting for the quirks mode
+     * @throws Exception if the connection is not authenticated or if there are any problems
+     *                   while loading the schema entries
+     */
+    public DefaultSchemaLoader( LdapConnection connection, boolean quirksMode ) throws LdapException
+    {
         if ( connection == null )
         {
             throw new InvalidConnectionException( "Cannot connect on the server, the connection
is null" );
         }
 
         this.connection = connection;
+        setQuirksMode( quirksMode );
 
         // Flagging if the connection was already connected
         boolean wasConnected = connection.isConnected();
@@ -1122,4 +1137,28 @@ public class DefaultSchemaLoader extends
 
         return entry;
     }
+
+
+    /**
+     * Sets the quirks mode for all the internal parsers.
+     *
+     * If enabled the parser accepts non-numeric OIDs and some
+     * special characters in descriptions.
+     *
+     * @param enabled the new quirks mode
+     */
+    public void setQuirksMode( boolean enabled )
+    {
+        AT_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        C_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        DCR_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        DSR_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        LS_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        MR_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        MRU_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        N_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        NF_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        OC_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+        SC_DESCR_SCHEMA_PARSER.setQuirksMode( enabled );
+    }
 }

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1665870&r1=1665869&r2=1665870&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Wed Mar 11 13:25:55 2015
@@ -25,6 +25,7 @@ import static org.apache.directory.api.l
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.net.ConnectException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.nio.channels.UnresolvedAddressException;
@@ -549,6 +550,7 @@ public class LdapNetworkConnection exten
         SocketAddress address = new InetSocketAddress( config.getLdapHost(), config.getLdapPort()
);
 
         // And create the connection future
+        timeout = config.getTimeout();
         long maxRetry = System.currentTimeMillis() + timeout;
         ConnectFuture connectionFuture = null;
 
@@ -557,7 +559,6 @@ public class LdapNetworkConnection exten
             connectionFuture = connector.connect( address );
 
             boolean result = false;
-            timeout = config.getTimeout();
 
             // Wait until it's established
             try
@@ -581,6 +582,14 @@ public class LdapNetworkConnection exten
 
                     if ( !isConnected )
                     {
+                        if ( connectionFuture.getException() instanceof ConnectException
)
+                        {
+                            // No need to wait
+                            // We know that there was a permanent error such as "connection
refused".
+                            LOG.debug( "------>> Connection error: {}", connectionFuture.getException().getMessage()
);
+                            break;
+                        }
+
                         LOG.debug( "------>>   Cannot get the connection... Retrying"
);
 
                         // Wait 500 ms and retry
@@ -629,7 +638,7 @@ public class LdapNetworkConnection exten
 
             if ( e != null )
             {
-                StringBuilder message = new StringBuilder( "Cannot connect on the server:
" );
+                StringBuilder message = new StringBuilder( "Cannot connect to the server:
" );
 
                 // Special case for UnresolvedAddressException
                 // (most of the time no message is associated with this exception)

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/DitStructureRule.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/DitStructureRule.java?rev=1665870&r1=1665869&r2=1665870&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/DitStructureRule.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/DitStructureRule.java
Wed Mar 11 13:25:55 2015
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.api.i18n.I18n;
-import org.apache.directory.api.util.exception.NotImplementedException;
 
 
 /**
@@ -208,14 +207,15 @@ public class DitStructureRule extends Ab
 
 
     /**
-     * The DIT structure rule does not have an OID, so this implementations always throws
an exception.
+     * The DIT structure rule does not have an OID
      * 
      * {@inheritDoc}
      */
     @Override
     public String getOid()
     {
-        throw new NotImplementedException();
+        // We cannot throw exception here. E.g. SchemaObjectWrapper will try to use this
in hashcode.
+        return null;
     }
 
 



Mime
View raw message