Author: nbubna
Date: Mon Sep  8 11:41:27 2008
New Revision: 693195

URL: http://svn.apache.org/viewvc?rev=693195&view=rev
Log:
simplify configuring tools with no properties

Modified:
    velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolInfo.java

Modified: 
velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolInfo.java
URL: 
http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolInfo.java?rev=693195&r1=693194&r2=693195&view=diff
==============================================================================
--- velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolInfo.java 
(original)
+++ velocity/tools/trunk/src/main/java/org/apache/velocity/tools/ToolInfo.java 
Mon Sep  8 11:41:27 2008
@@ -225,11 +225,18 @@
         /* put configured props into the combo last, since
            dynamic properties will almost always be conventions
            and we need to let configuration win out */
-        Map<String,Object> combinedProps =
-            combine(dynamicProperties, getProps());
+        Map<String,Object> props;
+        if (properties == null)
+        {
+            props = dynamicProperties;
+        }
+        else
+        {
+            props = combine(dynamicProperties, properties);
+        }
 
         // perform the actual configuration of the new tool
-        configure(tool, combinedProps);
+        configure(tool, props);
         return tool;
     }
 
@@ -244,11 +251,13 @@
      */
     protected void configure(Object tool, Map<String,Object> configuration)
     {
-        //TODO: make this step optional?
-        // look for specific setters
-        for (Map.Entry<String,Object> conf : configuration.entrySet())
+        if (configuration != null)
         {
-            setProperty(tool, conf.getKey(), conf.getValue());
+            // look for specific setters
+            for (Map.Entry<String,Object> conf : configuration.entrySet())
+            {
+                setProperty(tool, conf.getKey(), conf.getValue());
+            }
         }
 
         if (hasConfigure())


Reply via email to