geirm 01/04/18 13:29:26
Modified: src/java/org/apache/velocity/runtime/configuration
Configuration.java
src/java/org/apache/velocity/runtime/resource
ResourceManager.java
Log:
Two more suggestions from Kent - these aren't very well tested, but look
fine and will test some more. Wanted to get these in if Kent wants to test
against the source tree again :)
Revision Changes Path
1.24 +13 -4
jakarta-velocity/src/java/org/apache/velocity/runtime/configuration/Configuration.java
Index: Configuration.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/configuration/Configuration.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- Configuration.java 2001/04/09 22:38:39 1.23
+++ Configuration.java 2001/04/18 20:29:23 1.24
@@ -163,7 +163,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Leon Messerschmidt</a>
- * @version $Id: Configuration.java,v 1.23 2001/04/09 22:38:39 dlr Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]>Kent Johnson</a>
+ * @version $Id: Configuration.java,v 1.24 2001/04/18 20:29:23 geirm Exp $
*/
public class Configuration extends Hashtable
{
@@ -1484,9 +1485,17 @@
*/
public int getInteger(String key,
int defaultValue)
- {
- return getInteger(key, new Integer(defaultValue)).intValue();
- }
+ {
+ Integer i = getInteger(key, null);
+
+ if (i == null)
+ {
+ return defaultValue;
+ }
+
+ return i.intValue();
+ }
+
/**
* Get a int associated with the given configuration key.
1.23 +5 -7
jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ResourceManager.java
Index: ResourceManager.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ResourceManager.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ResourceManager.java 2001/04/07 08:50:36 1.22
+++ ResourceManager.java 2001/04/18 20:29:24 1.23
@@ -78,7 +78,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Paulo Gaspar</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ResourceManager.java,v 1.22 2001/04/07 08:50:36 dlr Exp $
+ * @version $Id: ResourceManager.java,v 1.23 2001/04/18 20:29:24 geirm Exp $
*/
public class ResourceManager
{
@@ -217,9 +217,7 @@
*/
public static Resource getResource(String resourceName, int resourceType)
throws ResourceNotFoundException, ParseErrorException, Exception
- {
- Resource resource = null;
-
+ {
/*
* Check to see if the resource was placed in the cache.
* If it was placed in the cache then we will use
@@ -227,10 +225,10 @@
* will load it.
*/
- if (globalCache.containsKey(resourceName))
- {
- resource = (Resource) globalCache.get(resourceName);
+ Resource resource = (Resource) globalCache.get(resourceName);
+ if( resource != null)
+ {
/*
* The resource knows whether it needs to be checked
* or not, and the resource's loader can check to