You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Jordi Salvat i Alabart (JIRA)" <ji...@apache.org> on 2007/05/11 16:54:15 UTC

[jira] Created: (WICKET-555) WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks

WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks
--------------------------------------------------------------------------------------

                 Key: WICKET-555
                 URL: https://issues.apache.org/jira/browse/WICKET-555
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.2.6, 1.2.7, 1.3, 2.0
            Reporter: Jordi Salvat i Alabart
             Fix For: 2.0


(Note: I've found this on 1.2.6 -- I'm reporting as existing on later versions based on reading the code.)

When any of the components replaced by an AJAX response renders multiple HTML lines, or if the AJAX response contains line breaks for any other reasons, the WicketTester.assertComponentOnAjaxResponse always returns false.

I've traced this to this statement:

		boolean isComponentInAjaxResponse = ajaxResponse.matches(".*<component id=\"" + markupId
				+ "\" ?>.*");

which never matches if ajaxResponse contains a \n because, in Java RegExps, the dot doesn't match these unless DOTALL is set (and it is not by default).

In the latest version I've found in SVN (sorry I'm not yet quite familiar with the codebase,) this code has been moved unchanged to org.apache.wicket.util.tester.BaseWicketTester.java -- so I assume the bug is still there.

The easiest solution is to add a single-line "(?s)" flag in front of the regular expression:

		boolean isComponentInAjaxResponse = ajaxResponse.matches("(?s).*<component id=\"" + markupId
				+ "\" ?>.*");


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-555) WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-555:
--------------------------------

        Fix Version/s:     (was: 2.0 branch (discontinued))
                       1.3.0-beta3
             Assignee: Alastair Maw
    Affects Version/s:     (was: 2.0 branch (discontinued))

Please don't set fix versions without consultation, particularly not for version 2.0 (discontinued)! The developers will do this.

> WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-555
>                 URL: https://issues.apache.org/jira/browse/WICKET-555
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.6, 1.2.7, 1.3.0-beta1
>            Reporter: Jordi Salvat i Alabart
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta3
>
>
> (Note: I've found this on 1.2.6 -- I'm reporting as existing on later versions based on reading the code.)
> When any of the components replaced by an AJAX response renders multiple HTML lines, or if the AJAX response contains line breaks for any other reasons, the WicketTester.assertComponentOnAjaxResponse always returns false.
> I've traced this to this statement:
> 		boolean isComponentInAjaxResponse = ajaxResponse.matches(".*<component id=\"" + markupId
> 				+ "\" ?>.*");
> which never matches if ajaxResponse contains a \n because, in Java RegExps, the dot doesn't match these unless DOTALL is set (and it is not by default).
> In the latest version I've found in SVN (sorry I'm not yet quite familiar with the codebase,) this code has been moved unchanged to org.apache.wicket.util.tester.BaseWicketTester.java -- so I assume the bug is still there.
> The easiest solution is to add a single-line "(?s)" flag in front of the regular expression:
> 		boolean isComponentInAjaxResponse = ajaxResponse.matches("(?s).*<component id=\"" + markupId
> 				+ "\" ?>.*");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-555) WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511487 ] 

Alastair Maw commented on WICKET-555:
-------------------------------------

(In r555001.)

> WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-555
>                 URL: https://issues.apache.org/jira/browse/WICKET-555
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.6, 1.2.7, 1.3.0-beta1
>            Reporter: Jordi Salvat i Alabart
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta3
>
>
> (Note: I've found this on 1.2.6 -- I'm reporting as existing on later versions based on reading the code.)
> When any of the components replaced by an AJAX response renders multiple HTML lines, or if the AJAX response contains line breaks for any other reasons, the WicketTester.assertComponentOnAjaxResponse always returns false.
> I've traced this to this statement:
> 		boolean isComponentInAjaxResponse = ajaxResponse.matches(".*<component id=\"" + markupId
> 				+ "\" ?>.*");
> which never matches if ajaxResponse contains a \n because, in Java RegExps, the dot doesn't match these unless DOTALL is set (and it is not by default).
> In the latest version I've found in SVN (sorry I'm not yet quite familiar with the codebase,) this code has been moved unchanged to org.apache.wicket.util.tester.BaseWicketTester.java -- so I assume the bug is still there.
> The easiest solution is to add a single-line "(?s)" flag in front of the regular expression:
> 		boolean isComponentInAjaxResponse = ajaxResponse.matches("(?s).*<component id=\"" + markupId
> 				+ "\" ?>.*");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-555) WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-555?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw resolved WICKET-555.
---------------------------------

    Resolution: Fixed

Fixed in trunk.

> WicketTester.assertComponentOnAjaxResponse fails if AJAX response contains line breaks
> --------------------------------------------------------------------------------------
>
>                 Key: WICKET-555
>                 URL: https://issues.apache.org/jira/browse/WICKET-555
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.6, 1.2.7, 1.3.0-beta1
>            Reporter: Jordi Salvat i Alabart
>            Assignee: Alastair Maw
>             Fix For: 1.3.0-beta3
>
>
> (Note: I've found this on 1.2.6 -- I'm reporting as existing on later versions based on reading the code.)
> When any of the components replaced by an AJAX response renders multiple HTML lines, or if the AJAX response contains line breaks for any other reasons, the WicketTester.assertComponentOnAjaxResponse always returns false.
> I've traced this to this statement:
> 		boolean isComponentInAjaxResponse = ajaxResponse.matches(".*<component id=\"" + markupId
> 				+ "\" ?>.*");
> which never matches if ajaxResponse contains a \n because, in Java RegExps, the dot doesn't match these unless DOTALL is set (and it is not by default).
> In the latest version I've found in SVN (sorry I'm not yet quite familiar with the codebase,) this code has been moved unchanged to org.apache.wicket.util.tester.BaseWicketTester.java -- so I assume the bug is still there.
> The easiest solution is to add a single-line "(?s)" flag in front of the regular expression:
> 		boolean isComponentInAjaxResponse = ajaxResponse.matches("(?s).*<component id=\"" + markupId
> 				+ "\" ?>.*");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.