[EMAIL PROTECTED] writes:
>seade 2003/09/14 04:36:26
> Modified: src/java/org/apache/turbine/modules ActionEvent.java
> xdocs changes.xml
> Log:
> Fixed the code that removes the trailing ".x" and ".y" from action events that
> originate from input type="image" elements.
>
> Revision Changes Path
> 1.21 +4 -4
> jakarta-turbine-2/src/java/org/apache/turbine/modules/ActionEvent.java
>
> Index: ActionEvent.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/ActionEvent.java,v
> retrieving revision 1.20
> retrieving revision 1.21
> diff -u -r1.20 -r1.21
> --- ActionEvent.java 2 Sep 2003 07:48:30 -0000 1.20
> +++ ActionEvent.java 14 Sep 2003 11:36:26 -0000 1.21
> @@ -262,9 +262,9 @@
> tmp = input.toLowerCase();
>
> // Chop off suffixes (for image type)
> - input = (tmp.endsWith(".x") || tmp.endsWith(".y"))
> - ? input.substring(0, input.length() - 2)
> - : input;
> + tmp = (tmp.endsWith(".x") || tmp.endsWith(".y"))
> + ? tmp.substring(0, tmp.length() - 2)
> + : tmp;
This fix is not right. It will not work for the URL_CASE_FOLDING_NONE
case.
You want to apply this:
Index: ActionEvent.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/modules/ActionEvent.java,v
retrieving revision 1.21
diff -u -b -r1.21 ActionEvent.java
--- ActionEvent.java 14 Sep 2003 11:36:26 -0000 1.21
+++ ActionEvent.java 14 Sep 2003 17:27:28 -0000
@@ -255,22 +255,21 @@
*/
protected final String formatString(String input)
{
- String tmp = null;
+ String tmp = input;
if (StringUtils.isNotEmpty(input))
{
tmp = input.toLowerCase();
// Chop off suffixes (for image type)
- tmp = (tmp.endsWith(".x") || tmp.endsWith(".y"))
- ? tmp.substring(0, tmp.length() - 2)
- : tmp;
+ input = (tmp.endsWith(".x") || tmp.endsWith(".y"))
+ ? input.substring(0, input.length() - 2)
+ : input;
if (ParserUtils.getUrlFolding()
!= ParserUtils.URL_CASE_FOLDING_NONE)
{
-
- tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
+ tmp = input.toLowerCase().substring(BUTTON_LENGTH +
METHOD_NAME_LENGTH);
tmp = METHOD_NAME_PREFIX + StringUtils.capitalise(tmp);
}
else
on top of it. Using "input" in the trinary is correct, the mistake is
made further below in the folding != URL_CASE_FOLDING_NONE case.
If you just use your code, in the URL_CASE_FOLDING_NONE case, the .x
and .y will stay attached to the input key.
This cries for a junit test but I currently have no time to code this
up. Volunteers?
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
[EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!"
-- AOL CD when played backwards (User Friendly - 200-10-15)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]