Hi all, I am doing the protocol compilation to Java using the maven plugin and looking for an explanation on the default values please.
http://www.mail-archive.com/[email protected]/msg04063.html tells me that defaults aren't used at write time, but it means that I have to initiate all the Strings with "=new Utf8();" each time I create a message payload - is this correct? If I set them to null, then I always see: Exception in thread "main" java.lang.NullPointerException at org.apache.avro.io.BinaryEncoder.writeString(BinaryEncoder.java:133) at org.apache.avro.generic.GenericDatumWriter.writeString(GenericDatumWriter.java:176) I wonder the reasoning behind not initializing with null types (e.g. for String using new Utf8()) in the client generation. It means I either need to modify the generated sources, or wrap them in some kind of factory/builder right? Is that a common practice for avro or are others doing something different? Any recommendations for best use greatly appreciated. Currently in my working test I have to: Event e = new Event(); e.level=LEVEL_TYPES.DEBUG; // no auto ENUM default? e.objectType = OBJECT_TYPES.NAME_USAGE; e.sourceComponentType=SOURCE_COMPONENT_TYPES.CHECKLIST_HARVESTER; e.agentId=new Utf8("Hi list"); e.count=0; e.instanceId=new Utf8("127.0.0.1:7004"); e.message=new Utf8(); e.objectId=new Utf8(); //e.sensitive=false; // works because is a primitive e.sessionId=new Utf8("dysAw231"); e.sourceId=new Utf8(); e.userId=new Utf8(); logger.info(e, false); Thanks, Tim
