You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2015/04/11 22:36:42 UTC
svn commit: r1672933 -
/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
Author: oheger
Date: Sat Apr 11 20:36:41 2015
New Revision: 1672933
URL: http://svn.apache.org/r1672933
Log:
Fixed some warnings.
Findbugs warnings about unnecessary instance creations; now auto-boxing is
used instead; var-args methods could be called in a more natural way; removed
two unused fields.
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java?rev=1672933&r1=1672932&r2=1672933&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/convert/PropertyConverter.java Sat Apr 11 20:36:41 2015
@@ -45,11 +45,6 @@ import org.apache.commons.lang3.StringUt
*/
final class PropertyConverter
{
- /** Constant for the list delimiter as char.*/
- static final char LIST_ESC_CHAR = '\\';
-
- /** Constant for the list delimiter escaping character as string.*/
- static final String LIST_ESCAPE = String.valueOf(LIST_ESC_CHAR);
/** Constant for the prefix of hex numbers.*/
private static final String HEX_PREFIX = "0x";
@@ -66,7 +61,7 @@ final class PropertyConverter
/** Constant for the argument classes of the Number constructor that takes a String. */
private static final Class<?>[] CONSTR_ARGS = {String.class};
- /** The fully qualified name of {@link javax.mail.internet.InternetAddress} */
+ /** The fully qualified name of {@code javax.mail.internet.InternetAddress} */
private static final String INTERNET_ADDRESS_CLASSNAME = "javax.mail.internet.InternetAddress";
/**
@@ -260,7 +255,7 @@ final class PropertyConverter
}
else
{
- return new Byte(n.byteValue());
+ return n.byteValue();
}
}
@@ -280,7 +275,7 @@ final class PropertyConverter
}
else
{
- return new Short(n.shortValue());
+ return n.shortValue();
}
}
@@ -300,7 +295,7 @@ final class PropertyConverter
}
else
{
- return new Integer(n.intValue());
+ return n.intValue();
}
}
@@ -320,7 +315,7 @@ final class PropertyConverter
}
else
{
- return new Long(n.longValue());
+ return n.longValue();
}
}
@@ -456,7 +451,7 @@ final class PropertyConverter
try
{
Constructor<?> constr = targetClass.getConstructor(CONSTR_ARGS);
- return (Number) constr.newInstance(new Object[]{str});
+ return (Number) constr.newInstance(str);
}
catch (InvocationTargetException itex)
{
@@ -664,8 +659,8 @@ final class PropertyConverter
try
{
Constructor<?> ctor = Class.forName(INTERNET_ADDRESS_CLASSNAME)
- .getConstructor(new Class[] {String.class});
- return ctor.newInstance(new Object[] {value});
+ .getConstructor(String.class);
+ return ctor.newInstance(value);
}
catch (Exception e)
{