Skip to content
Browse files

fixed a bug in the getitemresult marshaller

  • Loading branch information...
1 parent 7a2fc19 commit 2be11e9683ce55ba2b405273a0a1141008420511 @tnbredillet tnbredillet committed Sep 11, 2012
Showing with 31 additions and 29 deletions.
  1. +1 −1 pom.xml
  2. +30 −28 src/main/java/com/amazonaws/services/dynamodb/model/transform/GetItemResultMarshaller.java
View
2 pom.xml
@@ -11,7 +11,7 @@
<groupId>com.michelboudreau</groupId>
<artifactId>alternator</artifactId>
- <version>0.2.12-SNAPSHOT</version>
+ <version>0.2.13-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Alternator</name>
View
58 src/main/java/com/amazonaws/services/dynamodb/model/transform/GetItemResultMarshaller.java
@@ -15,34 +15,36 @@ public String marshall(GetItemResult getItemResult) {
throw new AmazonClientException("Invalid argument passed to marshall(...)");
}
- try {
- StringWriter stringWriter = new StringWriter();
- JSONWriter jsonWriter = new JSONWriter(stringWriter);
- jsonWriter.object();
+ try {
+ StringWriter stringWriter = new StringWriter();
+ JSONWriter jsonWriter = new JSONWriter(stringWriter);
+ jsonWriter.object();
- if (getItemResult.getItem() != null) {
- jsonWriter.key("Item").object();
- for(String key : getItemResult.getItem().keySet()) {
- AttributeValue value = getItemResult.getItem().get(key);
- jsonWriter.key(key).object();
- if(value.getN()!=null){
- jsonWriter.key("N").value(value.getN());
- }else if(value.getS()!=null){
- jsonWriter.key("S").value(value.getS());
- } else if(value.getSS()!=null){
- jsonWriter.key("SS").value(value.getSS());
- }else if(value.getNS()!=null){
- jsonWriter.key("NS").value(value.getNS());
- }
- jsonWriter.endObject();
- }
- jsonWriter.endObject();
- }
- jsonWriter.key("ConsumedCapacityUnits").value(0.5);
- jsonWriter.endObject();
- return stringWriter.toString();
- } catch (Throwable t) {
- throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
- }
+ if (getItemResult.getItem() != null) {
+ jsonWriter.key("Item").object();
+ for (String key : getItemResult.getItem().keySet()) {
+ AttributeValue value = getItemResult.getItem().get(key);
+ if (value != null) {
+ jsonWriter.key(key).object();
+ if (value.getN() != null) {
+ jsonWriter.key("N").value(value.getN());
+ } else if (value.getS() != null) {
+ jsonWriter.key("S").value(value.getS());
+ } else if (value.getSS() != null) {
+ jsonWriter.key("SS").value(value.getSS());
+ } else if (value.getNS() != null) {
+ jsonWriter.key("NS").value(value.getNS());
+ }
+ jsonWriter.endObject();
+ }
+ }
+ jsonWriter.endObject();
+ }
+ jsonWriter.key("ConsumedCapacityUnits").value(0.5);
+ jsonWriter.endObject();
+ return stringWriter.toString();
+ } catch (Throwable t) {
+ throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);
+ }
}
}

0 comments on commit 2be11e9

Please sign in to comment.
Something went wrong with that request. Please try again.