tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r655642 - /incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Date Mon, 12 May 2008 21:10:35 GMT
Author: jsdelfino
Date: Mon May 12 14:10:35 2008
New Revision: 655642

URL: http://svn.apache.org/viewvc?rev=655642&view=rev
Log:
Check for null to fix an NPE with composite services that do not promote a component service.

Modified:
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=655642&r1=655641&r2=655642&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Mon May 12 14:10:35 2008
@@ -199,27 +199,29 @@
                             compositeService.setName(getString(reader, NAME));
 
                             String promoted = getString(reader, PROMOTE);
-                            String promotedComponentName;
-                            String promotedServiceName;
-                            int s = promoted.indexOf('/');
-                            if (s == -1) {
-                                promotedComponentName = promoted;
-                                promotedServiceName = null;
-                            } else {
-                                promotedComponentName = promoted.substring(0, s);
-                                promotedServiceName = promoted.substring(s + 1);
+                            if (promoted != null) {
+                                String promotedComponentName;
+                                String promotedServiceName;
+                                int s = promoted.indexOf('/');
+                                if (s == -1) {
+                                    promotedComponentName = promoted;
+                                    promotedServiceName = null;
+                                } else {
+                                    promotedComponentName = promoted.substring(0, s);
+                                    promotedServiceName = promoted.substring(s + 1);
+                                }
+    
+                                Component promotedComponent = assemblyFactory.createComponent();
+                                promotedComponent.setUnresolved(true);
+                                promotedComponent.setName(promotedComponentName);
+                                compositeService.setPromotedComponent(promotedComponent);
+    
+                                ComponentService promotedService = assemblyFactory.createComponentService();
+                                promotedService.setUnresolved(true);
+                                promotedService.setName(promotedServiceName);
+                                compositeService.setPromotedService(promotedService);
                             }
 
-                            Component promotedComponent = assemblyFactory.createComponent();
-                            promotedComponent.setUnresolved(true);
-                            promotedComponent.setName(promotedComponentName);
-                            compositeService.setPromotedComponent(promotedComponent);
-
-                            ComponentService promotedService = assemblyFactory.createComponentService();
-                            promotedService.setUnresolved(true);
-                            promotedService.setName(promotedServiceName);
-                            compositeService.setPromotedService(promotedService);
-
                             composite.getServices().add(compositeService);
                             policyProcessor.readPolicies(contract, reader);
                         }



Mime
View raw message