No functional change.

This did not make sense: the pattern was compiled and then the string compiled was retrieved.
Also removes 2 trailing blanks

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1542704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2013-11-17 10:53:42 +00:00
parent 39eb2da06e
commit 8e7922a0c1
@@ -23,7 +23,6 @@ import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import java.util.Random;
import java.util.regex.Pattern;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
@@ -71,7 +70,7 @@ public class FinAccountHelper {
/**
* A convenience method which adds transactions.get(0).get(fieldName) to initialValue, all done in BigDecimal to decimals and rounding
* @param initialValue the initial value
* @param initialValue the initial value
* @param transactions a List of GenericValue objects of transactions
* @param fieldName the field name to get the value from the transaction
* @param decimals number of decimals
@@ -136,13 +135,10 @@ public class FinAccountHelper {
* @throws GenericEntityException
*/
public static GenericValue getFinAccountFromCode(String finAccountCode, Delegator delegator) throws GenericEntityException {
// regex magic to turn all letters in code to uppercase and then remove all non-alphanumeric letters
if (finAccountCode == null) {
return null;
}
Pattern filterRegex = Pattern.compile("[^0-9A-Z]");
finAccountCode = finAccountCode.toUpperCase().replaceAll(filterRegex.pattern(), "");
finAccountCode = finAccountCode.toUpperCase().replaceAll("[^0-9A-Z]", "");
// now we need to get the encrypted version of the fin account code the user passed in to look up against FinAccount
// we do this by making a temporary generic entity with same finAccountCode and then doing a match
@@ -212,7 +208,7 @@ public class FinAccountHelper {
* @param finAccountId the financial account id
* @param asOfDateTime the validity date
* @param delegator the delegator
* @return returns the net balance (see above) minus the sum of all authorization amounts which are not expired
* @return returns the net balance (see above) minus the sum of all authorization amounts which are not expired
* @throws GenericEntityException
*/
public static BigDecimal getAvailableBalance(String finAccountId, Timestamp asOfDateTime, Delegator delegator) throws GenericEntityException {