diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java index 62b9c71d3f70d..90d61fb86c739 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java @@ -11,6 +11,8 @@ public class RequestMapper { + private static final String[] EMPTY_STRING_ARRAY = new String[0]; + private final PathMatcher>> requestPaths; private final PathMatcher.Builder>> pathMatcherBuilder; private final List> templates; @@ -59,7 +61,7 @@ public RequestMatch map(String path) { List> value = initialMatch.getValue(); for (int index = 0; index < value.size(); index++) { RequestPath potentialMatch = value.get(index); - String[] params = new String[maxParams]; + String[] params = (maxParams > 0) ? new String[maxParams] : EMPTY_STRING_ARRAY; int paramCount = 0; boolean matched = true; boolean prefixAllowed = potentialMatch.prefixTemplate;