diff --git a/build.gradle b/build.gradle index f31ffb8b7d9..1505cf96e25 100644 --- a/build.gradle +++ b/build.gradle @@ -311,13 +311,6 @@ subprojects { project -> documentation } - configurations { - all { - /*Spring framework {@link org.springframework.beans.factory.config.*/ - resolutionStrategy.force 'org.yaml:snakeyaml:1.33' - } - } - ext.isTestSuite = project.name.startsWith("grails-test-suite") ext.isCiBuild = project.hasProperty("isCiBuild") || System.getenv().get("CI") as Boolean ext.pomInfo = { diff --git a/grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java b/grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java index ed9229fad55..bb1b210b17e 100644 --- a/grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java +++ b/grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java @@ -627,6 +627,7 @@ static String convertValidPropertyMethodSuffix(String suffix) { * @return true if it is a javabean property getter * @deprecated use {@link #isGetter(String, Class, Class[])} instead because this method has a defect for "is.." method with Boolean return types. */ + @Deprecated public static boolean isGetter(String name, Class[] args) { return isGetter(name, boolean.class, args); } diff --git a/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy b/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy index 6eb21bc4e37..8083efdead3 100644 --- a/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy +++ b/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy @@ -22,8 +22,11 @@ import groovy.transform.CompileDynamic import groovy.transform.CompileStatic import org.codehaus.groovy.runtime.DefaultGroovyMethods import org.codehaus.groovy.runtime.typehandling.GroovyCastException +import org.yaml.snakeyaml.DumperOptions +import org.yaml.snakeyaml.LoaderOptions import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.SafeConstructor +import org.yaml.snakeyaml.representer.Representer /** @@ -154,7 +157,7 @@ class CodeGenConfig implements Cloneable, ConfigMap { @CompileDynamic // fails with CompileStatic! void loadYml(InputStream input) { - Yaml yaml = new Yaml(new SafeConstructor()) + Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())) for(Object yamlObject : yaml.loadAll(input)) { if(yamlObject instanceof Map) { // problem here with CompileStatic mergeMap((Map)yamlObject) diff --git a/grails-shell/src/main/groovy/org/grails/cli/gradle/cache/MapReadingCachedGradleOperation.groovy b/grails-shell/src/main/groovy/org/grails/cli/gradle/cache/MapReadingCachedGradleOperation.groovy index b1460c97847..fa0adaef5cc 100644 --- a/grails-shell/src/main/groovy/org/grails/cli/gradle/cache/MapReadingCachedGradleOperation.groovy +++ b/grails-shell/src/main/groovy/org/grails/cli/gradle/cache/MapReadingCachedGradleOperation.groovy @@ -20,6 +20,7 @@ import groovy.transform.CompileStatic import groovy.transform.InheritConstructors import org.gradle.tooling.ProjectConnection import org.yaml.snakeyaml.DumperOptions +import org.yaml.snakeyaml.LoaderOptions import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.SafeConstructor import org.yaml.snakeyaml.representer.Representer @@ -37,7 +38,7 @@ abstract class MapReadingCachedGradleOperation extends CachedGradleOperation @Override Map readFromCached(File f) { def map = (Map) f.withReader { BufferedReader r -> - new Yaml(new SafeConstructor()).load(r) + new Yaml(new SafeConstructor(new LoaderOptions())).load(r) } Map newMap = [:] @@ -61,7 +62,7 @@ abstract class MapReadingCachedGradleOperation extends CachedGradleOperation return [(key):val.toString()] } } - new Yaml(new SafeConstructor(), new Representer(), options).dump(toWrite, writer) + new Yaml(new SafeConstructor(new LoaderOptions()), new Representer(options), options).dump(toWrite, writer) } } diff --git a/grails-shell/src/main/groovy/org/grails/cli/profile/AbstractProfile.groovy b/grails-shell/src/main/groovy/org/grails/cli/profile/AbstractProfile.groovy index f47c9cb1fd6..d3c1f1994b6 100644 --- a/grails-shell/src/main/groovy/org/grails/cli/profile/AbstractProfile.groovy +++ b/grails-shell/src/main/groovy/org/grails/cli/profile/AbstractProfile.groovy @@ -33,6 +33,7 @@ import org.grails.cli.profile.commands.DefaultMultiStepCommand import org.grails.cli.profile.commands.script.GroovyScriptCommand import org.grails.config.NavigableMap import org.grails.io.support.Resource +import org.yaml.snakeyaml.LoaderOptions import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.SafeConstructor @@ -110,7 +111,7 @@ abstract class AbstractProfile implements Profile { protected void initialize() { def profileYml = profileDir.createRelative("profile.yml") - Map profileConfig = new Yaml(new SafeConstructor()).> load(profileYml.getInputStream()) + Map profileConfig = new Yaml(new SafeConstructor(new LoaderOptions())).> load(profileYml.getInputStream()) name = profileConfig.get("name")?.toString() description = profileConfig.get("description")?.toString() ?: '' @@ -140,7 +141,7 @@ abstract class AbstractProfile implements Profile { else if(fileName.endsWith('.yml')) { def yamlCommand = profileDir.createRelative("commands/$fileName") if(yamlCommand.exists()) { - Map data = new Yaml(new SafeConstructor()).load(yamlCommand.getInputStream()) + Map data = new Yaml(new SafeConstructor(new LoaderOptions())).load(yamlCommand.getInputStream()) Command cmd = new DefaultMultiStepCommand(clsName.toString(), this, data) Object minArguments = data?.minArguments cmd.minArguments = minArguments instanceof Integer ? (Integer)minArguments : 1 diff --git a/grails-shell/src/main/groovy/org/grails/cli/profile/DefaultFeature.groovy b/grails-shell/src/main/groovy/org/grails/cli/profile/DefaultFeature.groovy index 59fba494508..b5e14277d84 100644 --- a/grails-shell/src/main/groovy/org/grails/cli/profile/DefaultFeature.groovy +++ b/grails-shell/src/main/groovy/org/grails/cli/profile/DefaultFeature.groovy @@ -22,6 +22,7 @@ import groovy.transform.ToString import org.eclipse.aether.graph.Dependency import org.grails.config.NavigableMap import org.grails.io.support.Resource +import org.yaml.snakeyaml.LoaderOptions import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.SafeConstructor @@ -50,7 +51,7 @@ class DefaultFeature implements Feature { this.name = name this.location = location def featureYml = location.createRelative("feature.yml") - Map featureConfig = new Yaml(new SafeConstructor()).>load(featureYml.getInputStream()) + Map featureConfig = new Yaml(new SafeConstructor(new LoaderOptions())).>load(featureYml.getInputStream()) configuration.merge(featureConfig) def dependenciesConfig = configuration.get("dependencies") diff --git a/grails-shell/src/main/groovy/org/grails/cli/profile/commands/factory/YamlCommandFactory.groovy b/grails-shell/src/main/groovy/org/grails/cli/profile/commands/factory/YamlCommandFactory.groovy index 15c37483c2c..02a71a73e20 100644 --- a/grails-shell/src/main/groovy/org/grails/cli/profile/commands/factory/YamlCommandFactory.groovy +++ b/grails-shell/src/main/groovy/org/grails/cli/profile/commands/factory/YamlCommandFactory.groovy @@ -22,6 +22,7 @@ import org.grails.cli.profile.Command import org.grails.cli.profile.Profile import org.grails.cli.profile.commands.DefaultMultiStepCommand import org.grails.io.support.Resource +import org.yaml.snakeyaml.LoaderOptions import org.yaml.snakeyaml.Yaml import org.yaml.snakeyaml.constructor.SafeConstructor @@ -36,7 +37,7 @@ import java.util.regex.Pattern */ @CompileStatic class YamlCommandFactory extends ResourceResolvingCommandFactory { - protected Yaml yamlParser=new Yaml(new SafeConstructor()) + protected Yaml yamlParser=new Yaml(new SafeConstructor(new LoaderOptions())) // LAX parser for JSON: http://mrhaki.blogspot.ie/2014/08/groovy-goodness-relax-groovy-will-parse.html protected JsonSlurper jsonSlurper = new JsonSlurper().setType(JsonParserType.LAX) diff --git a/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java b/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java index 7b0e44527e5..812968bac87 100644 --- a/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java +++ b/grails-web-common/src/main/groovy/org/grails/web/util/WebUtils.java @@ -197,6 +197,7 @@ public static View resolveView(HttpServletRequest request, String viewName, Stri /** * @deprecated Does not take into account the url converter */ + @Deprecated public static String addViewPrefix(String viewName) { GrailsWebRequest webRequest = GrailsWebRequest.lookup(); return addViewPrefix(viewName, webRequest != null ? webRequest.getControllerName() : null);