directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1680115 - 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/comparators/ model/src/main/java/org/apache/directory/api/ldap/model/s...
Date Mon, 18 May 2015 22:28:05 GMT
Author: elecharny
Date: Mon May 18 22:28:05 2015
New Revision: 1680115

URL: http://svn.apache.org/r1680115
Log:
Some more Sonar warning removals

Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ComparableComparator.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/subtree/BaseSubtreeSpecification.java

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=1680115&r1=1680114&r2=1680115&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
Mon May 18 22:28:05 2015
@@ -4153,8 +4153,15 @@ public class LdapNetworkConnection exten
         File krb5Conf = File.createTempFile( "client-api-krb5", ".conf" );
         krb5Conf.deleteOnExit();
         FileWriter fw = new FileWriter( krb5Conf );
-        fw.write( sb.toString() );
-        fw.close();
+
+        try
+        {
+            fw.write( sb.toString() );
+        }
+        finally
+        {
+            fw.close();
+        }
 
         String krb5ConfPath = krb5Conf.getAbsolutePath();
 

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java?rev=1680115&r1=1680114&r2=1680115&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
Mon May 18 22:28:05 2015
@@ -344,6 +344,7 @@ public class LdifAnonymizer
         if ( ( args == null ) || ( args.length < 1 ) )
         {
             System.out.println( "No file to anonymize" );
+            return;
         }
 
         LdifAnonymizer anonymizer = new LdifAnonymizer();

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ComparableComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ComparableComparator.java?rev=1680115&r1=1680114&r2=1680115&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ComparableComparator.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/comparators/ComparableComparator.java
Mon May 18 22:28:05 2015
@@ -20,7 +20,6 @@
 package org.apache.directory.api.ldap.model.schema.comparators;
 
 
-import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.schema.LdapComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -69,21 +68,15 @@ public class ComparableComparator<T> ext
     {
         LOG.debug( "comparing objects '{}' with '{}'", o1, o2 );
 
-        if ( ( o1 == null ) && ( o2 == null ) )
-        {
-            return 0;
-        }
-
-        if ( o1 instanceof Comparable<?> )
+        if ( o1 == null )
         {
             if ( o2 == null )
             {
-                return -1;
+                return 0;
             }
             else
             {
-                // TODO: check type parameter
-                return o1.compareTo( ( T ) o2 );
+                return -11;
             }
         }
 
@@ -91,23 +84,7 @@ public class ComparableComparator<T> ext
         {
             return 1;
         }
-        else if ( o2 instanceof Comparable<?> )
-        {
-            if ( o1 == null )
-            {
-                return -1;
-            }
-            else
-            {
-                // TODO: check type parameter
-                return -o2.compareTo( ( T ) o1 );
-            }
-        }
-
-        // before https://issues.apache.org/jira/browse/DIRSERVER-928 it was
-        // return o1.hashCode() - o2.hashCode();
 
-        // now we will blow a stack trace if none of the objects are Comparable
-        throw new IllegalArgumentException( I18n.err( I18n.ERR_04217, o1, o2 ) );
+        return o1.compareTo( ( T ) o2 );
     }
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/subtree/BaseSubtreeSpecification.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/subtree/BaseSubtreeSpecification.java?rev=1680115&r1=1680114&r2=1680115&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/subtree/BaseSubtreeSpecification.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/subtree/BaseSubtreeSpecification.java
Mon May 18 22:28:05 2015
@@ -293,7 +293,8 @@ public class BaseSubtreeSpecification im
         }
 
         // The chopBefore exclusions
-        if ( !chopBefore.isEmpty() || !chopAfter.isEmpty() )
+        if ( ( ( chopBefore != null ) && !chopBefore.isEmpty() ) ||
+            ( ( chopAfter != null ) && !chopAfter.isEmpty() ) )
         {
             if ( isFirst )
             {



Mime
View raw message