Language: Java
Label: safe
CWE: NVD-CWE-noinfo \u2014 

Code:
    public static String mappedPath(ServiceRequestContext ctx) {
        final RequestTarget requestTarget = ctx.routingContext().requestTarget();
        final String pathWithMatrixVariables = requestTarget.maybePathWithMatrixVariables();
        if (pathWithMatrixVariables.equals(ctx.path())) {
            return ctx.mappedPath();
        }
        // The request path contains matrix variables. e.g. "/foo/bar/users;name=alice"

        final String prefix = ctx.path().substring(0, ctx.path().length() - ctx.mappedPath().length());
        // The prefix is now `/foo/bar`
        if (!pathWithMatrixVariables.startsWith(prefix)) {
            // The request path has matrix variables in the wrong place. e.g. "/foo;name=alice/bar/users"
            return null;
        }
        final String mappedPath = pathWithMatrixVariables.substring(prefix.length());
        if (mappedPath.charAt(0) != '/') {
            // Again, the request path has matrix variables in the wrong place. e.g. "/foo/bar;/users"
            return null;
        }
        return mappedPath;
    }