You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2008/08/19 11:17:59 UTC

svn commit: r687004 - /james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/MacroExpand.java

Author: bago
Date: Tue Aug 19 02:17:56 2008
New Revision: 687004

URL: http://svn.apache.org/viewvc?rev=687004&view=rev
Log:
Fix macroexpansion for %- and %_ (JSPF-66)

Modified:
    james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/MacroExpand.java

Modified: james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/MacroExpand.java
URL: http://svn.apache.org/viewvc/james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/MacroExpand.java?rev=687004&r1=687003&r2=687004&view=diff
==============================================================================
--- james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/MacroExpand.java (original)
+++ james/jspf/trunk/resolver/src/main/java/org/apache/james/jspf/core/MacroExpand.java Tue Aug 19 02:17:56 2008
@@ -281,7 +281,20 @@
                             .appendReplacement(decodedValue, replaceCell(macroCell, macroData, isExplanation));
                 } else if (match2.length() == 2 && match2.startsWith("%")) {
                     // handle the % escaping
-                    inputMatcher.appendReplacement(decodedValue, match2.substring(1));
+                    /*
+                     * From RFC4408:
+                     * 
+                     * A literal "%" is expressed by "%%".
+                     *   "%_" expands to a single " " space.
+                     *   "%-" expands to a URL-encoded space, viz., "%20".
+                     */
+                    if ("%_".equals(match2)) {
+                        inputMatcher.appendReplacement(decodedValue, " ");
+                    } else if ("%-".equals(match2)) {
+                        inputMatcher.appendReplacement(decodedValue, "%20");
+                    } else {
+                        inputMatcher.appendReplacement(decodedValue, match2.substring(1));
+                    }
                 }
             }
             



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org