Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PathPatternParserTests#regexPathElementPatterns() fails on Java 13 #23669

Closed
snicoll opened this issue Sep 19, 2019 · 1 comment
Closed

PathPatternParserTests#regexPathElementPatterns() fails on Java 13 #23669

snicoll opened this issue Sep 19, 2019 · 1 comment
Assignees
Labels
type: bug A general bug
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Sep 19, 2019

Stacktrace:

org.opentest4j.AssertionFailedError: [/{var:a{{1,2}}}
        ^
Exception occurred in regex pattern compilation] 
Expecting:
 <8>
to be equal to:
 <6>
but was not.
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at org.springframework.web.util.pattern.PathPatternParserTests.lambda$checkError$3(PathPatternParserTests.java:441)
	at org.springframework.web.util.pattern.PathPatternParserTests.checkError(PathPatternParserTests.java:440)
	at org.springframework.web.util.pattern.PathPatternParserTests.regexPathElementPatterns(PathPatternParserTests.java:121)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:567)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
@snicoll snicoll added the type: bug A general bug label Sep 19, 2019
@snicoll snicoll added this to the 5.2 GA milestone Sep 19, 2019
@sbrannen
Copy link
Member

sbrannen commented Sep 19, 2019

After some internal brainstorming...

Proposal

Create an overloaded variant of checkError() for the /{var:a{{1,2}}} pattern that does not check the expectedPos, but leave the remaining usage of checkError() as-is.

Rationale

If a java.util.regex.PatternSyntaxException is thrown, we cannot influence the "error index" reported in that exception. Thus, we should not assert a specific "expected position" in the org.springframework.web.util.pattern.PatternParseException thrown by org.springframework.web.util.pattern.PathPatternParser.parse(String) for such cases.

Research

Potentially caused this change in JDK 13: http://hg.openjdk.java.net/jdk/jdk/rev/7a026580fed5

@sbrannen sbrannen self-assigned this Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants