directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1588867 - /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
Date Mon, 21 Apr 2014 10:52:38 GMT
Author: elecharny
Date: Mon Apr 21 10:52:38 2014
New Revision: 1588867

URL: http://svn.apache.org/r1588867
Log:
o Fixed the toString() method not to be dependent on the Map ordering.
o Removed a warning

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java?rev=1588867&r1=1588866&r2=1588867&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
Mon Apr 21 10:52:38 2014
@@ -387,10 +387,26 @@ public final class DefaultEntry implemen
                 .err( I18n.ERR_12087 ) );
         }
 
-        LdifAttributesReader reader = new LdifAttributesReader();
-        Entry entry = reader.parseEntry( schemaManager, sb.toString() );
-
-        return entry;
+        LdifAttributesReader reader = null;
+        
+        try
+        { 
+            reader = new LdifAttributesReader();
+            Entry entry = reader.parseEntry( schemaManager, sb.toString() );
+    
+            return entry;
+        }
+        finally
+        {
+            try
+            {
+                reader.close();
+            }
+            catch ( IOException e )
+            {
+                e.printStackTrace();
+            }
+        }
     }
 
 
@@ -2614,7 +2630,7 @@ public final class DefaultEntry implemen
         }
 
         sb.append( '\n' );
-
+        
         if ( attributes.size() != 0 )
         {
             boolean isFirst = true;
@@ -2625,10 +2641,6 @@ public final class DefaultEntry implemen
                 {
                     isFirst = false;
                 }
-                else
-                {
-                    sb.append( '\n' );
-                }
 
                 String id = attribute.getId();
 
@@ -2652,6 +2664,7 @@ public final class DefaultEntry implemen
                         && !id.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
                     {
                         sb.append( attribute.toString( tabs + "    " ) );
+                        sb.append( '\n' );
                         continue;
                     }
                 }



Mime
View raw message