directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1164819 - in /directory/shared/trunk/ldap/model/src: main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java
Date Sat, 03 Sep 2011 08:04:47 GMT
Author: elecharny
Date: Sat Sep  3 08:04:47 2011
New Revision: 1164819

URL: http://svn.apache.org/viewvc?rev=1164819&view=rev
Log:
o Used readFully() instead of read() for deserialization
o used the interface instead of a class name

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
    directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java?rev=1164819&r1=1164818&r2=1164819&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
Sat Sep  3 08:04:47 2011
@@ -440,10 +440,7 @@ public class BinaryValue extends Abstrac
         {
             wrappedValue = new byte[wrappedLength];
 
-            if ( wrappedLength > 0 &&  in.read( wrappedValue ) == -1 )
-            {
-                throw new IOException( I18n.err( I18n.ERR_04480_END_OF_STREAM ) );
-            }
+            in.readFully( wrappedValue );
         }
 
         // Read the isNormalized flag
@@ -457,10 +454,7 @@ public class BinaryValue extends Abstrac
             {
                 normalizedValue = new byte[normalizedLength];
 
-                if ( normalizedLength > 0 )
-                {
-                    in.read( normalizedValue );
-                }
+                in.readFully( normalizedValue );
             }
         }
         else

Modified: directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java?rev=1164819&r1=1164818&r2=1164819&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java
(original)
+++ directory/shared/trunk/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/AttributeSerializationTest.java
Sat Sep  3 08:04:47 2011
@@ -25,6 +25,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
 
 import org.junit.Test;
@@ -52,8 +53,8 @@ public class AttributeSerializationTest
         Attribute attribute1 = new DefaultAttribute( "CN" );
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream out = new ObjectOutputStream( baos );
-
+        ObjectOutput out = new ObjectOutputStream( baos );
+        
         attribute1.writeExternal( out );
         
         ObjectInputStream in = null;



Mime
View raw message