Which causes NPE to be thrown because of object.getClass().
But the reason I've used this method is null check inside of inner method - mapAsCollection, which is invoked by mapAsList(...) after elemtTypeOf(source):
private <S, D> Collection<D> mapAsCollection(final Iterable<S> source, final Type<S> sourceType, final Type<D> destinationType,
final Collection<D> destination, final MappingContext context) {
if (source == null) {
return null;
}
ElementStrategyContext<S, D> elementContext = new ElementStrategyContext<S, D>(context, sourceType, destinationType);
for (final S item : source) {
if (item != null) {
destination.add(mapElement(item, elementContext));
}
}
return destination;
}
Hello everyone! This is my first issue report, so don't judge strictly.
I have a list that is null.
And the issue appears when I try to use
mapAsList(...)
method:There is another method invocation -
elementTypeOf(source)
:Which causes NPE to be thrown because of
object.getClass()
.But the reason I've used this method is null check inside of inner method - mapAsCollection, which is invoked by
mapAsList(...)
afterelemtTypeOf(source)
:So, I found this null check is useless.