geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r1084479 - /geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
Date Wed, 23 Mar 2011 05:30:31 GMT
Author: genspring
Date: Wed Mar 23 05:30:30 2011
New Revision: 1084479

URL: http://svn.apache.org/viewvc?rev=1084479&view=rev
Log:
Elimiate the potential  NPE and java.util.ConcurrentModificationException in EjbRefBuilder

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java?rev=1084479&r1=1084478&r2=1084479&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/EjbRefBuilder.java
Wed Mar 23 05:30:30 2011
@@ -231,7 +231,7 @@ public class EjbRefBuilder extends Abstr
                 spec_ejbRef.setEjbRefName(refName);
 
                 // ejb-ref-type
-                String refType = getStringValue(spec_ejbRef.getType());
+                String refType = getStringValue(spec_ejbRef.getEjbRefType()==null?null:spec_ejbRef.getEjbRefType().name());
                 if ("SESSION".equalsIgnoreCase(refType)) {
                     spec_ejbRef.setEjbRefType(org.apache.openejb.jee.EjbRefType.SESSION);
                 } else if ("ENTITY".equalsIgnoreCase(refType)) {
@@ -275,14 +275,17 @@ public class EjbRefBuilder extends Abstr
 
                 // openejb handling of injection-targets
                 if (spec_ejbRef.getInjectionTarget() != null) {
+                    
+                    List<InjectionTarget> injectionTargetsToAdd=new ArrayList<InjectionTarget>();
                     for (InjectionTarget injectionTargetType : spec_ejbRef.getInjectionTarget())
{
                         InjectionTarget newInjectionTarget = new InjectionTarget();
                         newInjectionTarget.setInjectionTargetClass(getStringValue(injectionTargetType
                                 .getInjectionTargetClass()));
                         newInjectionTarget.setInjectionTargetName(getStringValue(injectionTargetType
                                 .getInjectionTargetName()));
-                        spec_ejbRef.getInjectionTarget().add(newInjectionTarget);
+                        injectionTargetsToAdd.add(newInjectionTarget);
                     }
+                    spec_ejbRef.getInjectionTarget().addAll(injectionTargetsToAdd);
                 }
 
                 // TODO: geronimo's handling of injection-target
@@ -341,14 +344,18 @@ public class EjbRefBuilder extends Abstr
 
                 // openejb handling of injection-targets
                 if (localRefFromSpecDD.getInjectionTarget() != null) {
+                    List<InjectionTarget> injectionTargetsToAdd=new ArrayList<InjectionTarget>();
+                    
                     for (InjectionTarget injectionTargetType : localRefFromSpecDD.getInjectionTarget())
{
                         InjectionTarget injectionTarget = new InjectionTarget();
                         injectionTarget.setInjectionTargetClass(getStringValue(injectionTargetType
                                 .getInjectionTargetClass()));
                         injectionTarget.setInjectionTargetName(getStringValue(injectionTargetType
                                 .getInjectionTargetName()));
-                        localRefFromSpecDD.getInjectionTarget().add(injectionTarget);
+                        injectionTargetsToAdd.add(injectionTarget);
                     }
+                    
+                    localRefFromSpecDD.getInjectionTarget().addAll(injectionTargetsToAdd);
                 }
                 // TODO: geronimo's handling of injection-target
                 // addInjections(refName, localRefFromSpecDD.getInjectionTarget(), NamingBuilder.INJECTION_KEY.get(sharedContext));



Mime
View raw message