SVN commit

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

SVN commit

BJ Freeman
I could not find the commit for the
svn 422871
applications/content/email/emailservices.java
there is an error in my patch.
Line 788 there is a */ that needs to be removed
I have attached the patch to correct this.



Index: C:/projects/java/ofbiz_incubator_trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java
===================================================================
--- C:/projects/java/ofbiz_incubator_trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (revision 428956)
+++ C:/projects/java/ofbiz_incubator_trunk/applications/content/src/org/ofbiz/content/email/EmailServices.java (working copy)
@@ -686,9 +686,20 @@
         Map result = null;
         try {
             String contentTypeRaw = message.getContentType();
-            int idx = contentTypeRaw.indexOf(";");
-            contentType = contentTypeRaw.substring(0, idx);
-            Address [] addressesFrom = message.getFrom();
+          //  int idx = contentTypeRaw.indexOf(";");
+            //some emails do not use ;. if you use the above commented out code, it may be null;
+ //so the code below will throw an exception.
+            //  contentType = contentTypeRaw.substring(0, idx);
+            //following is the fix.
+     int idx = 0;
+ idx = contentTypeRaw.indexOf(";");
+ if (idx >= 1) {
+ contentType = contentTypeRaw.substring(0, idx);
+ } else {
+ contentType = contentTypeRaw;
+ }
+ //end of fix
+           Address [] addressesFrom = message.getFrom();
             Address [] addressesTo = message.getRecipients(MimeMessage.RecipientType.TO);
             Address [] addressesCC = message.getRecipients(MimeMessage.RecipientType.CC);
             Address [] addressesBCC = message.getRecipients(MimeMessage.RecipientType.BCC);            
@@ -763,16 +774,31 @@
             if (partyIdFrom != null) {
          commEventMap.put("partyIdFrom", partyIdFrom);        
          commEventMap.put("contactMechIdFrom", contactMechIdFrom);
-         commEventMap.put("contactMechIdTo", contactMechIdTo);
+//         commEventMap.put("contactMechIdTo", contactMechIdTo);
          commEventMap.put("statusId", "COM_ENTERED");
          } else {
                 // create a task to find party for email
          commEventMap.put("statusId", "COM_UNKNOWN_PARTY");
          commNote = "Sent from: " + UtilMisc.toListArray(addressesFrom);
          }
+          
      if (partyIdTo == null) {
                 commNote += "Sent to: " + UtilMisc.toListArray(addressesTo);
             }
+          
+           // modifed 06/20/06 to match the partyIDfrom
+
+            if (partyIdTo != null) {
+            commEventMap.put("partyIdto", partyIdTo);
+//            moved from PartyIDfrom, since if PartyIDfrom is null won't get set.
+            commEventMap.put("contactMechIdTo", contactMechIdTo);
+     commEventMap.put("statusId", "COM_ENTERED");
+            }else {
+//             create a task to find party for email
+//            this will override the status already set
+            commEventMap.put("statusId", "COM_UNKNOWN_PARTY");
+            commNote += "Sent to: " + UtilMisc.toListArray(addressesTo);
+            }
             if (!("".equals(commNote))) {
                 commEventMap.put("note", commNote);
             }
Reply | Threaded
Open this post in threaded view
|

Re: SVN commit

BJ Freeman
sorry forgot to remove some path info.


BJ Freeman sent the following on 8/4/2006 10:05 PM:
> I could not find the commit for the
> svn 422871
> applications/content/email/emailservices.java
> there is an error in my patch.
> Line 788 there is a */ that needs to be removed
> I have attached the patch to correct this.
>
>

Index: applications/content/src/org/ofbiz/content/email/EmailServices.java
===================================================================
--- applications/content/src/org/ofbiz/content/email/EmailServices.java (revision 428956)
+++ applications/content/src/org/ofbiz/content/email/EmailServices.java (working copy)
@@ -686,9 +686,20 @@
         Map result = null;
         try {
             String contentTypeRaw = message.getContentType();
-            int idx = contentTypeRaw.indexOf(";");
-            contentType = contentTypeRaw.substring(0, idx);
-            Address [] addressesFrom = message.getFrom();
+          //  int idx = contentTypeRaw.indexOf(";");
+            //some emails do not use ;. if you use the above commented out code, it may be null;
+ //so the code below will throw an exception.
+            //  contentType = contentTypeRaw.substring(0, idx);
+            //following is the fix.
+     int idx = 0;
+ idx = contentTypeRaw.indexOf(";");
+ if (idx >= 1) {
+ contentType = contentTypeRaw.substring(0, idx);
+ } else {
+ contentType = contentTypeRaw;
+ }
+ //end of fix
+           Address [] addressesFrom = message.getFrom();
             Address [] addressesTo = message.getRecipients(MimeMessage.RecipientType.TO);
             Address [] addressesCC = message.getRecipients(MimeMessage.RecipientType.CC);
             Address [] addressesBCC = message.getRecipients(MimeMessage.RecipientType.BCC);            
@@ -763,16 +774,31 @@
             if (partyIdFrom != null) {
          commEventMap.put("partyIdFrom", partyIdFrom);        
          commEventMap.put("contactMechIdFrom", contactMechIdFrom);
-         commEventMap.put("contactMechIdTo", contactMechIdTo);
+//         commEventMap.put("contactMechIdTo", contactMechIdTo);
          commEventMap.put("statusId", "COM_ENTERED");
          } else {
                 // create a task to find party for email
          commEventMap.put("statusId", "COM_UNKNOWN_PARTY");
          commNote = "Sent from: " + UtilMisc.toListArray(addressesFrom);
          }
+          
      if (partyIdTo == null) {
                 commNote += "Sent to: " + UtilMisc.toListArray(addressesTo);
             }
+          
+           // modifed 06/20/06 to match the partyIDfrom
+
+            if (partyIdTo != null) {
+            commEventMap.put("partyIdto", partyIdTo);
+//            moved from PartyIDfrom, since if PartyIDfrom is null won't get set.
+            commEventMap.put("contactMechIdTo", contactMechIdTo);
+     commEventMap.put("statusId", "COM_ENTERED");
+            }else {
+//             create a task to find party for email
+//            this will override the status already set
+            commEventMap.put("statusId", "COM_UNKNOWN_PARTY");
+            commNote += "Sent to: " + UtilMisc.toListArray(addressesTo);
+            }
             if (!("".equals(commNote))) {
                 commEventMap.put("note", commNote);
             }