Author: nbubna
Date: Wed Aug  8 11:50:06 2007
New Revision: 563977

URL: http://svn.apache.org/viewvc?view=rev&rev=563977
Log:
fix NPEs found by FindBugs

Modified:
    
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/struts/StrutsUtils.java
    
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
    
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java

Modified: 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/struts/StrutsUtils.java
URL: 
http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/struts/StrutsUtils.java?view=diff&rev=563977&r1=563976&r2=563977
==============================================================================
--- 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/struts/StrutsUtils.java
 (original)
+++ 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/struts/StrutsUtils.java
 Wed Aug  8 11:50:06 2007
@@ -413,18 +413,18 @@
         if(actionConfig != null)
         {
             fc = actionConfig.findForwardConfig(forward);
+        }
 
-            // No ActionConfig forward?
-            // Find the ForwardConfig in the global-forwards.
-            if(fc == null)
-            {
-                fc = moduleConfig.findForwardConfig(forward);
+        // No ActionConfig forward?
+        // Find the ForwardConfig in the global-forwards.
+        if(fc == null)
+        {
+            fc = moduleConfig.findForwardConfig(forward);
 
-                // ok, give up
-                if (fc == null)
-                {
-                    return null;
-                }
+            // ok, give up
+            if (fc == null)
+            {
+                return null;
             }
         }
 

Modified: 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
URL: 
http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java?view=diff&rev=563977&r1=563976&r2=563977
==============================================================================
--- 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
 (original)
+++ 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/ContextTool.java
 Wed Aug  8 11:50:06 2007
@@ -89,12 +89,12 @@
         {
             ValueParser parser = new ValueParser(params);
             safeMode = parser.getBoolean(SAFE_MODE_KEY, true);
-        }
 
-        this.context = (ViewContext)params.get(ViewToolContext.CONTEXT_KEY);
-        this.request = (HttpServletRequest)params.get(ViewContext.REQUEST);
-        this.session = request.getSession(false);
-        this.application = 
(ServletContext)params.get(ViewContext.SERVLET_CONTEXT_KEY);
+            this.context = 
(ViewContext)params.get(ViewToolContext.CONTEXT_KEY);
+            this.request = (HttpServletRequest)params.get(ViewContext.REQUEST);
+            this.session = request.getSession(false);
+            this.application = 
(ServletContext)params.get(ViewContext.SERVLET_CONTEXT_KEY);
+        }
     }
 
 

Modified: 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
URL: 
http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java?view=diff&rev=563977&r1=563976&r2=563977
==============================================================================
--- 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
 (original)
+++ 
velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/view/VelocityView.java
 Wed Aug  8 11:50:06 2007
@@ -688,6 +688,10 @@
             {
                 throw new UnsupportedOperationException(msg);
             }
+            else
+            {
+                return null;
+            }
         }
 
         // now, try to read the file


Reply via email to