On 10/19/2010 12:15 PM, cjdelisle (SVN) wrote:
> Author: cjdelisle
> Date: 2010-10-19 12:15:41 +0200 (Tue, 19 Oct 2010)
> New Revision: 31959
>
> Modified:
>
> platform/xwiki-applications/trunk/invitation/src/main/resources/Invitation/WebHome.xml
> Log:
> XAINVITATION-14: Stop using deprecated com.xpn.xwiki.api.Context#getUtil()
>
> Modified:
> platform/xwiki-applications/trunk/invitation/src/main/resources/Invitation/WebHome.xml
> ===================================================================
> ---
> platform/xwiki-applications/trunk/invitation/src/main/resources/Invitation/WebHome.xml
> 2010-10-19 10:03:00 UTC (rev 31958)
> +++
> platform/xwiki-applications/trunk/invitation/src/main/resources/Invitation/WebHome.xml
> 2010-10-19 10:15:41 UTC (rev 31959)
> @@ -965,10 +965,18 @@
> * $invalidAddresses (List<String>) this List will be populated with
> addresses from $allAddresses which are invalid.
> *###
> #macro(validateAddressFormat, $allAddresses, $emailRegex, $invalidAddresses)
> + ## Perl/javascript regexes look like /^.*/
> + ## java does not like the / at beginning and end.
> + #if($emailRegex.length()> 1)
> + #set($emailRegexInternal = $emailRegex.substring(1,
> $mathtool.add($emailRegex.length(), -1)))
I'd like to also deprecate the old syntax, so you should have support
for java regexps as well. So, if starts with and ends with /, remove
them from the regexp.
Also, isn't it possible to have some flags after the ending / ? Maybe it
should be something like substringAfterLast('/').
> + #else
> + ## I don't expect this but want to maintain compatability.
> + #set($emailRegexInternal = $emailRegex)
> + #end
> #foreach($address in $allAddresses)
> #if("$!address" == '')
> ## Empty address, do nothing.
> - #elseif(!$xcontext.getUtil().match($emailRegex, $address))
> + #elseif($regextool.find($address, $emailRegexInternal).size() == 0)
> #set($discard = $invalidAddresses.add($address))
> #end
> #end
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs