Re: svn commit: r812313 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java

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

Re: svn commit: r812313 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java

Adam Heath-2
[hidden email] 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/

.
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r812313 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java

Scott Gray-2
Thanks!

Regards
Scott

On 8/09/2009, at 12:44 PM, Adam Heath wrote:

> [hidden email] 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/
>
> .


smime.p7s (3K) Download Attachment