https://bz.apache.org/bugzilla/show_bug.cgi?id=60413
Bug ID: 60413 Summary: RewriteValve: empty capturing group results in null backreference instead of "" (empty) string Product: Tomcat 8 Version: 8.5.x-trunk Hardware: All OS: All Status: NEW Severity: major Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: 1983-01...@gmx.net Target Milestone: ---- Created attachment 34474 --> https://bz.apache.org/bugzilla/attachment.cgi?id=34474&action=edit Avoid null return values Consider this rule: RewriteRule ^/docs(/rest)?$ /docs$1/ [redirect=307,L] A GET on http://localhost:8080/app/docs redirects to http://localhost:8080/tedab-services-webapp/docsnull/ The reason is m.group(n) returns a null when the capturing group is not present. Worse than that, this null value is passed to ENCODER.encode() which may result in a NPE. Attached is a patched which resolves the issue by returning empty strings on null. Feel free to improve the patch. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org