Inline.
On 05/03/2015 06:25 AM, adri...@apache.org wrote:
Author: adrianc
Date: Sun May 3 11:25:08 2015
New Revision: 1677386
URL: http://svn.apache.org/r1677386
Log:
Trivial code cleanup in ObjectType.java - no functional change.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java?rev=1677386&r1=1677385&r2=1677386&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java Sun May
3 11:25:08 2015
@@ -50,7 +50,7 @@ public class ObjectType {
public static final String SQL_PACKAGE = "java.sql."; // We will test
both the raw value and this + raw value
private static final Map<String, String> classAlias = new HashMap<String, String>();
- private static final Map<String, Class> primitives = new HashMap<String,
Class>();
+ private static final Map<String, Class<?>> primitives = new HashMap<String,
Class<?>>();
static {
classAlias.put("Object", "java.lang.Object");
@@ -422,19 +422,19 @@ public class ObjectType {
public static Class<?> loadInfoClass(String typeName, ClassLoader loader)
{
//Class infoClass = null;
try {
- return ObjectType.loadClass(typeName, loader);
+ return loadClass(typeName, loader);
Hmm. Yes. I like this kind of code pattern. It'd be nice if the rest
of the code base was consistent like this.
} catch (SecurityException se1) {
throw new IllegalArgumentException("Problems with classloader:
security exception (" +
se1.getMessage() + ")");
} catch (ClassNotFoundException e1) {
try {
- return ObjectType.loadClass(LANG_PACKAGE + typeName, loader);
+ return loadClass(LANG_PACKAGE + typeName, loader);
} catch (SecurityException se2) {
throw new IllegalArgumentException("Problems with classloader:
security exception (" +
se2.getMessage() + ")");
} catch (ClassNotFoundException e2) {
try {
- return ObjectType.loadClass(SQL_PACKAGE + typeName,
loader);
+ return loadClass(SQL_PACKAGE + typeName, loader);
} catch (SecurityException se3) {
throw new IllegalArgumentException("Problems with classloader:
security exception (" +
se3.getMessage() + ")");
@@ -532,7 +532,7 @@ public class ObjectType {
if (converter != null) {
LocalizedConverter<Object, Object> localizedConverter = null;
try {
- localizedConverter = (LocalizedConverter) converter;
+ localizedConverter = (LocalizedConverter<Object, Object>)
converter;
Does this new change introduce a warning? Adding generics to a cast
will create a warning, unless @SuppressWarnings is used, or
UtilGenerics.cast().
If any work is done with generics, at least turn on the option in build.xml.
ps: I'd check this myself right now, but I'm about to reboot.
} catch (ClassCastException e) {}
if (localizedConverter != null) {
if (timeZone == null) {
@@ -580,7 +580,7 @@ public class ObjectType {
try {
if (!"PlainString".equals(type)) {
- Class<?> clz = ObjectType.loadClass(type, loader);
+ Class<?> clz = loadClass(type, loader);
type = clz.getName();
}
} catch (ClassNotFoundException e) {
@@ -611,7 +611,7 @@ public class ObjectType {
value2Locale = UtilMisc.parseLocale("en");
}
try {
- convertedValue2 = ObjectType.simpleTypeConvert(value2, type,
format, value2Locale);
+ convertedValue2 = simpleTypeConvert(value2, type, format,
value2Locale);
} catch (GeneralException e) {
Debug.logError(e, module);
messages.add("Could not convert value2 for comparison: " +
e.getMessage());
@@ -627,7 +627,7 @@ public class ObjectType {
Object convertedValue1 = null;
try {
- convertedValue1 = ObjectType.simpleTypeConvert(value1, type,
format, locale);
+ convertedValue1 = simpleTypeConvert(value1, type, format, locale);
} catch (GeneralException e) {
Debug.logError(e, module);
messages.add("Could not convert value1 for comparison: " +
e.getMessage());