svn commit: r898266 - in /ofbiz/trunk/applications/marketing: servicedef/services.xml src/org/ofbiz/sfa/vcard/VCard.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r898266 - in /ofbiz/trunk/applications/marketing: servicedef/services.xml src/org/ofbiz/sfa/vcard/VCard.java

jleroux@apache.org
Author: jleroux
Date: Tue Jan 12 09:16:06 2010
New Revision: 898266

URL: http://svn.apache.org/viewvc?rev=898266&view=rev
Log:
Fix VCard Import
I always think that enhanced loops are treating null as empty collection (and I agree with http://www.efsavage.com/blog/posts/java-goofs-enhanced-for-loop/)
Anyway I also put serviceContext as mandatory which was an error

Modified:
    ofbiz/trunk/applications/marketing/servicedef/services.xml
    ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java

Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=898266&r1=898265&r2=898266&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/marketing/servicedef/services.xml Tue Jan 12 09:16:06 2010
@@ -480,7 +480,7 @@
     <service name="importVCard" engine="java" location="org.ofbiz.sfa.vcard.VCard" invoke="importVCard">
         <attribute name="infile" type="java.nio.ByteBuffer" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="OUT" optional="false"/>
-        <attribute name="serviceContext" type="Map" mode="IN" optional="false"/>
+        <attribute name="serviceContext" type="Map" mode="IN" optional="true"/>
         <attribute name="serviceName" type="String" mode="IN" optional="false"/>
     </service>
     <service name="exportVCard" engine="java" location="org.ofbiz.sfa.vcard.VCard" invoke="exportVCard">

Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=898266&r1=898265&r2=898266&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original)
+++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Tue Jan 12 09:16:06 2010
@@ -168,8 +168,10 @@
                 serviceCtx.put("userLogin", userLogin);
                 String serviceName = (String) context.get("serviceName");
                 Map<String, Object> serviceContext = UtilGenerics.cast(context.get("serviceContext"));
-                for(Map.Entry<String, Object> entry : serviceContext.entrySet()) {
-                    serviceCtx.put(entry.getKey(), entry.getValue());
+                if(UtilValidate.isNotEmpty(serviceContext)) {
+                    for(Map.Entry<String, Object> entry : serviceContext.entrySet()) {
+                        serviceCtx.put(entry.getKey(), entry.getValue());
+                    }
                 }
                 Map<String, Object> resp = dispatcher.runSync(serviceName, serviceCtx);
                 result.put("partyId", resp.get("partyId"));