Probably there no necessity to encode NULL fields. I've changed BEREncoder method encodeNull
It works fine for me.
public int encodeNull(Object object, OutputStream stream, ElementInfo elementInfo) throws Exception {
int resultSize = 0;
return resultSize;
}