Author: lektran
Date: Fri May  1 06:11:40 2009
New Revision: 770545

URL: http://svn.apache.org/viewvc?rev=770545&view=rev
Log:
Merged from trunk r770544
Fix an index out of bounds exception I stumbled across

Modified:
    
ofbiz/branches/release09.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java

Modified: 
ofbiz/branches/release09.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java?rev=770545&r1=770544&r2=770545&view=diff
==============================================================================
--- 
ofbiz/branches/release09.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
 (original)
+++ 
ofbiz/branches/release09.04/applications/product/src/org/ofbiz/shipment/thirdparty/usps/UspsServices.java
 Fri May  1 06:11:40 2009
@@ -37,6 +37,7 @@
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.xml.serialize.OutputFormat;
 import org.apache.xml.serialize.XMLSerializer;
 import org.ofbiz.base.util.Base64;
@@ -168,8 +169,8 @@
             packageElement.setAttribute("ID", String.valueOf(li.nextIndex() - 
1)); // use zero-based index (see examples)
 
             UtilXml.addChildElementValue(packageElement, "Service", 
serviceCode, requestDocument);
-            UtilXml.addChildElementValue(packageElement, "ZipOrigination", 
originationZip.substring(0,5), requestDocument);
-            UtilXml.addChildElementValue(packageElement, "ZipDestination", 
destinationZip.substring(0,5), requestDocument);
+            UtilXml.addChildElementValue(packageElement, "ZipOrigination", 
StringUtils.substring(originationZip, 0, 5), requestDocument);
+            UtilXml.addChildElementValue(packageElement, "ZipDestination", 
StringUtils.substring(destinationZip, 0, 5), requestDocument);
 
             BigDecimal weightPounds = packageWeight.setScale(0, 
BigDecimal.ROUND_FLOOR);
             // for Parcel post, the weight must be at least 1 lb


Reply via email to