jamesfredley commented on code in PR #15598:
URL: https://github.com/apache/grails-core/pull/15598#discussion_r3140253072
##########
grails-wrapper/src/main/java/grails/init/GrailsVersion.java:
##########
@@ -138,29 +193,18 @@ public static GrailsVersion getPreferredGrailsVersion() {
System.exit(1);
}
- if (!properties.containsKey("grailsVersion")) {
+ if (!properties.containsKey(GRAILS_VERSION_PROPERTY)) {
return null;
}
- String grailsVersion = properties.getProperty("grailsVersion");
- if (grailsVersion == null) {
- String overrideGrailsVersion =
System.getenv("PREFERRED_GRAILS_VERSION");
- if (overrideGrailsVersion != null) {
- try {
- return new GrailsVersion(overrideGrailsVersion);
- } catch (Exception e) {
- System.out.println("An invalid Grails Version [" +
overrideGrailsVersion + "] was specified in PREFERRED_GRAILS_VERSION");
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- System.out.println("gradle.properties does not contain
grailsVersion; assuming latest Grails Version");
- return null;
+ String grailsVersion = properties.getProperty(GRAILS_VERSION_PROPERTY);
+ if (grailsVersion == null || grailsVersion.trim().isEmpty()) {
+ System.out.println("A blank Grails Version was specified in
gradle.properties for key [" + GRAILS_VERSION_PROPERTY + "]");
+ System.exit(1);
}
try {
- return new GrailsVersion(grailsVersion);
+ return new GrailsVersion(grailsVersion.trim());
Review Comment:
Force-pushed; the earlier `fd73cf35f2` reply is stale. The `.trim()` hoist
is now in `d734d4317b`, which also drops the three blank-`grailsVersion`
data-rows that were failing `:grails-wrapper:test` on every JDK 21+ matrix cell
(ubuntu-21/25, macos-21, windows-25). They relied on
`SystemStubs.catchSystemExit` -> `System.setSecurityManager` - an API JEP 411
deprecated in JDK 17 and JEP 486 removes entirely in JDK 24+. No
version-portable substitute exists without changing production code solely for
testability, so the tests go; the fail-fast production behaviour from
791866172a is preserved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]