2 Replies Latest reply on Apr 27, 2006 1:32 PM by Clebert Suconic

    Bug in StingUtil.java

    Alexey Grubauer Newbie

      Hi If i want to serialize a string that is greater than ca. 20000 characters i get a nullpointerexception:
      java.lang.NullPointerException
      at org.jboss.serial.util.StringUtil.readString(StringUtil.java:247)
      at org.jboss.serial.objectmetamodel.DataContainer.readMyself(DataContainer.java:1257)
      at org.jboss.serial.objectmetamodel.DataContainer.loadData(DataContainer.java:1027)
      at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:83)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333)
      at test.Tester2.main(Tester2.java:219)


      the problem is that code from StringUtil.readString:

      if (charCount == buffer.charBuffer.length) {

      /* 237*/ if (buffer == null)

      /* 239*/ if (isLong)

      /* 241*/ strbuffer = new StringBuffer(2147483647);


      /* 244*/ else/* 244*/ strbuffer = new StringBuffer((int)size);


      /* 247*/ strbuffer.append(buffer.charBuffer);
      /* 248*/ charCount = 0;
      }


      in line 237 you should write strbuffer and not buffer.

      please correct