[ http://jira.magnolia-cms.com/browse/MAGNOLIA-2967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Grégory Joseph updated MAGNOLIA-2967: ------------------------------------- Fix Version/s: 4.2.x 4.3 > Handle errors when the regex group numbers in a VirtualURIConfig node don't > match gracefully, rather than allowing the RTE to kill everything > --------------------------------------------------------------------------------------------------------------------------------------------- > > Key: MAGNOLIA-2967 > URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-2967 > Project: Magnolia > Issue Type: Bug > Components: core > Affects Versions: 4.2.1 > Reporter: Ryan Gardner > Assignee: Philipp Bärfuss > Fix For: 4.2.x, 4.3 > > Attachments: makeRegexFailNicer.patch > > > If the from URI doesn't have as many groups as the to URI is expecting, the > regex matcher used by the RegexpVirtualURIMapping will throw an exception > that kills the processing of the request. > When I accidently removed and saved a VirtualURIFilter config with a blank > from URI and a to: URI that was expecting a regex, group - it became > impossible for me to fix it via the admin UI: > The stacktrace looked a bit like this - > java.lang.IndexOutOfBoundsException: No group 1 > at java.util.regex.Matcher.group(Matcher.java:470) > at java.util.regex.Matcher.appendReplacement(Matcher.java:737) > at java.util.regex.Matcher.replaceAll(Matcher.java:813) > at > info.magnolia.cms.beans.config.RegexpVirtualURIMapping.mapURI(RegexpVirtualURIMapping.java:64) > at > info.magnolia.cms.beans.config.VirtualURIManager.getURIMapping(VirtualURIManager.java:83) > at > info.magnolia.cms.filters.VirtualUriFilter.getURIMapping(VirtualUriFilter.java:122) > The attached patch adds a unit test for the kind of bad configuration, and > prior to catching the exception and returning an unchanged URL, the test will > fail. This may not be the best way to handle this problem in the long term, > but if you would argue that making the server become entirely unresponsive > and not allow the user to fix a simple typo is a better approach than > trapping the exception and returning a URI that is unchanged from the > request, I question how much you like your users :) > I thought about making it throw a custom MalformedURIConfig exception and > then catching that exception at the VirtualURIFilter level, but since there > aren't already testcases existing for the VirtualURIManager or the > VirtualURIFilter, I didn't. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.magnolia-cms.com/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------