eclipse-modisco / org.eclipse.modisco

Eclipse Public License 2.0
0 stars 0 forks source link

[Java] NPE in AnnotationImpl.toString #758

Open eclipse-modisco-bot opened 3 hours ago

eclipse-modisco-bot commented 3 hours ago

| --- | --- | | Bugzilla Link | 351183 | | Status | NEW | | Importance | P5 normal | | Reported | Jul 05, 2011 09:08 EDT | | Modified | Jan 06, 2017 07:32 EDT | | Version | 0.9.0 | | Reporter | Nicolas Bros |

Description

Created attachment 199117\ stacktrace

When trying to execute the Java to KDM ATL transformation, I get a NPE in the Java model. See attached stacktrace.

:notepad_spiral: stacktrace.txt

eclipse-modisco-bot commented 3 hours ago

By Gregoire Dupe on Sep 28, 2011 12:12

Hello,

I'm really sorry, but to guaranty maintainability of MoDisco (and EMF Facet) we\ have to focus this year on the move to EMF Facet. That's why I cannot plan this\ bug for Juno (of course if someone provides the fix we will commit it).

Regards,\ Gregoire Dupe

eclipse-modisco-bot commented 3 hours ago

By Sven Peldszus on Jan 06, 2017 07:32

Hello,

I also got this NullpointerException and had a closer look into the source code.

The problem is a fieldreference in the 'toString()' method of the class 'org.eclipse.gmt.modisco.java.emf.impl.AnnotationImpl' due to the lazy initialization of lists in EMF code a NPE is thrown in the following line if the Annotation has no value:

old line 253: 'for (AnnotationMemberValuePair member : this.values) {'

To fix this bug the 'this.values' fiels access has to be replaced with the according getter 'getValues()' in which an empty list is created if the annotation has no values:

new line 253: 'for (AnnotationMemberValuePair member : getValues()) {'

As I've the impression after reading the contribution guide lines that pull request are unwanted for bug fixes I am just reporting my solution here. It would be nice if this fix will be included in the next release.

Best regards,

Sven Peldszus