raydac/java-binary-block-parser

NullPointerException in JBBPTextWriter for String field mapped to byte array

raydac opened this issue · 0 comments

class Parsed {
        @Bin (type = BinType.BYTE_ARRAY) String str;
      }
      Parsed p = JBBPParser.prepare("byte [_] str;").parse(new byte[]{49,48,47}).mapTo(Parsed.class);
      System.out.println(new JBBPTextWriter().Bin(p).toString());

throws

Exception in thread "main" java.lang.NullPointerException
    at com.igormaznitsa.jbbp.utils.JBBPTextWriter$MappedObjectLogger.onArrayStart(JBBPTextWriter.java:133)
    at com.igormaznitsa.jbbp.io.AbstractMappedClassFieldObserver.processObjectField(AbstractMappedClassFieldObserver.java:326)
    at com.igormaznitsa.jbbp.io.AbstractMappedClassFieldObserver.processObject(AbstractMappedClassFieldObserver.java:161)
    at com.igormaznitsa.jbbp.utils.JBBPTextWriter$MappedObjectLogger.processObject(JBBPTextWriter.java:279)
    at com.igormaznitsa.jbbp.utils.JBBPTextWriter.Bin(JBBPTextWriter.java:1528)
    at com.igormaznitsa.testdi.Main.main(Main.java:15)