You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2010/12/10 08:20:49 UTC

svn commit: r1044230 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java

Author: doogie
Date: Fri Dec 10 07:20:49 2010
New Revision: 1044230

URL: http://svn.apache.org/viewvc?rev=1044230&view=rev
Log:
Move variable declarations until they are actually used, instead of
assigning null, then force-reassigning the real value later.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1044230&r1=1044229&r2=1044230&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Fri Dec 10 07:20:49 2010
@@ -347,10 +347,8 @@ public class FreeMarkerWorker {
 
     public static String getArg(Map<String, ? extends Object> args, String key, Map<String, ? extends Object> templateContext) {
         //SimpleScalar s = null;
-        Object o = null;
-        String returnVal = null;
-        o = args.get(key);
-        returnVal = (String) unwrap(o);
+        Object o = args.get(key);
+        String returnVal = (String) unwrap(o);
         if (returnVal == null) {
             try {
                 if (templateContext != null) {
@@ -365,10 +363,8 @@ public class FreeMarkerWorker {
 
     public static Object getArgObject(Map<String, ? extends Object> args, String key, Map<String, ? extends Object> templateContext) {
         //SimpleScalar s = null;
-        Object o = null;
-        Object returnVal = null;
-        o = args.get(key);
-        returnVal = unwrap(o);
+        Object o = args.get(key);
+        Object returnVal = unwrap(o);
         if (returnVal == null) {
             try {
                 if (templateContext != null) {
@@ -422,16 +418,15 @@ public class FreeMarkerWorker {
     }
 
     public static Object get(SimpleHash args, String key) {
-        Object returnObj = null;
         Object o = null;
         try {
             o = args.get(key);
         } catch (TemplateModelException e) {
             Debug.logVerbose(e.getMessage(), module);
-            return returnObj;
+            return null;
         }
 
-        returnObj = unwrap(o);
+        Object returnObj = unwrap(o);
 
         if (returnObj == null) {
             Object ctxObj = null;