You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2017/09/11 08:56:28 UTC

[05/18] james-project git commit: MAILBOX-304 Makes comment about why optional unboxing is safe clearer.

MAILBOX-304 Makes comment about why optional unboxing is safe clearer.


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/c0ca66ff
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/c0ca66ff
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/c0ca66ff

Branch: refs/heads/master
Commit: c0ca66ff725be69b6d491ecd4cfa66a2c8b632e7
Parents: 762be3b
Author: benwa <bt...@linagora.com>
Authored: Thu Sep 7 10:10:00 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Thu Sep 7 10:10:00 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/cassandra/mail/CassandraAttachmentDAOV2.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c0ca66ff/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOV2.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOV2.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOV2.java
index 4b0bd49..3cc9ee5 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOV2.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOV2.java
@@ -104,7 +104,8 @@ public class CassandraAttachmentDAOV2 {
 
     public CompletableFuture<Void> storeAttachment(Attachment attachment) {
         return blobsDAO.save(attachment.getBytes())
-            .thenApply(Optional::get) // attachment payload is never null
+            // BlobDAO supports saving null blobs. But attachments ensure there blobs are never null. Hence optional unboxing is safe here.
+            .thenApply(Optional::get)
             .thenApply(blobId ->
                 insertStatement.bind()
                     .setUUID(ID_AS_UUID, attachment.getAttachmentId().asUUID())


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org