felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r830555 - /felix/trunk/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
Date Wed, 28 Oct 2009 14:19:55 GMT
Author: dsavage
Date: Wed Oct 28 14:19:55 2009
New Revision: 830555

URL: http://svn.apache.org/viewvc?rev=830555&view=rev
Log:
Handle null string value

Modified:
    felix/trunk/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java

Modified: felix/trunk/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java?rev=830555&r1=830554&r2=830555&view=diff
==============================================================================
--- felix/trunk/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
(original)
+++ felix/trunk/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
Wed Oct 28 14:19:55 2009
@@ -93,17 +93,27 @@
     protected String readString() throws IOException
     {
         int l = in.readInt();
-        byte[] buf = new byte[l];
-        in.readFully( buf );
-        return new String(buf, ASCII);
+        if ( l == -1 ) {
+            return null;
+        }
+        else {
+            byte[] buf = new byte[l];
+            in.readFully( buf );
+            return new String(buf, ASCII);
+        }
     }
 
 
     protected void writeString( String str ) throws IOException
     {
-        byte[] buf = str.getBytes( ASCII );
-        out.writeInt( buf.length );
-        out.write( buf );
+        if ( str == null ) {
+            out.writeInt(-1);
+        }
+        else {
+            byte[] buf = str.getBytes( ASCII );
+            out.writeInt( buf.length );
+            out.write( buf );
+        }
     }
 
 



Mime
View raw message