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

java.util.regex.PatternSyntaxException when dependencyUpdates/report.json has a version range #25

Closed
isker opened this issue Jun 28, 2019 · 6 comments

Comments

@isker
Copy link
Contributor

isker commented Jun 28, 2019

build/dependencyUpdates/report.json contains a node like this:

            {
                "group": "com.foo",
                "available": {
                    "release": null,
                    "milestone": "0.22.20181102.232553",
                    "integration": null
                },
                "version": "[0.1,1.0)",
                "projectUrl": null,
                "name": "bar"
            },

The version being a range results in this (I pruned the extremely long Gradle stacktrace to the relevant frames):

Caused by: java.util.regex.PatternSyntaxException: Unclosed character class near index 691
((?:testRuntimeOnly|implementation|annotationProcessor|api|apiDependenciesMetadata|apiElements|compile|compileClasspath|compileOnly|compileOnlyDependenciesMetadata|implementation|implementationDependenciesMetadata|runtime|runtimeClasspath|runtimeElements|runtimeOnly|runtimeOnlyDependenciesMetadata|testAnnotationProcessor|testApi|testApiDependenciesMetadata|testCompile|testCompileClasspath|testCompileOnly|testCompileOnlyDependenciesMetadata|testImplementation|testImplementationDependenciesMetadata|testKotlinScriptDef|testKotlinScriptDefExtensions|testRuntime|testRuntimeClasspath|testRuntimeOnlyDependenciesMetadata)\s*\(\s*"com.foo"\s*,\s*"bar"\s*,\s*")[0.1,1.0)("\s*\))
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ^
	at se.patrikerdes.UseLatestVersionsTask.updateModuleVersions(UseLatestVersionsTask.groovy:97)
	at se.patrikerdes.UseLatestVersionsTask.useLatestVersions(UseLatestVersionsTask.groovy:66)

I am new to both your plugin and the upstream gradle-versions-plugin so I'm not sure where the bug lies; should the report never contain a range there?

Unfortunately I've not been able to make a simple reproducing project; I haven't been able to convince gradle-versions-plugin to produce such a report.

@patrikerdes
Copy link
Owner

I'm confused, because when I add a version range in my build.gradle file, I don't get a range as version in the report.json file. And I'm actually not sure if it is a bug in the gradle-versions-plugin or in my plugin. I don't really feel confident fixing it without knowing how and why it happens. So if you or anyone else could find a reproducible case, that would be great.

@isker
Copy link
Contributor Author

isker commented Jun 29, 2019

Yes, it's not simply reproducible like that. I tried to debug gradle-versions-plugin on my closed-source project to understand why but was not making good progress.

Here's something to consider: is there anything that restricts valid maven versions, groupIds, or artifactIds to strings that do not need to be regex quoted? I could find no documentation on what characters are valid in these values. But it might be a good idea to quote values going into these regexes in https://github.com/patrikerdes/gradle-use-latest-versions-plugin/blob/master/src/main/groovy/se/patrikerdes/DependencyUpdate.groovy regardless of my specific version range problem.

@patrikerdes
Copy link
Owner

patrikerdes commented Jun 29, 2019

Does this look like what you had in mind? #26
Do you think it would it solve your problem? If yes, I'd be happy to merge it.

@isker
Copy link
Contributor Author

isker commented Jun 29, 2019

Precisely. Thanks!

@patrikerdes
Copy link
Owner

It's merged.

@patrikerdes
Copy link
Owner

The fix is now available in release 0.2.11.

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

No branches or pull requests

2 participants