Comment #2 on issue 2181 by brainslog:
org.jdiameter.client.impl.parser.AvpImpl.getRawData() NPE on empty Group
http://code.google.com/p/mobicents/issues/detail?id=2181
A more in-depth look showed that this problem should not happen, looking at
encodeAvpSet code:
public byte[] encodeAvpSet(AvpSet avps) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
DataOutputStream data = new DataOutputStream(out);
for (Avp a : avps) {
...
}
}
catch (Exception e) {
logger.debug("Error during encode avps", e);
}
return out.toByteArray();
}
we can see that when an exception (eg: NPE) happens it is logged in DEBUG
level only, not throwing it but instead returning the out.toByteArray();
which has been certainly initialized before.
Summarizing, yes the NPE may happen but it's not thrown, it's catched and
the (at least) empty array is returned.
If this is not the behavior you are experiencing, please can you provide a
simple code snippet/testcase which will cause the issue?