Skip to content

Conversation

jasdel
Copy link
Contributor

@jasdel jasdel commented Apr 13, 2018

Fixes a bug in the XML unmarshaler that would incorrectly try to
unmarshal "time.Time" parameters that did not have the struct tag type
on them. This would occur for nested lists like CloudWatch's
GetMetricDataResponse MetricDataResults timestamp parameters.

Adds protocol tests for XML unmarshaling with list of timestamps.

Related to aws/aws-sdk-go#1894

Fix #1892

@jasdel jasdel self-assigned this Apr 13, 2018
@jasdel jasdel requested a review from xibz April 13, 2018 18:48
@@ -52,14 +54,26 @@ func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error {
if t == "" {
switch rtype.Kind() {
case reflect.Struct:
t = "structure"
// also it can't be a time object
_, tok := r.Interface().(*time.Time)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be cleaner to do something like this

if _, ok := reflect.Indirect(v).Interface().(time.Time); ok {
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be able to use Indirect because that would produce a nil value for fields, which Interface will panic on.

@jasdel
Copy link
Contributor Author

jasdel commented Apr 13, 2018

Merge pending until we're able to regression test this with the other REST XML protocol services.

@opavader
Copy link

Can this be expedited ?
Seems like major bug to me.

jasdel added 3 commits April 23, 2018 14:12
Fixes a bug in the XML unmarshaler that would incorrectly try to
unmarshal "time.Time" parameters that did not have the struct tag type
on them. This would occur for nested lists like CloudWatch's
GetMetricDataResponse MetricDataResults timestamp parameters.

Adds protocol tests for XML unmarshaling with list of timestamps.

Related to aws/aws-sdk-go#1894

Fix #1892
@jasdel jasdel force-pushed the fixup/XMLUnmarhsalerUntaggedTime branch from 8418c25 to 72da4ca Compare April 23, 2018 21:13
"shape": "Timestamps"
},
"Float64s": {
"shape": "Float64s"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add JSONValue to this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed JSONValue as its not yet supported by RESTXML. we can add that in another change.

@jasdel jasdel merged commit 584b9ab into aws:master Apr 23, 2018
@jasdel jasdel deleted the fixup/XMLUnmarhsalerUntaggedTime branch April 23, 2018 21:24
jasdel added a commit to jasdel/aws-sdk-go-v2 that referenced this pull request May 25, 2018
Services
---
* Synced the V2 SDK with latests AWS service API definitions.

SDK Bugs
---
* `private/protocol/xml/xmlutil`: Fix XML unmarshaler not correctly unmarshaling list of timestamp values ([aws#166](aws#166))
	* Fixes a bug in the XML unmarshaler that would incorrectly try to unmarshal "time.Time" parameters that did not have the struct tag type on them.
	* Related to [aws/aws-sdk-go#1894](aws/aws-sdk-go#1894)
* `service/s3`: Fix typos for migrated S3 specific config options ([aws#173](aws#173))
	* Updates the S3 specific config error messages to the correct fields.
* `aws/endpoints`: Fix SDK endpoint signing name resolution ([aws#181](aws#181))
	* Fixes how the SDK derives service signing names. If the signing name is not modeled in the endpoints package the service will fallback to the signing name modeled in the service model.
	* Fix [aws#163](aws#163)
	* Fix [aws#153](aws#153)
	* Related to [aws/aws-sdk-go#1854](aws/aws-sdk-go#1854)
* `service/s3`: remove SelectContent until EventStream supported ([aws#175](aws#175])
	* S3's SelectContent API is not functional in the SDK yet, and was not supposed to be generated until EventStream support is available.
	* Related to [aws/aws-sdk-go#1941](aws/aws-sdk-go#1941)

SDK Enhancements
---
* `service/s3/s3manager/s3manageriface`: Add WithIterator to mock interface ([aws#156](aws#156))
	* Updates the `DownloaderAPI` and `UploaderAPI` mocking interfaces to have parity with the concrete types.
	* Fixes [aws#155](aws#155)
jasdel added a commit that referenced this pull request May 26, 2018
Services
---
* Synced the V2 SDK with latests AWS service API definitions.

SDK Bugs
---
* `private/protocol/xml/xmlutil`: Fix XML unmarshaler not correctly unmarshaling list of timestamp values ([#166](#166))
	* Fixes a bug in the XML unmarshaler that would incorrectly try to unmarshal "time.Time" parameters that did not have the struct tag type on them.
	* Related to [aws/aws-sdk-go#1894](aws/aws-sdk-go#1894)
* `service/s3`: Fix typos for migrated S3 specific config options ([#173](#173))
	* Updates the S3 specific config error messages to the correct fields.
* `aws/endpoints`: Fix SDK endpoint signing name resolution ([#181](#181))
	* Fixes how the SDK derives service signing names. If the signing name is not modeled in the endpoints package the service will fallback to the signing name modeled in the service model.
	* Fix [#163](#163)
	* Fix [#153](#153)
	* Related to [aws/aws-sdk-go#1854](aws/aws-sdk-go#1854)
* `service/s3`: remove SelectContent until EventStream supported ([#175](#175])
	* S3's SelectContent API is not functional in the SDK yet, and was not supposed to be generated until EventStream support is available.
	* Related to [aws/aws-sdk-go#1941](aws/aws-sdk-go#1941)

SDK Enhancements
---
* `service/s3/s3manager/s3manageriface`: Add WithIterator to mock interface ([#156](#156))
	* Updates the `DownloaderAPI` and `UploaderAPI` mocking interfaces to have parity with the concrete types.
	* Fixes [#155](#155)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants