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

The regex for double values does not consider possible values ("E-", e.g.: 1.0074598709275406E-4) #2043

Open
IvanBurliaiev opened this issue Nov 21, 2023 · 1 comment
Labels

Comments

@IvanBurliaiev
Copy link

IvanBurliaiev commented Nov 21, 2023

https://github.com/spring-cloud/spring-cloud-contract/blob/cd0fffa972cf3065c29ec1b29b13585c30a7345a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/RegexPatterns.java#L55C45-L55C45

The regex for double values does not consider possible values ("E-", e.g.: 1.0074598709275406E-4)
https://github.com/spring-cloud/spring-cloud-contract/blob/cd0fffa972cf3065c29ec1b29b13585c30a7345a/specs/spring-cloud-contract-spec-java/src/main/java/org/springframework/cloud/contract/spec/internal/RegexPatterns.java#L55C45-L55C45

which causes intermittent exception here

with double values produced by the line this.random.nextInt(100) + this.random.nextDouble()

return createAndValidateProperty(RegexPatterns.DOUBLE, this.random.nextInt(100) + this.random.nextDouble());

@marcingrzejszczak
Copy link
Contributor

I guess we should go with more sophisticated regular expressions like this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants