You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Antti S. Lankila (JIRA)" <ji...@apache.org> on 2011/07/03 13:30:22 UTC

[jira] [Updated] (WICKET-3862) ComponentInfo: simplified -, : encoding procedure

     [ https://issues.apache.org/jira/browse/WICKET-3862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antti S. Lankila updated WICKET-3862:
-------------------------------------

    Attachment: simplified-componentinfo.diff

Use Pattern, Matcher and StringBuilder to perform single-pass simultaneous replacement of two distinct values.

> ComponentInfo: simplified -, : encoding procedure
> -------------------------------------------------
>
>                 Key: WICKET-3862
>                 URL: https://issues.apache.org/jira/browse/WICKET-3862
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>            Reporter: Antti S. Lankila
>            Priority: Minor
>         Attachments: simplified-componentinfo.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> ComponentInfo encodes the interface and path of the component by generating dash-separated values such as listener-foo-bar--baz, which means interface "listener", component path "foo:bar-baz". The path encoding is pretty clumsy and involves three full substitutions using Strings.replaceAll():
> 1. - => temporary string
> 2. : => -
> 3. temporary string => --
> The reverse procedure does the same steps in reverse to cancel the transformation.
> This patch appended handles the steps simultaneously by using a regex substitution method which matches both : and - and replaces by - and -- respectively, and the reverse method matches -- or - (with -- preferred) and replaces by - and : respectively. It should be more elegant and doesn't require generating a rather kooky [[[[[[WICKET]]TMP]]DASH0.123456789E]]]] type random constant.
> Additionally I had a wicket-using website somehow fail in production after an update because somehow it would no longer correctly decode the mangled names' -- back to -, but rather attempted to resolve one of those [[[[[[WICKET]]TMP]]DASH]]etc]]]] names. I admit I am confused about how exactly this came to be, but somehow it did.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira