Author: jleroux
Date: Thu Sep 17 12:05:19 2015
New Revision: 1703586
URL:
http://svn.apache.org/r1703586Log:
A patch from Gaudin Pierre for "error in isValidEan util"
https://issues.apache.org/jira/browse/OFBIZ-6624There is an error in isValidEan util. It should be 12 and not 13 in the methods charAt and calcChecksum because they start at 0.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java
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=1703586&r1=1703585&r2=1703586&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 Thu Sep 17 12:05:19 2015
@@ -1335,8 +1335,8 @@ public class UtilValidate {
if (ean == null || ean.length() != 13) {
throw new IllegalArgumentException("Invalid EAN length; must be 13 characters");
}
- char csum = ean.charAt(13);
- char calcSum = calcChecksum(ean, 13);
+ char csum = ean.charAt(12);
+ char calcSum = calcChecksum(ean, 12);
return csum == calcSum;
}