Author: nbubna
Date: Fri Apr 27 20:26:11 2007
New Revision: 533280

URL: http://svn.apache.org/viewvc?view=rev&rev=533280
Log:
fix two NPE's

Modified:
    
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/Toolbox.java

Modified: 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/Toolbox.java
URL: 
http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/Toolbox.java?view=diff&rev=533280&r1=533279&r2=533280
==============================================================================
--- 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/Toolbox.java
 (original)
+++ 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/Toolbox.java
 Fri Apr 27 20:26:11 2007
@@ -50,6 +50,7 @@
             throw new IllegalArgumentException("Toolbox must have one or more 
tools");
         }
 
+        this.infoMap = toolInfo;
         this.properties = properties;
     }
 
@@ -97,7 +98,11 @@
         else
         {
             Object tool = cache.get(key);
-            if (tool == null || path == null)
+            if (tool == null)
+            {
+                return null;
+            }
+            else if (path == null)
             {
                 return tool;
             }
@@ -131,6 +136,10 @@
 
     protected boolean hasPermission(ToolInfo info, String path)
     {
+        if (info == null || path == null)
+        {
+            return true;
+        }
         return info.hasPermission(path);
     }
 


Reply via email to