I have the following code:
Map<BigInteger, AttributeValue> values = getParameters(elementHandler);
AttributeValue value = values.get(attrID);
AttributeValue auxValue = null;
if (auxAttrID != null)
auxValue = values.get(auxAttrID);
try {
if (value == null) {
// some code here
}
if (value != null) {
assert (value != null) : "value is null";
if (value.getValue() == null ) {
// some code here
} else if (auxAttrID != null && auxValue != null) {
// some code here
}
}
} catch (Exception e) {
log.error("Error at getting attribute value (attr#" + attrID + ", auxAttrId#" + auxAttrID + ")", e);
}
return value;
}
It produces NullPointerException
at line
if (value.getValue() == null )
right after assertion.
AttributeValue
is a simple POJO class. Why this happens and how can I fix it?