atos1990 / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

NPE in IntrospectorPropertyResolver #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is a possibility of NPE in IntrospectorPropertyResolver in method "public 
NestedProperty getNestedProperty(java.lang.reflect.Type type, String p)" in 
current trunk (but it affects older versions too). In RuntimeException that may 
be thrown in that method a "property.getType()" is used, but property variable 
itself gets initialized only after first iteration. So if the first item in the 
mapping path is not correct, ugly NPE is thrown instead of RuntimeException 
with correct error message.

Original issue reported on code.google.com by frantise...@calavera.info on 8 Aug 2012 at 3:56

GoogleCodeExporter commented 9 years ago
Maybe I should point out that because of this NPE instead of RuntimeException 
it's very hard to find mistake in created mapping in such case. That is a major 
usability bug, not just some perfectionism.

Original comment by frantise...@calavera.info on 12 Aug 2012 at 9:33

GoogleCodeExporter commented 9 years ago
Could you check now in the 1.2.0 branch and see if this behavior has been fixed 
? 
If I understand you correctly, you were seeing an NPE when you attempt to map a 
nested property for which the first segment is invalid (instead of a 
RuntimeException telling you what was wrong with the property expression), 
correct?

Original comment by matt.deb...@gmail.com on 14 Aug 2012 at 8:47

GoogleCodeExporter commented 9 years ago

Original comment by matt.deb...@gmail.com on 18 Aug 2012 at 12:52

GoogleCodeExporter commented 9 years ago

Original comment by matt.deb...@gmail.com on 28 Aug 2012 at 5:36

GoogleCodeExporter commented 9 years ago
We can't switch versions right now, but from what I can see in source code it 
should be ok now, thanks.

Original comment by frantise...@calavera.info on 2 Sep 2012 at 3:14