Handle null string value
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@830555 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java b/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
index 298fc0f..c3fe114 100644
--- a/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
+++ b/sigil/common/runtime/src/org/apache/felix/sigil/common/runtime/io/Action.java
@@ -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 );
+ }
}