svn commit: r1054898 - in /forrest/trunk: main/java/org/apache/forrest/conf/AntProperties.java site-author/status.xml

[email protected]
Newsgroups gmane.text.xml.forrest.cvs
Message-ID <[email protected]>
Author: crossley
Date: Tue Jan  4 05:07:28 2011
New Revision: 1054898

URL: http://svn.apache.org/viewvc?rev=1054898&view=rev
Log:
Improve startup performance by dealing with only the specified property rather than iterating through all of them.
Contributed by: DeBel
Issue: FOR-1203

Modified:
    forrest/trunk/main/java/org/apache/forrest/conf/AntProperties.java
    forrest/trunk/site-author/status.xml

Modified: forrest/trunk/main/java/org/apache/forrest/conf/AntProperties.java
URL: http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/conf/AntProperties.java?rev=1054898&r1=1054897&r2=1054898&view=diff
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/conf/AntProperties.java (original)
+++ forrest/trunk/main/java/org/apache/forrest/conf/AntProperties.java Tue Jan  4 05:07:28 2011
@@ -20,7 +20,6 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
@@ -79,15 +78,17 @@ public class AntProperties extends Prope
         //if the property is already there don't overwrite, as in Ant
         //properties defined first take precedence
         if (!super.containsKey(name)) {
-            Enumeration names = super.propertyNames();
-            while (names.hasMoreElements()) {
-                String currentName = (String) names.nextElement();
+          String[] names = StringUtils.substringsBetween(value.toString(), "${", "}");
+          if ( names != null ){
+            for ( int i = 0; i < names.length; i++ ) {
+                String currentName = names[i];
                 String valueToSearchFor = "${" + currentName + "}";
                 String valueToReplaceWith = (String) super.get(currentName);
                 value = StringUtils.replace(value.toString(), valueToSearchFor,
                                 valueToReplaceWith);
             }
-            return super.put(name, value);
+          }
+          return super.put(name, value);
         }
 
         return null;

Modified: forrest/trunk/site-author/status.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/site-author/status.xml?rev=1054898&r1=1054897&r2=1054898&view=diff
==============================================================================
--- forrest/trunk/site-author/status.xml (original)
+++ forrest/trunk/site-author/status.xml Tue Jan  4 05:07:28 2011
@@ -153,6 +153,11 @@
         Added document to facilitate
         <link href="site:upgrading_09">upgrading to v0.9</link>
       </action>
+<!-- 2011-01 -->
+      <action context="code" type="update" dev="DC" due-to="DeBel" fixes-bug="FOR-1203">
+        Improve startup performance by dealing with only the specified property
+        rather than iterating through all of them.
+      </action>
 <!-- 2010-12 -->
       <action context="code" type="update" dev="DC" due-to="Simon Pepping" fixes-bug="FOR-1205">
         Fix syntax errors for import of additional style sheets for "tigris" skin.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.