You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Peter Courcoux <pe...@courcouxhall.co.uk> on 2002/09/16 22:58:15 UTC

ParameterParser case folding and html tags

Hi,

I have a need to disable case folding in ParameterParser, which I have
done. However, the formatString(String input) method of
org.apache.turbine.modules.ActionEvent specifically checks for case
folding as below and does not drop the .x=? and .y= parts of the event
name if case folding is set to "NONE". I have amended my local copy of
Turbine-2 as follows. I am not sure how ActionEvent is used and whether
this will break anything else. It does work for me! 

If anyone else come across this and believes that this change is likely
to cause any other problems I would be grateful to hear.

Many thanks.

Peter Courcoux



--- ActionEvent.java~	Thu Aug 16 06:08:29 2001
+++ ActionEvent.java	Sat Sep 14 15:08:35 2002
@@ -192,35 +192,31 @@
     /**
      * This method does the conversion of the lowercase method name
      * into the proper case.
+	 * Amended by pjc 14-09-2002 
      *
      * @param input The unconverted method name.
      * @return A string with the method name in the proper case.
      */
     protected final String formatString(String input)
     {
-        String fold =
-           
TurbineResources.getString(ParameterParser.URL_CASE_FOLDING, "")
-            .toLowerCase();
-        if ((fold == null) ||
-            (fold.length()==0) ||
-            (! fold.equals(ParameterParser.URL_CASE_FOLDING_NONE)))
-        {
-            String tmp = input;
+		String tmp = input.toLowerCase();
 
-            // Chop off suffixes (for image type)
-            if (input.endsWith(".x") || input.endsWith(".y"))
-            {
-               tmp = tmp.substring(0, input.length() - 2);
-            }
-            // Chop off the prefixes.
-            tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
-
-            return (METHOD_NAME_PREFIX + firstLetterCaps(tmp));
-        }
+		if ((tmp.length() != 0) && (tmp != null))
+			{
+				// Chop off suffixes (for image type)
+				if (input.endsWith(".x") || input.endsWith(".y"))
+					{
+						tmp = tmp.substring(0, input.length() - 2);
+					}
+				// Chop off the prefixes.
+				tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
+				
+				return (METHOD_NAME_PREFIX + firstLetterCaps(tmp));
+			}
         else
-        {
-            return input.substring(BUTTON_LENGTH);
-        }
+			{
+				return input.substring(BUTTON_LENGTH);
+			}
     }
 
     /**



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>