From c72ecdc8af3c183b21c227bd550684b076a203fe Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 14 Jul 2021 05:55:54 +0000 Subject: [PATCH 01/14] Bump commons-io from 2.10.0 to 2.11.0 Bumps commons-io from 2.10.0 to 2.11.0. Signed-off-by: dependabot-preview[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index affbc06c685..b9ff031ed4f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath "commons-io:commons-io:2.10.0" + classpath "commons-io:commons-io:2.11.0" classpath "io.github.gradle-nexus:publish-plugin:1.1.0" classpath "com.netflix.nebula:gradle-extra-configurations-plugin:2.2.0" classpath "com.github.adrianbk:gradle-travisci-trigger-plugin:1.0.0" From b88737d34444d910679ea29463b67713cabcc18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Mon, 25 Oct 2021 15:34:01 +0200 Subject: [PATCH 02/14] Suggested fix for #12150: SimpleDataBinder fails when target class and embedded class implements interfaces --- .../databinding/SimpleDataBinder.groovy | 67 ++++++++++--------- .../databinding/SimpleDataBinderSpec.groovy | 57 ++++++++++++---- 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy b/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy index f57a708c445..418c8156087 100755 --- a/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy +++ b/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy @@ -105,7 +105,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @see DataBindingSource @@ -115,7 +115,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @param listener A listener which will be notified of data binding events triggered @@ -128,11 +128,11 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @see DataBindingSource */ @@ -141,14 +141,14 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @param blackList A list of properties names to be excluded during - * this data binding. + * this data binding. * @see DataBindingSource */ void bind(obj, DataBindingSource source, List whiteList, List blackList) { @@ -156,9 +156,9 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to - * @param gpath A GPathResult which represents the data being bound. + * @param gpath A GPathResult which represents the data being bound. * @see DataBindingSource */ void bind(obj, GPathResult gpath) { @@ -166,7 +166,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @param filter Only properties beginning with filter will be included in the @@ -174,11 +174,11 @@ class SimpleDataBinder implements DataBinder { * source contains data for properties "person.name" and "author.name" * the value of "person.name" will be bound to obj.name. The value of * "author.name" will be ignored. - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @param blackList A list of properties names to be excluded during - * this data binding. + * this data binding. * @see DataBindingSource */ void bind(obj, DataBindingSource source, String filter, List whiteList, List blackList) { @@ -186,7 +186,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @param filter Only properties beginning with filter will be included in the @@ -194,11 +194,11 @@ class SimpleDataBinder implements DataBinder { * source contains data for properties "person.name" and "author.name" * the value of "person.name" will be bound to obj.name. The value of * "author.name" will be ignored. - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @param blackList A list of properties names to be excluded during - * this data binding. + * this data binding. * @param listener A listener which will be notified of data binding events triggered * by this binding * @see DataBindingSource @@ -376,7 +376,7 @@ class SimpleDataBinder implements DataBinder { } } - + @CompileStatic(TypeCheckingMode.SKIP) protected initializeArray(obj, String propertyName, Class arrayType, int index) { Object[] array = obj[propertyName] @@ -395,8 +395,8 @@ class SimpleDataBinder implements DataBinder { protected boolean isBasicType(Class c) { BASIC_TYPES.contains(c) || c.isPrimitive() } - - + + protected Class getReferencedTypeForCollectionInClass(String propertyName, Class clazz) { Class referencedType def field = getField(clazz, propertyName) @@ -465,7 +465,7 @@ class SimpleDataBinder implements DataBinder { } return (Collection)val } - + protected getDefaultCollectionInstanceForType(Class type) { def val if (List.isAssignableFrom(type)) { @@ -540,7 +540,7 @@ class SimpleDataBinder implements DataBinder { } converter } - + /** * @param annotation An instance of grails.databinding.BindingUsing or org.grails.databinding.BindingUsing * @return the value Class of the annotation @@ -553,7 +553,7 @@ class SimpleDataBinder implements DataBinder { } value } - + /** * @param annotation An instance of grails.databinding.BindingFormat or org.grails.databinding.BindingFormat * @return the value String of the annotation @@ -595,7 +595,7 @@ class SimpleDataBinder implements DataBinder { enumClass.valueOf(value) } catch (IllegalArgumentException iae) {} } - + protected preprocessValue(propertyValue) { propertyValue } @@ -611,10 +611,10 @@ class SimpleDataBinder implements DataBinder { } } } - + setPropertyValue obj, source, metaProperty, propertyValue, listener, convertCollectionElements } - + protected setPropertyValue(obj, DataBindingSource source, MetaProperty metaProperty, propertyValue, DataBindingListener listener, boolean convertCollectionElements) { def propName = metaProperty.name def propertyType @@ -622,6 +622,9 @@ class SimpleDataBinder implements DataBinder { if (metaProperty instanceof MetaBeanProperty) { def mbp = (MetaBeanProperty)metaProperty propertyType = mbp.getter?.returnType ?: mbp.field?.type + if(propertyType?.interface) { + propertyType = mbp.field?.type + } propertyGetter = mbp.getter } if (propertyType == null || propertyType == Object) { @@ -744,9 +747,9 @@ class SimpleDataBinder implements DataBinder { } else{ obj[propName] = propertyType.newInstance() - } + } } - + protected ValueInitializer getPropertyInitializer(obj, String propName){ def initializer = getValueInitializerForField obj, propName initializer @@ -771,7 +774,7 @@ class SimpleDataBinder implements DataBinder { initializer } /** - * @param annotation An instance of grails.databinding.BindInitializer + * @param annotation An instance of grails.databinding.BindInitializer * @return the value Class of the annotation */ protected Class getValueOfBindInitializer(Annotation annotation) { @@ -782,7 +785,7 @@ class SimpleDataBinder implements DataBinder { } value } - + protected convert(Class typeToConvertTo, value) { if (value == null || typeToConvertTo.isAssignableFrom(value?.getClass())) { return value diff --git a/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy b/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy index 25c9b08ecd7..30c6d926bba 100755 --- a/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy +++ b/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy @@ -141,17 +141,17 @@ class SimpleDataBinderSpec extends Specification { obj.sqlDate == nowSqlDate obj.calendar == nowCalendar } - + @Issue('GRAILS-10925') void 'Test binding a Date to a Date property marked with @BindingFormat'() { given: def binder = new SimpleDataBinder() def obj = new DateContainer() def nowDate = new Date() - + when: binder.bind obj, [formattedUtilDate: nowDate] as SimpleMapDataBindingSource - + then: obj.formattedUtilDate == nowDate } @@ -519,44 +519,44 @@ class SimpleDataBinderSpec extends Specification { widget.names[1] == null widget.names[2] == 'two' } - + void 'Test @BindUsing on a List'() { given: def binder = new SimpleDataBinder() def widget = new Widget() - + when: binder.bind widget, [listOfIntegers: '4'] as SimpleMapDataBindingSource - + then: widget.listOfIntegers == [0, 1, 2, 3] } - + @Issue('GRAILS-10853') void 'Test adding new elements to a Set using indexed properties'() { given: def binder = new SimpleDataBinder() def widget = new Widget() - + when: binder.bind widget, ['factories[2]': [name: 'Tres'], 'factories[0]': [name: 'Uno'], 'factories[1]': [name: 'Dos']] as SimpleMapDataBindingSource - + then: widget.factories.size() == 3 widget.factories.find { it.name == 'Uno' } widget.factories.find { it.name == 'Dos' } widget.factories.find { it.name == 'Tres' } } - + @Issue('GRAILS-10865') void 'Test binding to an inherited typed collection'() { given: def binder = new SimpleDataBinder() def obj = new ClassWithInheritedTypedCollection() - + when: binder.bind obj, [list: ['1', '2', '3'], 'map[one]': '1', 'map[two]': '2' ] as SimpleMapDataBindingSource - + then: obj.list == [1, 2, 3] obj.map.one == 1 @@ -612,6 +612,22 @@ class SimpleDataBinderSpec extends Specification { comment.attachments.find { it.filename == 'foo.txt' } comment.attachments.find { it.filename == 'bar.txt' } } + + @Issue('https://github.com/grails/grails-core/issues/12150') + void 'binding when class and embedded classes both implements an interface'() { + given: + SimpleDataBinder binder = new SimpleDataBinder() + + and: + SimpleMapDataBindingSource input = [a: [data: 'abc']] as SimpleMapDataBindingSource + ClassB classWithInterface = new ClassB() + + when: + binder.bind(classWithInterface, input) + + then: + classWithInterface.a.data == 'abc' + } } class Factory { @@ -632,7 +648,7 @@ class Widget { byte[] byteArray Integer[] integers List names - @BindUsing({ obj, source -> + @BindUsing({ obj, source -> def cnt = source['listOfIntegers'] as int def result = [] cnt.times { result << it } @@ -688,3 +704,18 @@ class Attachment { String filename } +interface InterfaceA { + String getData() +} + +interface InterfaceB { + InterfaceA getA() +} + +class ClassA implements InterfaceA { + String data +} + +class ClassB implements InterfaceB { + ClassA a +} From 7011454edb776746d1531cf6bdb20cf7de7168e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Oct 2021 07:14:07 +0000 Subject: [PATCH 03/14] Bump jnr-posix from 3.1.9 to 3.1.11 Bumps [jnr-posix](https://github.com/jnr/jnr-posix) from 3.1.9 to 3.1.11. - [Release notes](https://github.com/jnr/jnr-posix/releases) - [Commits](https://github.com/jnr/jnr-posix/compare/jnr-posix-3.1.9...jnr-posix-3.1.11) --- updated-dependencies: - dependency-name: com.github.jnr:jnr-posix dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- grails-shell/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grails-shell/build.gradle b/grails-shell/build.gradle index cc8dba800d3..e782a6bc4f5 100644 --- a/grails-shell/build.gradle +++ b/grails-shell/build.gradle @@ -27,7 +27,7 @@ dependencies { } testCompile "net.sf.expectit:expectit-core:0.9.0" - testCompile "com.github.jnr:jnr-posix:3.1.9" + testCompile "com.github.jnr:jnr-posix:3.1.11" runtime "org.slf4j:slf4j-simple:$slf4jVersion" runtime "org.codehaus.plexus:plexus-component-api:1.0-alpha-33" From d73b83a095b37a916a1c528d1fe71c558216b30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Fri, 29 Oct 2021 14:27:00 +0200 Subject: [PATCH 04/14] Suggested fix for #12150: SimpleDataBinder fails when target class and embedded class implements interfaces or abstract class --- .../databinding/SimpleDataBinder.groovy | 3 ++- .../databinding/SimpleDataBinderSpec.groovy | 26 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy b/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy index 418c8156087..a88aadb6549 100755 --- a/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy +++ b/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy @@ -32,6 +32,7 @@ import org.grails.databinding.xml.GPathResultMap import java.lang.annotation.Annotation import java.lang.reflect.Array import java.lang.reflect.Field +import java.lang.reflect.Modifier import java.lang.reflect.ParameterizedType /** @@ -622,7 +623,7 @@ class SimpleDataBinder implements DataBinder { if (metaProperty instanceof MetaBeanProperty) { def mbp = (MetaBeanProperty)metaProperty propertyType = mbp.getter?.returnType ?: mbp.field?.type - if(propertyType?.interface) { + if(propertyType && (propertyType.interface || Modifier.isAbstract(propertyType.modifiers))) { propertyType = mbp.field?.type } propertyGetter = mbp.getter diff --git a/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy b/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy index 30c6d926bba..a839bd865cb 100755 --- a/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy +++ b/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy @@ -614,7 +614,7 @@ class SimpleDataBinderSpec extends Specification { } @Issue('https://github.com/grails/grails-core/issues/12150') - void 'binding when class and embedded classes both implements an interface'() { + void 'Test binding when class and embedded classes both implements an interface'() { given: SimpleDataBinder binder = new SimpleDataBinder() @@ -628,6 +628,22 @@ class SimpleDataBinderSpec extends Specification { then: classWithInterface.a.data == 'abc' } + + @Issue('https://github.com/grails/grails-core/issues/12150') + void 'Test binding when class and embedded classes extends abstract class and implements an interface'() { + given: + SimpleDataBinder binder = new SimpleDataBinder() + + and: + SimpleMapDataBindingSource input = [a: [data: 'abc']] as SimpleMapDataBindingSource + FromAbstractB fromAbstractB = new FromAbstractB() + + when: + binder.bind(fromAbstractB, input) + + then: + fromAbstractB.a.data == 'abc' + } } class Factory { @@ -719,3 +735,11 @@ class ClassA implements InterfaceA { class ClassB implements InterfaceB { ClassA a } + +class AbstractB { + ClassA a +} + +class FromAbstractB extends AbstractB { + +} From 2ba7176669cb441c4e422647eeed3814d39c1f2d Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 12 Nov 2021 14:37:26 +0530 Subject: [PATCH 05/14] Update Java CI Workflow To only publish reports when there is a failure --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 86b213bb26a..4ff5214f2ed 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -43,6 +43,7 @@ jobs: ./gradlew --stop (set -x; ./gradlew check -x grails-test-suite-persistence:test -x grails-test-suite-uber:test -x grails-test-suite-web:test --no-daemon) - name: Publish Test Report + if: failure() uses: scacap/action-surefire-report@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} From bc44170065dd47d1b01000085972e47bec64cffe Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 12 Nov 2021 15:20:23 +0530 Subject: [PATCH 06/14] Added Gradle Test Retry Plugin to identify flanky tests --- build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.gradle b/build.gradle index affbc06c685..fe84712889a 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ buildscript { classpath "javax.xml.bind:jaxb-api:$jaxbVersion" classpath "com.sun.xml.bind:jaxb-impl:$jaxbVersion" classpath "org.codehaus.groovy.modules.http-builder:http-builder:0.7.2" + classpath "org.gradle:test-retry-gradle-plugin:1.3.1" } } @@ -323,6 +324,7 @@ subprojects { project -> apply plugin: 'project-report' apply plugin: 'provided-base' apply plugin: 'optional-base' + apply plugin: "org.gradle.test-retry" if (!isTestSuite) { @@ -487,6 +489,11 @@ subprojects { project -> '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] test { + retry { + maxRetries = 2 + maxFailures = 20 + failOnPassedAfterRetry = true + } excludes = ["**/*TestCase.class", "**/*\$*.class"] if (isTravisBuild) { maxParallelForks = 2 From 524831ebdeea101a0b66d17a48d7dbbfed9f1554 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 12 Nov 2021 18:21:14 +0530 Subject: [PATCH 07/14] Enable Java CI Workflow Dispatch --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 86b213bb26a..c9c2d412357 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -10,6 +10,7 @@ on: - master - '[4-9]+.[0-9]+.x' - '[3-9]+.[3-9]+.x' + workflow_dispatch: jobs: build: runs-on: ubuntu-latest From 0afe4a9759c70e42c02ec30e39cf95a37e992d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Fri, 12 Nov 2021 16:09:59 +0100 Subject: [PATCH 08/14] Suggested fix for #12150: Roll-back white-space changes --- .../databinding/SimpleDataBinder.groovy | 64 +++++++++---------- .../databinding/SimpleDataBinderSpec.groovy | 26 ++++---- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy b/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy index a88aadb6549..f49f356ea98 100755 --- a/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy +++ b/grails-databinding/src/main/groovy/grails/databinding/SimpleDataBinder.groovy @@ -106,7 +106,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @see DataBindingSource @@ -116,7 +116,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @param listener A listener which will be notified of data binding events triggered @@ -129,11 +129,11 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @see DataBindingSource */ @@ -142,14 +142,14 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @param blackList A list of properties names to be excluded during - * this data binding. + * this data binding. * @see DataBindingSource */ void bind(obj, DataBindingSource source, List whiteList, List blackList) { @@ -157,9 +157,9 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to - * @param gpath A GPathResult which represents the data being bound. + * @param gpath A GPathResult which represents the data being bound. * @see DataBindingSource */ void bind(obj, GPathResult gpath) { @@ -167,7 +167,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @param filter Only properties beginning with filter will be included in the @@ -175,11 +175,11 @@ class SimpleDataBinder implements DataBinder { * source contains data for properties "person.name" and "author.name" * the value of "person.name" will be bound to obj.name. The value of * "author.name" will be ignored. - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @param blackList A list of properties names to be excluded during - * this data binding. + * this data binding. * @see DataBindingSource */ void bind(obj, DataBindingSource source, String filter, List whiteList, List blackList) { @@ -187,7 +187,7 @@ class SimpleDataBinder implements DataBinder { } /** - * + * * @param obj The object being bound to * @param source The data binding source * @param filter Only properties beginning with filter will be included in the @@ -195,11 +195,11 @@ class SimpleDataBinder implements DataBinder { * source contains data for properties "person.name" and "author.name" * the value of "person.name" will be bound to obj.name. The value of * "author.name" will be ignored. - * @param whiteList A list of property names to be included during this - * data binding. All other properties represented in the binding source + * @param whiteList A list of property names to be included during this + * data binding. All other properties represented in the binding source * will be ignored * @param blackList A list of properties names to be excluded during - * this data binding. + * this data binding. * @param listener A listener which will be notified of data binding events triggered * by this binding * @see DataBindingSource @@ -377,7 +377,7 @@ class SimpleDataBinder implements DataBinder { } } - + @CompileStatic(TypeCheckingMode.SKIP) protected initializeArray(obj, String propertyName, Class arrayType, int index) { Object[] array = obj[propertyName] @@ -396,8 +396,8 @@ class SimpleDataBinder implements DataBinder { protected boolean isBasicType(Class c) { BASIC_TYPES.contains(c) || c.isPrimitive() } - - + + protected Class getReferencedTypeForCollectionInClass(String propertyName, Class clazz) { Class referencedType def field = getField(clazz, propertyName) @@ -466,7 +466,7 @@ class SimpleDataBinder implements DataBinder { } return (Collection)val } - + protected getDefaultCollectionInstanceForType(Class type) { def val if (List.isAssignableFrom(type)) { @@ -541,7 +541,7 @@ class SimpleDataBinder implements DataBinder { } converter } - + /** * @param annotation An instance of grails.databinding.BindingUsing or org.grails.databinding.BindingUsing * @return the value Class of the annotation @@ -554,7 +554,7 @@ class SimpleDataBinder implements DataBinder { } value } - + /** * @param annotation An instance of grails.databinding.BindingFormat or org.grails.databinding.BindingFormat * @return the value String of the annotation @@ -596,7 +596,7 @@ class SimpleDataBinder implements DataBinder { enumClass.valueOf(value) } catch (IllegalArgumentException iae) {} } - + protected preprocessValue(propertyValue) { propertyValue } @@ -612,10 +612,10 @@ class SimpleDataBinder implements DataBinder { } } } - + setPropertyValue obj, source, metaProperty, propertyValue, listener, convertCollectionElements } - + protected setPropertyValue(obj, DataBindingSource source, MetaProperty metaProperty, propertyValue, DataBindingListener listener, boolean convertCollectionElements) { def propName = metaProperty.name def propertyType @@ -748,9 +748,9 @@ class SimpleDataBinder implements DataBinder { } else{ obj[propName] = propertyType.newInstance() - } + } } - + protected ValueInitializer getPropertyInitializer(obj, String propName){ def initializer = getValueInitializerForField obj, propName initializer @@ -775,7 +775,7 @@ class SimpleDataBinder implements DataBinder { initializer } /** - * @param annotation An instance of grails.databinding.BindInitializer + * @param annotation An instance of grails.databinding.BindInitializer * @return the value Class of the annotation */ protected Class getValueOfBindInitializer(Annotation annotation) { @@ -786,7 +786,7 @@ class SimpleDataBinder implements DataBinder { } value } - + protected convert(Class typeToConvertTo, value) { if (value == null || typeToConvertTo.isAssignableFrom(value?.getClass())) { return value diff --git a/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy b/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy index a839bd865cb..6ba3b1e89cd 100755 --- a/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy +++ b/grails-databinding/src/test/groovy/grails/databinding/SimpleDataBinderSpec.groovy @@ -141,17 +141,17 @@ class SimpleDataBinderSpec extends Specification { obj.sqlDate == nowSqlDate obj.calendar == nowCalendar } - + @Issue('GRAILS-10925') void 'Test binding a Date to a Date property marked with @BindingFormat'() { given: def binder = new SimpleDataBinder() def obj = new DateContainer() def nowDate = new Date() - + when: binder.bind obj, [formattedUtilDate: nowDate] as SimpleMapDataBindingSource - + then: obj.formattedUtilDate == nowDate } @@ -519,44 +519,44 @@ class SimpleDataBinderSpec extends Specification { widget.names[1] == null widget.names[2] == 'two' } - + void 'Test @BindUsing on a List'() { given: def binder = new SimpleDataBinder() def widget = new Widget() - + when: binder.bind widget, [listOfIntegers: '4'] as SimpleMapDataBindingSource - + then: widget.listOfIntegers == [0, 1, 2, 3] } - + @Issue('GRAILS-10853') void 'Test adding new elements to a Set using indexed properties'() { given: def binder = new SimpleDataBinder() def widget = new Widget() - + when: binder.bind widget, ['factories[2]': [name: 'Tres'], 'factories[0]': [name: 'Uno'], 'factories[1]': [name: 'Dos']] as SimpleMapDataBindingSource - + then: widget.factories.size() == 3 widget.factories.find { it.name == 'Uno' } widget.factories.find { it.name == 'Dos' } widget.factories.find { it.name == 'Tres' } } - + @Issue('GRAILS-10865') void 'Test binding to an inherited typed collection'() { given: def binder = new SimpleDataBinder() def obj = new ClassWithInheritedTypedCollection() - + when: binder.bind obj, [list: ['1', '2', '3'], 'map[one]': '1', 'map[two]': '2' ] as SimpleMapDataBindingSource - + then: obj.list == [1, 2, 3] obj.map.one == 1 @@ -664,7 +664,7 @@ class Widget { byte[] byteArray Integer[] integers List names - @BindUsing({ obj, source -> + @BindUsing({ obj, source -> def cnt = source['listOfIntegers'] as int def result = [] cnt.times { result << it } From 68bfc38be9d0bc17c312817ead82d7504e56cfd3 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Mon, 22 Nov 2021 19:25:52 +0530 Subject: [PATCH 09/14] Create Release Notes title and tag based on resolved version --- .github/release-drafter.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index c049edcda4e..e21e13167a0 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: $NEXT_PATCH_VERSION -tag-template: v$NEXT_PATCH_VERSION +name-template: $RESOLVED_VERSION +tag-template: v$RESOLVED_VERSION version-resolver: major: labels: From f300b1965c68747fe4b385e95d106e9c20b31afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Tue, 23 Nov 2021 09:55:08 +0100 Subject: [PATCH 10/14] Fixes test-pollution in UrlMappingsWithHttpMethodSpec --- .../grails/web/mapping/UrlMappingsWithHttpMethodSpec.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/UrlMappingsWithHttpMethodSpec.groovy b/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/UrlMappingsWithHttpMethodSpec.groovy index 6bfaefe81e0..77dc5f2b0ba 100644 --- a/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/UrlMappingsWithHttpMethodSpec.groovy +++ b/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/UrlMappingsWithHttpMethodSpec.groovy @@ -9,6 +9,7 @@ import org.grails.support.MockApplicationContext import org.grails.web.mapping.DefaultLinkGenerator import org.grails.web.mapping.DefaultUrlMappingEvaluator import org.grails.web.mapping.DefaultUrlMappingsHolder +import org.grails.web.util.WebUtils import org.springframework.mock.web.MockServletContext import spock.lang.Specification @@ -17,6 +18,10 @@ import spock.lang.Specification */ class UrlMappingsWithHttpMethodSpec extends Specification{ + def setup() { + WebUtils.clearGrailsWebRequest() + } + def mappings = { "/foo"( controller:"bar", action:"save", method:"POST" ) "/foo2"( controller:"bar", action:"save", method:"PUT" ) From cfcfd89908ecb82f74e64f8d8183aac46c61d42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Tue, 23 Nov 2021 10:26:24 +0100 Subject: [PATCH 11/14] Fixes test-pollution in RestfulUrlMappingSpec --- .../org/grails/web/mapping/RestfulUrlMappingSpec.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/RestfulUrlMappingSpec.groovy b/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/RestfulUrlMappingSpec.groovy index ff2c61d1606..53a0441be8d 100644 --- a/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/RestfulUrlMappingSpec.groovy +++ b/grails-web-url-mappings/src/test/groovy/org/grails/web/mapping/RestfulUrlMappingSpec.groovy @@ -9,11 +9,16 @@ import org.grails.support.MockApplicationContext import org.grails.web.mapping.DefaultLinkGenerator import org.grails.web.mapping.DefaultUrlMappingEvaluator import org.grails.web.mapping.DefaultUrlMappingsHolder +import org.grails.web.util.WebUtils import spock.lang.Issue import spock.lang.Specification class RestfulUrlMappingSpec extends Specification { + def setup() { + WebUtils.clearGrailsWebRequest() + } + def mappings = { delete "/$controller/$id(.$format)?"(action: "delete") get "/$controller(.$format)?"(action: "index") From a4d6f116978d248fe24348d8ac50585db3868823 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Tue, 23 Nov 2021 20:49:39 +0530 Subject: [PATCH 12/14] Update Grails Plugin profile from 4.0.1 to 4.0.2 --- grails-bom/profiles.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grails-bom/profiles.properties b/grails-bom/profiles.properties index 58677c44d37..e4e7e47070b 100644 --- a/grails-bom/profiles.properties +++ b/grails-bom/profiles.properties @@ -3,7 +3,7 @@ base=4.0.4 web=4.0.0 react=3.0.1 vue=4.1.1 -plugin=4.0.1 +plugin=4.0.2 profile=4.0.1 rest-api-plugin=4.0.1 web-plugin=4.0.1 From 47ef7853399ec6d36eaa216578bcb25155676119 Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Tue, 23 Nov 2021 17:19:32 +0000 Subject: [PATCH 13/14] Release v4.0.13 --- gradle.properties | 2 +- grails-core/src/test/groovy/grails/util/GrailsUtilTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 18270aae4f4..9f874ac14f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=4.0.13-SNAPSHOT +projectVersion=4.0.13 commonsLangVersion=2.6 springBootVersion=2.1.18.RELEASE springVersion=5.1.20.RELEASE diff --git a/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java b/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java index 4a00e75dc78..5a4677f65a8 100644 --- a/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java +++ b/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java @@ -25,7 +25,7 @@ public class GrailsUtilTests extends TestCase { public void testGrailsVersion() { - assertEquals("4.0.13-SNAPSHOT", GrailsUtil.getGrailsVersion()); + assertEquals("4.0.13", GrailsUtil.getGrailsVersion()); } @Override From 8d1f769d417fdadb427d3948a300e24ffcebba3a Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Tue, 23 Nov 2021 17:31:47 +0000 Subject: [PATCH 14/14] Back to 4.0.14-SNAPSHOT --- gradle.properties | 2 +- grails-core/src/test/groovy/grails/util/GrailsUtilTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9f874ac14f5..76e676be476 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=4.0.13 +projectVersion=4.0.14-SNAPSHOT commonsLangVersion=2.6 springBootVersion=2.1.18.RELEASE springVersion=5.1.20.RELEASE diff --git a/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java b/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java index 5a4677f65a8..c5816c45579 100644 --- a/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java +++ b/grails-core/src/test/groovy/grails/util/GrailsUtilTests.java @@ -25,7 +25,7 @@ public class GrailsUtilTests extends TestCase { public void testGrailsVersion() { - assertEquals("4.0.13", GrailsUtil.getGrailsVersion()); + assertEquals("4.0.14-SNAPSHOT", GrailsUtil.getGrailsVersion()); } @Override