Source:
public Message(ZulipApp app, JSONObject message, Map<String, Person> personCache, Map<String, Stream> streamCache) throws JSONException { this.setID(message.getInt("id")); this.setSender(Person.getOrUpdate(app, message.getString("sender_email"), message.getString("sender_full_name"), message.getString("avatar_url"), personCache)); if (message.getString("type").equals("stream")) { this.setType(MessageType.STREAM_MESSAGE); String streamName = message.getString("display_recipient"); Stream stream = null; if (streamCache != null) { stream = streamCache.get(streamName); } if (stream == null) { stream = Stream.getByName(app, streamName); if (streamCache != null) { streamCache.put(streamName, stream); } } setStream(stream); } else if (message.getString("type").equals("private")) { this.setType(MessageType.PRIVATE_MESSAGE); JSONArray jsonRecipients = message .getJSONArray("display_recipient"); Person[] r = new Person[jsonRecipients.length()]; for (int i = 0; i < jsonRecipients.length(); i++) { JSONObject obj = jsonRecipients.getJSONObject(i); Person person = Person.getOrUpdate(app, obj.getString("email"), obj.getString("full_name"), null, personCache); r[i] = person; } setRecipients(recipientList(r)); } String html = message.getString("content"); this.setFormattedContent(html); Spanned formattedContent = formatContent(html, app); this.setContent(formattedContent.toString()); if (this.getType() == MessageType.STREAM_MESSAGE) { this.setSubject(message.getString("subject")); } else { this.setSubject(null); } this.setTimestamp(new Date(message.getLong("timestamp") * 1000)); this.setMessageRead(false); this.setMessageStar(false); }

Target:
public Message(ZulipApp app, JSONObject message, Map<String, Person> personCache, Map<String, Stream> streamCache) throws JSONException { this.setID(message.getInt("id")); this.setSender(Person.getOrUpdate(app, message.getString("sender_email"), message.getString("sender_full_name"), message.getString("avatar_url"), Integer.parseInt(message.getString("sender_id")), personCache)); if (message.getString("type").equals("stream")) { this.setType(MessageType.STREAM_MESSAGE); String streamName = message.getString("display_recipient"); Stream stream = null; if (streamCache != null) { stream = streamCache.get(streamName); } if (stream == null) { stream = Stream.getByName(app, streamName); if (streamCache != null) { streamCache.put(streamName, stream); } } setStream(stream); } else if (message.getString("type").equals("private")) { this.setType(MessageType.PRIVATE_MESSAGE); JSONArray jsonRecipients = message .getJSONArray("display_recipient"); Person[] r = new Person[jsonRecipients.length()]; for (int i = 0; i < jsonRecipients.length(); i++) { JSONObject obj = jsonRecipients.getJSONObject(i); Person person = Person.getOrUpdate(app, obj.getString("email"), obj.getString("full_name"), null, Integer.parseInt(obj.getString("sender_id")), personCache); r[i] = person; } setRecipients(recipientList(r)); } String html = message.getString("content"); this.setFormattedContent(html); Spanned formattedContent = formatContent(html, app); this.setContent(formattedContent.toString()); if (this.getType() == MessageType.STREAM_MESSAGE) { this.setSubject(message.getString("subject")); } else { this.setSubject(null); } this.setTimestamp(new Date(message.getLong("timestamp") * Constants.MILLISECONDS_IN_A_MINUTE)); this.setMessageRead(false); }