[email protected] wrote: > Author: lektran > Date: Tue Sep 8 00:40:57 2009 > New Revision: 812313 > > Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java?rev=812313&r1=812312&r2=812313&view=diff > ============================================================================== > --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java > (original) > +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java Tue > Sep 8 00:40:57 2009 > @@ -1298,19 +1298,32 @@ > } > > public static char calcUpcChecksum(String upc) { > - if (upc != null && upc.length() == 12) { > - upc = upc.substring(0, 11); > + return calcChecksum(upc, 12); > + } > + > + public static boolean isValidEan(String ean) { > + if (ean == null || ean.length() != 13) { > + throw new IllegalArgumentException("Invalid UPC length; must be > 12 characters");
s/UPC/EAN/ .
