jamesfredley commented on code in PR #15598:
URL: https://github.com/apache/grails-core/pull/15598#discussion_r3140106354
##########
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:
Refactoring this to be cleaner.
--
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]