Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix decode in render_union in java #25

Merged
merged 1 commit into from Feb 7, 2017
Merged

Fix decode in render_union in java #25

merged 1 commit into from Feb 7, 2017

Conversation

bartekn
Copy link
Contributor

@bartekn bartekn commented Feb 6, 2017

My 1yo commit I forgot to merge. It fixes decode method in Java (discriminant value was not read). I used this to generate Java classes when XDR changed last year so they are OK.

Example, Memo class diff:

diff --git a/src/main/java/org/stellar/sdk/xdr/Memo.java b/src/main/java/org/stellar/sdk/xdr/Memo.java
index e04bf25..d66c5d2 100644
--- a/src/main/java/org/stellar/sdk/xdr/Memo.java
+++ b/src/main/java/org/stellar/sdk/xdr/Memo.java
@@ -80,8 +80,10 @@ public static void encode(XdrDataOutputStream stream, Memo encodedMemo) throws I
   }
   }
   public static Memo decode(XdrDataInputStream stream) throws IOException {
-    Memo decodedMemo = new Memo();
-    switch (decodedMemo.getDiscriminant()) {
+  Memo decodedMemo = new Memo();
+  MemoType discriminant = MemoType.decode(stream);
+  decodedMemo.setDiscriminant(discriminant);
+  switch (decodedMemo.getDiscriminant()) {
   case MEMO_NONE:
   break;
   case MEMO_TEXT:

@bartekn bartekn merged commit cf69f68 into master Feb 7, 2017
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.

None yet

2 participants