Skip to content

Commit

Permalink
Revert SnakeYAML changes (#13337)
Browse files Browse the repository at this point in the history
* Revert SnakeYAML changes

Revert "Add SnakeYAML BOM (#13245)"
- This reverts commit 002557c.

Revert "Upgrade snakeyaml, micronaut, spring and spring boot (#13194)"
- This reverts commit 0c86bf7.
- This reverts commit b047374.

* Fix Groovy artifactory snapshots repository URL
  • Loading branch information
guillermocalvo authored Jan 8, 2024
1 parent 8d251cc commit 184c6ff
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 31 deletions.
10 changes: 2 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ ext {
names : ['grails-async', 'grails-events'],
modules: ['gpars', 'rxjava', 'rxjava2']
],
snakeyaml: [
version: snakeyamlVersion,
group : 'org.yaml',
names: ['snakeyaml'],
modules: ['']
],
spock: [
version: spockVersion,
group : 'org.spockframework',
Expand Down Expand Up @@ -239,8 +233,8 @@ allprojects {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
if(groovyVersion.endsWith('-SNAPSHOT')) {
maven {
name 'JFrog OSS snapshot repo'
url 'https://oss.jfrog.org/oss-snapshot-local/'
name 'Groovy artifactory snapshots repository'
url 'https://groovy.jfrog.io/artifactory/libs-snapshot-local/'
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ methvinDirectoryWatcherVersion=0.18.0
micronautCacheVersion=3.5.0
micronautRuntimeGroovyVersion=3.0.0
micronautSpringVersion=4.5.0
micronautVersion=3.8.8
micronautVersion=3.8.5
mongodbJavaDriverVersion=4.5.0
objenesisVersion=3.3
scaffoldingCoreVersion=2.1.0
servletApiVersion=4.0.1
slf4jVersion=1.7.36
snakeyamlVersion=2.2
spockVersion=2.1-groovy-3.0
springBootVersion=2.7.10
springBootVersion=2.7.9
springLoadedVersion=1.2.8.RELEASE
springVersion=5.3.26
springVersion=5.3.25
testingSupportVersion=2.4.1
testingSupportVersionForTests=2.6.1
tomcatLog4jVersion=8.5.2
Expand Down
2 changes: 1 addition & 1 deletion grails-bootstrap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
dependencies {
api ( "org.codehaus.groovy:groovy-xml:$groovyVersion" )
api ( "org.codehaus.groovy:groovy-templates:$groovyVersion" )
api "org.yaml:snakeyaml"
api "org.yaml:snakeyaml:1.33"
api "io.micronaut:micronaut-inject:$micronautVersion"

compileOnly("io.methvin:directory-watcher:$methvinDirectoryWatcherVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ 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.LoaderOptions
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.SafeConstructor

Expand Down Expand Up @@ -155,7 +154,7 @@ class CodeGenConfig implements Cloneable, ConfigMap {

@CompileDynamic // fails with CompileStatic!
void loadYml(InputStream input) {
Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()))
Yaml yaml = new Yaml(new SafeConstructor())
for(Object yamlObject : yaml.loadAll(input)) {
if(yamlObject instanceof Map) { // problem here with CompileStatic
mergeMap((Map)yamlObject)
Expand Down
2 changes: 1 addition & 1 deletion grails-docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
"org.slf4j:jcl-over-slf4j:$slf4jVersion",
"org.apache.ant:ant:$antVersion",
'org.grails:grails-gdoc-engine:1.0.1',
'org.yaml:snakeyaml:2.2',
'org.yaml:snakeyaml:1.33',
"org.codehaus.groovy:groovy-ant:$groovyVersion"

api 'org.asciidoctor:asciidoctorj:2.5.7'
Expand Down
5 changes: 2 additions & 3 deletions grails-docs/src/main/groovy/grails/doc/DocPublisher.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import org.apache.commons.logging.LogFactory
import org.radeox.api.engine.WikiRenderEngine
import org.radeox.engine.context.BaseInitialRenderContext
import org.radeox.engine.context.BaseRenderContext
import org.yaml.snakeyaml.LoaderOptions
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.SafeConstructor

Expand Down Expand Up @@ -266,7 +265,7 @@ class DocPublisher {
def legacyLinks = [:]
if (legacyLinksFile.exists()) {
legacyLinksFile.withInputStream { input ->
legacyLinks = new Yaml(new SafeConstructor(new LoaderOptions())).load(input)
legacyLinks = new Yaml(new SafeConstructor()).load(input)
}
}

Expand Down Expand Up @@ -538,7 +537,7 @@ class DocPublisher {
}
else if(propertiesFile.name.endsWith('.yml')) {
propertiesFile.withInputStream { input ->
def ymls = new Yaml(new SafeConstructor(new LoaderOptions())).loadAll(input)
def ymls = new Yaml(new SafeConstructor()).loadAll(input)
for(yml in ymls) {
if(yml instanceof Map) {
def config = yml.grails?.doc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package grails.doc.internal

import org.yaml.snakeyaml.LoaderOptions
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.SafeConstructor

/**
* Class representing a Grails user guide table of contents defined in YAML.
*/
class YamlTocStrategy {
private final parser = new Yaml(new SafeConstructor(new LoaderOptions()))
private final parser = new Yaml(new SafeConstructor())
private resourceChecker
private String ext = ".gdoc"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ 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
Expand All @@ -38,7 +37,7 @@ abstract class MapReadingCachedGradleOperation <V> extends CachedGradleOperation
@Override
Map<String, V> readFromCached(File f) {
def map = (Map<String, Object>) f.withReader { BufferedReader r ->
new Yaml(new SafeConstructor(new LoaderOptions())).load(r)
new Yaml(new SafeConstructor()).load(r)
}
Map<String, V> newMap = [:]

Expand All @@ -62,7 +61,7 @@ abstract class MapReadingCachedGradleOperation <V> extends CachedGradleOperation
return [(key):val.toString()]
}
}
new Yaml(new SafeConstructor(new LoaderOptions()), new Representer(options), options).dump(toWrite, writer)
new Yaml(new SafeConstructor(), new Representer(), options).dump(toWrite, writer)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ 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

Expand Down Expand Up @@ -111,7 +110,7 @@ abstract class AbstractProfile implements Profile {

protected void initialize() {
def profileYml = profileDir.createRelative("profile.yml")
Map<String, Object> profileConfig = new Yaml(new SafeConstructor(new LoaderOptions())).<Map<String, Object>> load(profileYml.getInputStream())
Map<String, Object> profileConfig = new Yaml(new SafeConstructor()).<Map<String, Object>> load(profileYml.getInputStream())

name = profileConfig.get("name")?.toString()
description = profileConfig.get("description")?.toString() ?: ''
Expand Down Expand Up @@ -141,7 +140,7 @@ abstract class AbstractProfile implements Profile {
else if(fileName.endsWith('.yml')) {
def yamlCommand = profileDir.createRelative("commands/$fileName")
if(yamlCommand.exists()) {
Map<String, Object> data = new Yaml(new SafeConstructor(new LoaderOptions())).<Map>load(yamlCommand.getInputStream())
Map<String, Object> data = new Yaml(new SafeConstructor()).<Map>load(yamlCommand.getInputStream())
Command cmd = new DefaultMultiStepCommand(clsName.toString(), this, data)
Object minArguments = data?.minArguments
cmd.minArguments = minArguments instanceof Integer ? (Integer)minArguments : 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ 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

Expand Down Expand Up @@ -51,7 +50,7 @@ class DefaultFeature implements Feature {
this.name = name
this.location = location
def featureYml = location.createRelative("feature.yml")
Map<String, Object> featureConfig = new Yaml(new SafeConstructor(new LoaderOptions())).<Map<String, Object>>load(featureYml.getInputStream())
Map<String, Object> featureConfig = new Yaml(new SafeConstructor()).<Map<String, Object>>load(featureYml.getInputStream())
configuration.merge(featureConfig)
def dependenciesConfig = configuration.get("dependencies")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ 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

Expand All @@ -37,7 +36,7 @@ import java.util.regex.Pattern
*/
@CompileStatic
class YamlCommandFactory extends ResourceResolvingCommandFactory<Map> {
protected Yaml yamlParser=new Yaml(new SafeConstructor(new LoaderOptions()))
protected Yaml yamlParser=new Yaml(new SafeConstructor())
// 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)

Expand Down

0 comments on commit 184c6ff

Please sign in to comment.