Skip to content

Commit 62a3579

Browse files
author
Nico Verwer
committed
check URL validity in XQueryUrlRewrite
1 parent 3dd83fc commit 62a3579

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

exist-core/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ The BaseX Team. The original license statement is also included below.]]></pream
997997
<execution>
998998
<id>default-compile</id>
999999
<configuration>
1000+
<release>11</release>
10001001
<excludes>
10011002
<!-- compiled by the Aspectj plugin below -->
10021003
<exclude>org/exist/storage/lock/EnsureLockingAspect.java</exclude>

exist-core/src/main/java/org/exist/http/urlrewrite/XQueryURLRewrite.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,13 @@ protected void service(final HttpServletRequest request, final HttpServletRespon
362362
}
363363
}
364364
} catch (final Throwable e) {
365+
if (e instanceof IllegalArgumentException) {
366+
LOG.warn("Invalid URI: {}", e.getMessage());
367+
response.getWriter().print(e.getMessage());
368+
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
369+
response.flushBuffer();
370+
return;
371+
}
365372
LOG.error("Error while processing {}: {}", request.getRequestURI(), e.getMessage(), e);
366373
throw new ServletException("An error occurred while processing request to " + request.getRequestURI() + ": "
367374
+ e.getMessage(), e);

0 commit comments

Comments
 (0)