Could you alternatively do:

if ( value.startsWith("[autolink") && (value.charAt(9) == ']' || value.charAt(9) == ':') ) ...

This is a fairly safe test and charAt() and character comparison are both pretty fast operations

Chris

Donnerstag, Juergen wrote:

Hi,

I just discovered an issue with [autolink]. Though
ComponentTag.createAutomaticLink()'s comment describes and implements
[autolink:paraName=paraValue,para2Name=para2Value],
MarkupParser.parseTagText() does not. It simply does 'if
(value.equals("[autolink]"))'. There are several solutions to that.

1) use startsWith like 'if (value.startsWith("[autolink"))' instead of
equals (note the missing ']'). This works, but is not 100% secure.
"[autolinkTest]" meets the criteria as well, but is not a valid autolink. I
guess the question is: does that matter? createAutomaticLink will throw an
exception.

2) Use a regex pattern like "[autolink(:.*?)?]" instead. Regex is obviously
slower.

I prefer solution 1. What do you think? Do you see any other implications?

Regards
Juergen




------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Wicket-develop mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/wicket-develop






------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Wicket-develop mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to