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

Certain pattern string not accepted for RgxGen #53

Closed
code-lucidal58 opened this issue Dec 6, 2020 · 4 comments
Closed

Certain pattern string not accepted for RgxGen #53

code-lucidal58 opened this issue Dec 6, 2020 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@code-lucidal58
Copy link

Describe the bug
New RgxGen object creation fails with StringIndexOutOfBoundsException, when passing the pattern string ^[a-zA-Z0-9-._:]*$.

To Reproduce
Steps to reproduce the behavior:
Creating a new RgxGen with the pattern string ^[a-zA-Z0-9-._:]*$.
RgxGen rgxGen = new RgxGen(pattern);

Expected behavior
Successfully create the object

Error Log

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:237)
	at java.lang.StringBuilder.charAt(StringBuilder.java:76)
	at com.github.curiousoddman.rgxgen.parsing.dflt.DefaultTreeBuilder.handleRange(DefaultTreeBuilder.java:417)
	at com.github.curiousoddman.rgxgen.parsing.dflt.DefaultTreeBuilder.handleCharacterVariations(DefaultTreeBuilder.java:505)
	at com.github.curiousoddman.rgxgen.parsing.dflt.DefaultTreeBuilder.parseGroup(DefaultTreeBuilder.java:149)
	at com.github.curiousoddman.rgxgen.parsing.dflt.DefaultTreeBuilder.build(DefaultTreeBuilder.java:521)
	at com.github.curiousoddman.rgxgen.parsing.dflt.DefaultTreeBuilder.get(DefaultTreeBuilder.java:530)
	at com.github.curiousoddman.rgxgen.RgxGen.<init>(RgxGen.java:52)
	at com.github.curiousoddman.rgxgen.RgxGen.<init>(RgxGen.java:43)

Environment (please complete the following information):

@code-lucidal58 code-lucidal58 added the bug Something isn't working label Dec 6, 2020
@curious-odd-man curious-odd-man added this to the Version 1.3 milestone Dec 6, 2020
curious-odd-man added a commit that referenced this issue Dec 6, 2020
curious-odd-man added a commit that referenced this issue Dec 6, 2020
curious-odd-man added a commit that referenced this issue Dec 8, 2020
curious-odd-man added a commit that referenced this issue Dec 8, 2020
curious-odd-man added a commit that referenced this issue Dec 8, 2020
curious-odd-man added a commit that referenced this issue Dec 8, 2020
Optimization.
Don't create substring. Go char by char.
curious-odd-man added a commit that referenced this issue Dec 8, 2020
curious-odd-man added a commit that referenced this issue Dec 8, 2020
curious-odd-man added a commit that referenced this issue Dec 8, 2020
@curious-odd-man
Copy link
Owner

Dear @code-lucidal58. The issue have been resolved in a version 1.3-SNAPSHOT.

You can use this version as explained in README or wait for version 1.3 release.

Please let me know if there are any other issues.

@spacether
Copy link

spacether commented Dec 9, 2020

@curious-odd-man would it be possible for you to publish a non snapshot version before Dec 16th?
In openapi-generator we want to include this fix and we are doing a major rev roll but we don't want to install a snapshot version. See OpenAPITools/openapi-generator#8139 (comment)

@curious-odd-man
Copy link
Owner

@spacether sure. I'll do my best. I'll drop a comment in referenced issue once release is done.

@spacether
Copy link

Thank you! I completely understand if you are too busy also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants