[ http://jira.andromda.org/browse/OCL-11?page=comments#action_11430 ]
Sami Ekblad commented on OCL-11:
--------------------------------
There is still possibility of NPE everywhere the objectToList function is used.
Here is a patch:
Index: OCLCollections.java
===================================================================
RCS file:
/cvsroot/andromda/translation-libraries/ocl/andromda-validation/src/java/org/andromda/translation/ocl/validation/OCLCollections.java,v
retrieving revision 1.6
diff -u -r1.6 OCLCollections.java
--- OCLCollections.java 15 Apr 2005 23:01:25 -0000 1.6
+++ OCLCollections.java 26 Apr 2005 08:12:00 -0000
@@ -609,6 +609,8 @@
object = new ArrayList(collection);
}
list = (List)object;
+ } else {
+ list = new ArrayList();
}
}
else
> NullPointerException at at
> org.andromda.translation.ocl.validation.OCLCollections.first(OCLCollections.java:382)
> ----------------------------------------------------------------------------------------------------------------
>
> Key: OCL-11
> URL: http://jira.andromda.org/browse/OCL-11
> Project: OCL Translation
> Type: Bug
> Components: AndroMDA Validation
> Versions: 3.0RC2
> Environment: Windows XP Pro, Java(TM) 2 (build 1.5.0_02-b09), Maven 1.0.2,
> AndroMDA 3.0-RC2-20050407061204
> Reporter: Sami Ekblad
> Assignee: Chad Brandon
> Fix For: 3.0RC2
>
> I browsed the code for possible reason in function objectToList(..), and ran
> into this:
> 653 : if (!(object instanceof List))
> 654 : {
> 655 : object = new ArrayList(collection);
> 656 : }
> 657 : list = (List)collection;
> The variable object is assigned a new arraylist, but it is never used.
> However, this does not explain the NPE.
> ------- AndroMDA Exception Recording -------
> Version ........: 3.0-RC2-20050407061204
> Error ..........: Error performing ModelProcessor.process with model(s) -->
> 'file:C:/WORK/WORKSPACES/old-workspace/TYVI/tyvi/mda/src/uml/TYVIModel.xmi'
> Build ..........: 2005-04-07 06:12:04
> Build System ...: Linux-2.6.10-1.770_FC3
> Build JDK ......: Sun Microsystems Inc.-1.4.2_07-b05
> Build Builder ..: amartinwest
> Run System .....: Windows XP5.1
> Run JDK ........: Sun Microsystems Inc.1.4.2_07-b05
> Main Exception .: Failed to construct a meta facade of type 'class
> org.andromda.cartridges.hibernate.metafacades.HibernateEntityLogicImpl' with
> mappingObject of type --> 'class org.omg.uml.foundation.core.UmlClass$Impl'
> Root Exception .: java.lang.NullPointerException
> java.lang.NullPointerException
> at
> org.andromda.translation.ocl.validation.OCLCollections.first(OCLCollections.java:382)
> at
> org.andromda.cartridges.hibernate.metafacades.HibernateEntityLogic.validateInvariants(HibernateEntityLogic.java:1810)
> at
> org.andromda.core.metafacade.MetafacadeBase.validate(MetafacadeBase.java:95)
> at
> org.andromda.core.metafacade.MetafacadeFactory.createMetafacade(MetafacadeFactory.java:223)
> at
> org.andromda.core.metafacade.MetafacadeFactory.createMetafacade(MetafacadeFactory.java:132)
> at
> org.andromda.core.metafacade.MetafacadeBase.shieldedElement(MetafacadeBase.java:141)
> at
> org.andromda.metafacades.uml14.AttributeFacadeLogic.getOwner(AttributeFacadeLogic.java:501)
> at
> org.andromda.metafacades.uml14.AttributeFacadeLogicImpl.handleGetName(AttributeFacadeLogicImpl.java:266)
> at
> org.andromda.metafacades.uml14.EntityAttributeLogicImpl.handleGetName(EntityAttributeLogicImpl.java:38)
> at
> org.andromda.metafacades.uml14.ModelElementFacadeLogic.getName(ModelElementFacadeLogic.java:126)
> at sun.reflect.GeneratedMethodAccessor113.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> [...Output truncated...]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.andromda.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel