From 88ab694af8878dafc6bf63f4cf027b9e36bbdd54 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Tue, 1 Mar 2016 13:08:51 +0000
Subject: [PATCH] No need to unwrap Bytes before adding to dictionary.

---
 .../org/briarproject/forum/ForumManagerImpl.java    | 13 ++++++-------
 .../org/briarproject/forum/ForumPostValidator.java  |  6 +++---
 .../messaging/MessagingManagerImpl.java             |  3 +--
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/briar-core/src/org/briarproject/forum/ForumManagerImpl.java b/briar-core/src/org/briarproject/forum/ForumManagerImpl.java
index 899b3de541..fe51b778b3 100644
--- a/briar-core/src/org/briarproject/forum/ForumManagerImpl.java
+++ b/briar-core/src/org/briarproject/forum/ForumManagerImpl.java
@@ -61,15 +61,14 @@ class ForumManagerImpl implements ForumManager {
 		try {
 			BdfDictionary meta = new BdfDictionary();
 			meta.put("timestamp", p.getMessage().getTimestamp());
-			if (p.getParent() != null)
-				meta.put("parent", p.getParent().getBytes());
+			if (p.getParent() != null) meta.put("parent", p.getParent());
 			if (p.getAuthor() != null) {
 				Author a = p.getAuthor();
-				BdfDictionary author = new BdfDictionary();
-				author.put("id", a.getId().getBytes());
-				author.put("name", a.getName());
-				author.put("publicKey", a.getPublicKey());
-				meta.put("author", author);
+				BdfDictionary authorMeta = new BdfDictionary();
+				authorMeta.put("id", a.getId());
+				authorMeta.put("name", a.getName());
+				authorMeta.put("publicKey", a.getPublicKey());
+				meta.put("author", authorMeta);
 			}
 			meta.put("contentType", p.getContentType());
 			meta.put("local", true);
diff --git a/briar-core/src/org/briarproject/forum/ForumPostValidator.java b/briar-core/src/org/briarproject/forum/ForumPostValidator.java
index 4ea87c11f6..8bc2734502 100644
--- a/briar-core/src/org/briarproject/forum/ForumPostValidator.java
+++ b/briar-core/src/org/briarproject/forum/ForumPostValidator.java
@@ -82,7 +82,7 @@ class ForumPostValidator extends BdfMessageValidator {
 				KeyParser keyParser = crypto.getSignatureKeyParser();
 				PublicKey key = keyParser.parsePublicKey(author.getPublicKey());
 				// Serialise the data to be signed
-				BdfList signed = BdfList.of(g.getId(), timestamp, parentId,
+				BdfList signed = BdfList.of(g.getId(), timestamp, parent,
 						authorList, contentType, body);
 				// Verify the signature
 				Signature signature = crypto.getSignature();
@@ -100,10 +100,10 @@ class ForumPostValidator extends BdfMessageValidator {
 		// Return the metadata
 		BdfDictionary meta = new BdfDictionary();
 		meta.put("timestamp", timestamp);
-		if (parentId != null) meta.put("parent", parentId);
+		if (parent != null) meta.put("parent", parent);
 		if (author != null) {
 			BdfDictionary authorMeta = new BdfDictionary();
-			authorMeta.put("id", author.getId().getBytes());
+			authorMeta.put("id", author.getId());
 			authorMeta.put("name", author.getName());
 			authorMeta.put("publicKey", author.getPublicKey());
 			meta.put("author", authorMeta);
diff --git a/briar-core/src/org/briarproject/messaging/MessagingManagerImpl.java b/briar-core/src/org/briarproject/messaging/MessagingManagerImpl.java
index 30fb903d6b..928b793bf3 100644
--- a/briar-core/src/org/briarproject/messaging/MessagingManagerImpl.java
+++ b/briar-core/src/org/briarproject/messaging/MessagingManagerImpl.java
@@ -83,8 +83,7 @@ class MessagingManagerImpl implements MessagingManager, AddContactHook,
 		try {
 			BdfDictionary meta = new BdfDictionary();
 			meta.put("timestamp", m.getMessage().getTimestamp());
-			if (m.getParent() != null)
-				meta.put("parent", m.getParent().getBytes());
+			if (m.getParent() != null) meta.put("parent", m.getParent());
 			meta.put("contentType", m.getContentType());
 			meta.put("local", true);
 			meta.put("read", true);
-- 
GitLab