[Yanel-commits] rev 37154 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/util

michi at wyona.com michi at wyona.com
Tue Jun 17 22:53:09 CEST 2008


Author: michi
Date: 2008-06-17 22:53:09 +0200 (Tue, 17 Jun 2008)
New Revision: 37154

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/WildcardReplacerHelper.java
Log:
output some useful logs re pattern matching

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/WildcardReplacerHelper.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/WildcardReplacerHelper.java	2008-06-17 16:04:04 UTC (rev 37153)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/WildcardReplacerHelper.java	2008-06-17 20:53:09 UTC (rev 37154)
@@ -45,6 +45,10 @@
     public WildcardReplacerHelper () {
     }
 
+    /**
+     * @param stringWithReplaceTokens /{1}/{2}.xml
+     * @param pattern \/*\/*.pdf
+     */
     public WildcardReplacerHelper (String stringWithReplaceTokens, String pattern) {
         this.stringWithReplaceTokens = stringWithReplaceTokens;
         this.pattern = pattern;
@@ -61,7 +65,10 @@
      * @see org.wyona.yanel.core.util.WildcardMatcherHelper
      */
     public String getReplacedString(String origString) throws Exception {
-        if (stringWithReplaceTokens == null) return origString;
+        if (stringWithReplaceTokens == null) {
+            log.warn("No replace tokens specified, hence the original path will be returned: " + origString);
+            return origString;
+        }
         if (pattern == null) return stringWithReplaceTokens;
 
         log.debug("yanel-path property: " + stringWithReplaceTokens);
@@ -69,6 +76,7 @@
 
         Map map = WildcardMatcherHelper.match(pattern, origString);
         if (map == null) {
+            log.warn("Pattern '" + pattern + "' didn't match string '" + origString + "'!");
             return null;
         }
         String resultString = stringWithReplaceTokens;
@@ -95,4 +103,4 @@
     public void setPattern(String pattern) {
         this.pattern = pattern;
     }
-}
\ No newline at end of file
+}



More information about the Yanel-commits mailing list