Author: cbrisson
Date: Tue Oct 11 11:23:06 2016
New Revision: 1764226
URL: http://svn.apache.org/viewvc?rev=1764226&view=rev
Log:
fix some minor findbug related issues
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceFactory.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIndex.java?rev=1764226&r1=1764225&r2=1764226&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
Tue Oct 11 11:23:06 2016
@@ -54,7 +54,7 @@ import org.apache.velocity.util.introspe
public class ASTIndex extends SimpleNode
{
- private final String methodName = "get";
+ private static final String methodName = "get";
/**
* Indicates if we are running in strict reference mode.
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java?rev=1764226&r1=1764225&r2=1764226&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
Tue Oct 11 11:23:06 2016
@@ -86,7 +86,7 @@ public class ASTIntegerLiteral extends S
{
try
{
- value = new Long( str );
+ value = Long.valueOf( str );
}
catch ( NumberFormatException E2 )
{
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java?rev=1764226&r1=1764225&r2=1764226&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
Tue Oct 11 11:23:06 2016
@@ -67,7 +67,7 @@ public abstract class MathUtils
/**
* The <code>Class</code>-object is key, the maximum-value is the value
*/
- protected static final Map ints = new HashMap();
+ private static final Map ints = new HashMap();
static
{
ints.put (Byte.class, BigDecimal.valueOf (Byte.MAX_VALUE));
@@ -80,7 +80,7 @@ public abstract class MathUtils
/**
* The "size" of the number-types - ascending.
*/
- protected static final List typesBySize = new ArrayList();
+ private static final List typesBySize = new ArrayList();
static
{
typesBySize.add (Byte.class);
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceFactory.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceFactory.java?rev=1764226&r1=1764225&r2=1764226&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceFactory.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceFactory.java
Tue Oct 11 11:23:06 2016
@@ -20,6 +20,7 @@ package org.apache.velocity.runtime.reso
*/
import org.apache.velocity.Template;
+import org.apache.velocity.exception.VelocityException;
/**
* Class responsible for instantiating <code>Resource</code> objects,
@@ -49,6 +50,8 @@ public class ResourceFactory
case ResourceManager.RESOURCE_CONTENT:
resource = new ContentResource();
break;
+ default:
+ throw new VelocityException("invalide resource type");
}
return resource;
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java?rev=1764226&r1=1764225&r2=1764226&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
Tue Oct 11 11:23:06 2016
@@ -1174,7 +1174,7 @@ public class ExtProperties extends Hasht
* object that is not a Boolean.
*/
public boolean getBoolean(String key, boolean defaultValue) {
- return getBoolean(key, new Boolean(defaultValue)).booleanValue();
+ return getBoolean(key, Boolean.valueOf(defaultValue)).booleanValue();
}
/**
@@ -1196,7 +1196,7 @@ public class ExtProperties extends Hasht
} else if (value instanceof String) {
String s = testBoolean(((String) value).trim());
- Boolean b = new Boolean(s);
+ Boolean b = Boolean.valueOf(s);
put(key, b);
return b;
@@ -1268,7 +1268,7 @@ public class ExtProperties extends Hasht
* by the key has not a valid number format.
*/
public byte getByte(String key, byte defaultValue) {
- return getByte(key, new Byte(defaultValue)).byteValue();
+ return getByte(key, Byte.valueOf(defaultValue)).byteValue();
}
/**
@@ -1290,7 +1290,7 @@ public class ExtProperties extends Hasht
return (Byte) value;
} else if (value instanceof String) {
- Byte b = new Byte((String) value);
+ Byte b = Byte.valueOf((String) value);
put(key, b);
return b;
@@ -1338,7 +1338,7 @@ public class ExtProperties extends Hasht
* by the key has not a valid number format.
*/
public short getShort(String key, short defaultValue) {
- return getShort(key, new Short(defaultValue)).shortValue();
+ return getShort(key, Short.valueOf(defaultValue)).shortValue();
}
/**
@@ -1360,7 +1360,7 @@ public class ExtProperties extends Hasht
return (Short) value;
} else if (value instanceof String) {
- Short s = new Short((String) value);
+ Short s = Short.valueOf((String) value);
put(key, s);
return s;
@@ -1458,7 +1458,7 @@ public class ExtProperties extends Hasht
return (Integer) value;
} else if (value instanceof String) {
- Integer i = new Integer((String) value);
+ Integer i = Integer.valueOf((String) value);
put(key, i);
return i;
@@ -1506,7 +1506,7 @@ public class ExtProperties extends Hasht
* by the key has not a valid number format.
*/
public long getLong(String key, long defaultValue) {
- return getLong(key, new Long(defaultValue)).longValue();
+ return getLong(key, Long.valueOf(defaultValue)).longValue();
}
/**
@@ -1528,7 +1528,7 @@ public class ExtProperties extends Hasht
return (Long) value;
} else if (value instanceof String) {
- Long l = new Long((String) value);
+ Long l = Long.valueOf((String) value);
put(key, l);
return l;