From cd91a6b2a4095ba2a8f6aa47d1e7b393d2d9b719 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 9 May 2014 12:15:12 +0000 Subject: [PATCH] * SusiMail: Add more locking (ticket #1269) --- .../src/src/i2p/susi/webmail/Mail.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/susimail/src/src/i2p/susi/webmail/Mail.java b/apps/susimail/src/src/i2p/susi/webmail/Mail.java index 00cd17495e..b586a4a771 100644 --- a/apps/susimail/src/src/i2p/susi/webmail/Mail.java +++ b/apps/susimail/src/src/i2p/susi/webmail/Mail.java @@ -61,7 +61,7 @@ class Mail { formattedSubject, formattedDate, // US Locale, UTC localFormattedDate, // Current Locale, local time zone - shortSender, // Either name or address but not both, HTML escaped, double-quotes removed, truncated with with hellip + shortSender, // Either name or address but not both, HTML escaped, double-quotes removed, truncated with hellip shortSubject, // HTML escaped, truncated with hellip quotedDate; // Current Locale, local time zone, longer format public final String uidl; @@ -88,26 +88,26 @@ class Mail { error = ""; } - public ReadBuffer getHeader() { + public synchronized ReadBuffer getHeader() { return header; } - public void setHeader(ReadBuffer rb) { + public synchronized void setHeader(ReadBuffer rb) { if (rb == null) return; header = rb; parseHeaders(); } - public boolean hasHeader() { + public synchronized boolean hasHeader() { return header != null; } - public ReadBuffer getBody() { + public synchronized ReadBuffer getBody() { return body; } - public void setBody(ReadBuffer rb) { + public synchronized void setBody(ReadBuffer rb) { if (rb == null) return; if (header == null) @@ -121,41 +121,41 @@ class Mail { } } - public boolean hasBody() { + public synchronized boolean hasBody() { return body != null; } - public MailPart getPart() { + public synchronized MailPart getPart() { return part; } - public boolean hasPart() { + public synchronized boolean hasPart() { return part != null; } - public int getSize() { + public synchronized int getSize() { return size; } - public void setSize(int size) { + public synchronized void setSize(int size) { if (body != null) return; this.size = size; } - public boolean isSpam() { + public synchronized boolean isSpam() { return isSpam; } - public boolean isNew() { + public synchronized boolean isNew() { return isNew; } - public void setNew(boolean isNew) { + public synchronized void setNew(boolean isNew) { this.isNew = isNew; } - public boolean hasAttachment() { + public synchronized boolean hasAttachment() { // this isn't right but good enough to start // if part != null query parts instead? return contentType != null && @@ -259,7 +259,7 @@ class Mail { } } - public void parseHeaders() + private void parseHeaders() { DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); DateFormat localDateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); -- GitLab