From 2520099762506c252acf18ba94fc79966425801b Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Mon, 27 Nov 2017 23:05:42 -0500 Subject: [PATCH] Serializing the memo only when the message bytes is not null --- .../graphenej/operations/TransferOperation.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java index 656c23a..232a2a1 100644 --- a/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java +++ b/graphenej/src/main/java/cy/agorise/graphenej/operations/TransferOperation.java @@ -121,20 +121,20 @@ public class TransferOperation extends BaseOperation { jsonObject.addProperty(KEY_FROM, from.getObjectId()); jsonObject.addProperty(KEY_TO, to.getObjectId()); jsonObject.add(KEY_AMOUNT, amount.toJsonObject()); - jsonObject.add(KEY_MEMO, memo.toJsonObject()); + if(memo.getByteMessage() != null) + jsonObject.add(KEY_MEMO, memo.toJsonObject()); jsonObject.add(KEY_EXTENSIONS, new JsonArray()); array.add(jsonObject); return array; } + /** + * Serializer used to convert this object into a {@link JsonElement} instance + */ public static class TransferSerializer implements JsonSerializer { @Override public JsonElement serialize(TransferOperation transfer, Type type, JsonSerializationContext jsonSerializationContext) { -// JsonArray arrayRep = new JsonArray(); -// arrayRep.add(transfer.getId()); -// arrayRep.add(transfer.toJsonObject()); -// return arrayRep; return transfer.toJsonObject(); } } @@ -198,7 +198,6 @@ public class TransferOperation extends BaseOperation { Memo memo = context.deserialize(jsonObject.get(KEY_MEMO), Memo.class); transfer.setMemo(memo); } - return transfer; } }