Improved: [DEPRECATION] Replace BigDecimal.ROUND_* by RoundingMode.*
(OFBIZ-9571) No functional change. We read at http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html : <<Using the integer fields in this class (such as ROUND_HALF_UP) to represent rounding mode is largely obsolete; the enumeration values of the RoundingMode enum, (such as RoundingMode.HALF_UP) should be used instead.>> That's an easy global replacement. But it also needs to import the RoundingMode class. It was 26 files so I decided to rather clean all the imports in all files with the help of Eclipse. This is a 1st step. I will need to closely look at 2 special class: UtilNumber and Calculate. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1804953 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -28,8 +28,8 @@ import org.apache.ofbiz.base.container.Container;
|
||||
import org.apache.ofbiz.base.container.ContainerConfig;
|
||||
import org.apache.ofbiz.base.container.ContainerException;
|
||||
import org.apache.ofbiz.base.start.StartupCommand;
|
||||
import org.apache.ofbiz.base.util.UtilValidate;
|
||||
import org.apache.ofbiz.base.util.StringUtil;
|
||||
import org.apache.ofbiz.base.util.UtilValidate;
|
||||
|
||||
public class DelegatorContainer implements Container {
|
||||
private String name;
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import org.apache.ofbiz.base.concurrent.ExecutionPool;
|
||||
|
||||
import org.apache.ofbiz.base.lang.Factory;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
import org.apache.ofbiz.base.util.UtilObject;
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.util.List;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
import org.apache.ofbiz.base.util.UtilGenerics;
|
||||
import org.apache.ofbiz.entity.GenericEntity;
|
||||
import org.apache.ofbiz.entity.GenericValue;
|
||||
import org.apache.ofbiz.entity.GenericPK;
|
||||
import org.apache.ofbiz.entity.GenericValue;
|
||||
import org.apache.ofbiz.entity.condition.EntityCondition;
|
||||
|
||||
public class Cache {
|
||||
|
||||
+5
-5
@@ -23,11 +23,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.oro.text.perl.Perl5Util;
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
import org.apache.ofbiz.base.util.PatternFactory;
|
||||
import org.apache.ofbiz.base.util.UtilGenerics;
|
||||
@@ -37,6 +32,11 @@ import org.apache.ofbiz.entity.GenericModelException;
|
||||
import org.apache.ofbiz.entity.config.model.Datasource;
|
||||
import org.apache.ofbiz.entity.model.ModelEntity;
|
||||
import org.apache.ofbiz.entity.model.ModelField;
|
||||
import org.apache.oro.text.perl.Perl5Util;
|
||||
import org.apache.oro.text.regex.MalformedPatternException;
|
||||
import org.apache.oro.text.regex.Pattern;
|
||||
import org.apache.oro.text.regex.PatternMatcher;
|
||||
import org.apache.oro.text.regex.Perl5Matcher;
|
||||
|
||||
/**
|
||||
* Base class for comparisons.
|
||||
|
||||
+2
-2
@@ -19,8 +19,6 @@
|
||||
|
||||
package org.apache.ofbiz.entity.condition;
|
||||
|
||||
import groovy.util.BuilderSupport;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -33,6 +31,8 @@ import org.apache.ofbiz.entity.GenericModelException;
|
||||
import org.apache.ofbiz.entity.config.model.Datasource;
|
||||
import org.apache.ofbiz.entity.model.ModelEntity;
|
||||
|
||||
import groovy.util.BuilderSupport;
|
||||
|
||||
public class EntityConditionBuilder extends BuilderSupport {
|
||||
public static final String module = EntityConditionBuilder.class.getName();
|
||||
|
||||
|
||||
+1
-1
@@ -20,9 +20,9 @@ package org.apache.ofbiz.entity.config.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.ofbiz.base.lang.ThreadSafe;
|
||||
import org.apache.ofbiz.base.util.UtilXml;
|
||||
|
||||
+1
-1
@@ -21,9 +21,9 @@ package org.apache.ofbiz.entity.config.model;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.ofbiz.base.lang.ThreadSafe;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
+6
-7
@@ -19,18 +19,17 @@
|
||||
|
||||
package org.apache.ofbiz.entity.connection;
|
||||
|
||||
import org.apache.commons.dbcp2.managed.ManagedDataSource;
|
||||
import org.apache.commons.dbcp2.managed.TransactionRegistry;
|
||||
import org.apache.commons.pool2.ObjectPool;
|
||||
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.dbcp2.managed.ManagedDataSource;
|
||||
import org.apache.commons.dbcp2.managed.TransactionRegistry;
|
||||
import org.apache.commons.pool2.ObjectPool;
|
||||
import org.apache.commons.pool2.impl.GenericObjectPool;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
public class DebugManagedDataSource extends ManagedDataSource {
|
||||
|
||||
public static final String module = DebugManagedDataSource.class.getName();
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
import org.apache.ofbiz.entity.Delegator;
|
||||
import org.apache.ofbiz.entity.GenericEntityException;
|
||||
import org.apache.ofbiz.entity.GenericPK;
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
*******************************************************************************/
|
||||
package org.apache.ofbiz.entity.finder;
|
||||
|
||||
import java.util.Map;
|
||||
import java.io.Serializable;
|
||||
import org.w3c.dom.Element;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ofbiz.base.util.GeneralException;
|
||||
import org.apache.ofbiz.base.util.string.FlexibleStringExpander;
|
||||
import org.apache.ofbiz.entity.Delegator;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class Finder implements Serializable {
|
||||
|
||||
@@ -26,9 +26,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import org.apache.ofbiz.base.util.UtilValidate;
|
||||
import org.apache.ofbiz.base.util.UtilXml;
|
||||
import org.apache.ofbiz.entity.Delegator;
|
||||
@@ -37,6 +34,8 @@ import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias;
|
||||
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAliasAll;
|
||||
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelMemberEntity;
|
||||
import org.apache.ofbiz.entity.model.ModelViewEntity.ModelViewLink;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
/**
|
||||
* This class is used for declaring Dynamic View Entities, to be used and thrown away.
|
||||
* A special method exists on the Delegator to accept a DynamicViewEntity instead
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.apache.ofbiz.entity.model;
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ofbiz.base.util.StringUtil;
|
||||
import org.apache.ofbiz.base.util.UtilMisc;
|
||||
import org.apache.ofbiz.base.util.UtilValidate;
|
||||
|
||||
@@ -19,16 +19,16 @@
|
||||
package org.apache.ofbiz.entity.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -149,7 +150,7 @@ public class XmlSerializer {
|
||||
} else if (object instanceof Locale) {
|
||||
return makeElement("std-Locale", object, document);
|
||||
} else if (object instanceof BigDecimal) {
|
||||
String stringValue = ((BigDecimal) object).setScale(10, BigDecimal.ROUND_HALF_UP).toString();
|
||||
String stringValue = ((BigDecimal) object).setScale(10, RoundingMode.HALF_UP).toString();
|
||||
return makeElement("std-BigDecimal", stringValue, document);
|
||||
// - SQL Objects -
|
||||
} else if (object instanceof java.sql.Timestamp) {
|
||||
|
||||
+1
-1
@@ -20,8 +20,8 @@ package org.apache.ofbiz.entity.test;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ofbiz.base.util.UtilDateTime;
|
||||
import org.apache.ofbiz.base.util.UtilMisc;
|
||||
import org.apache.ofbiz.entity.GenericEntityException;
|
||||
|
||||
+2
-2
@@ -19,10 +19,10 @@
|
||||
|
||||
package org.apache.ofbiz.entity.testtools;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.ofbiz.entity.Delegator;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class EntityTestCase extends TestCase {
|
||||
|
||||
protected Delegator delegator = null;
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*******************************************************************************/
|
||||
package org.apache.ofbiz.entity.transaction;
|
||||
|
||||
import javax.transaction.xa.Xid;
|
||||
import javax.transaction.xa.XAException;
|
||||
import javax.transaction.xa.Xid;
|
||||
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
|
||||
+3
-3
@@ -18,16 +18,16 @@
|
||||
*******************************************************************************/
|
||||
package org.apache.ofbiz.entity.transaction;
|
||||
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
import javax.transaction.RollbackException;
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.Transaction;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.xa.XAException;
|
||||
import javax.transaction.xa.XAResource;
|
||||
import javax.transaction.xa.Xid;
|
||||
import javax.transaction.xa.XAException;
|
||||
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
|
||||
/**
|
||||
* GenericXaResource - Abstract XA Resource implementation supporting a single transaction
|
||||
|
||||
+3
-1
@@ -37,7 +37,9 @@ import org.apache.ofbiz.base.util.GeneralException;
|
||||
import org.apache.ofbiz.base.util.JNDIContextFactory;
|
||||
import org.apache.ofbiz.base.util.UtilValidate;
|
||||
import org.apache.ofbiz.entity.GenericEntityException;
|
||||
import org.apache.ofbiz.entity.config.model.*;
|
||||
import org.apache.ofbiz.entity.config.model.Datasource;
|
||||
import org.apache.ofbiz.entity.config.model.EntityConfig;
|
||||
import org.apache.ofbiz.entity.config.model.JndiJdbc;
|
||||
import org.apache.ofbiz.entity.datasource.GenericHelperInfo;
|
||||
import org.apache.ofbiz.entity.jdbc.ConnectionFactoryLoader;
|
||||
|
||||
|
||||
+1
@@ -20,6 +20,7 @@ package org.apache.ofbiz.entity.transaction;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
|
||||
@@ -28,11 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.shiro.crypto.AesCipherService;
|
||||
import org.apache.shiro.crypto.OperationMode;
|
||||
import org.apache.shiro.crypto.hash.DefaultHashService;
|
||||
import org.apache.shiro.crypto.hash.HashRequest;
|
||||
import org.apache.shiro.crypto.hash.HashService;
|
||||
import org.apache.ofbiz.base.crypto.DesCrypt;
|
||||
import org.apache.ofbiz.base.crypto.HashCrypt;
|
||||
import org.apache.ofbiz.base.util.Debug;
|
||||
@@ -46,6 +41,11 @@ import org.apache.ofbiz.entity.GenericEntityException;
|
||||
import org.apache.ofbiz.entity.GenericValue;
|
||||
import org.apache.ofbiz.entity.model.ModelField.EncryptMethod;
|
||||
import org.apache.ofbiz.entity.transaction.TransactionUtil;
|
||||
import org.apache.shiro.crypto.AesCipherService;
|
||||
import org.apache.shiro.crypto.OperationMode;
|
||||
import org.apache.shiro.crypto.hash.DefaultHashService;
|
||||
import org.apache.shiro.crypto.hash.HashRequest;
|
||||
import org.apache.shiro.crypto.hash.HashService;
|
||||
|
||||
public final class EntityCrypto {
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -40,7 +39,6 @@ import org.apache.ofbiz.entity.GenericPK;
|
||||
import org.apache.ofbiz.entity.GenericValue;
|
||||
import org.apache.ofbiz.entity.condition.EntityCondition;
|
||||
import org.apache.ofbiz.entity.model.DynamicViewEntity;
|
||||
import org.apache.ofbiz.entity.model.ModelEntity;
|
||||
|
||||
/**
|
||||
* Used to setup various options for and subsequently execute entity queries.
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
Reference in New Issue
Block a user