poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1751182 - /poi/trunk/src/scratchpad/src/org/apache/poi/hmef/HMEFMessage.java
Date Sun, 03 Jul 2016 23:23:54 GMT
Author: onealj
Date: Sun Jul  3 23:23:54 2016
New Revision: 1751182

URL: http://svn.apache.org/viewvc?rev=1751182&view=rev
Log:
make class attributes final; return unmodifiable lists

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hmef/HMEFMessage.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hmef/HMEFMessage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hmef/HMEFMessage.java?rev=1751182&r1=1751181&r2=1751182&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hmef/HMEFMessage.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hmef/HMEFMessage.java Sun Jul  3 23:23:54
2016
@@ -20,6 +20,7 @@ package org.apache.poi.hmef;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.poi.hmef.attribute.MAPIAttribute;
@@ -41,10 +42,11 @@ import org.apache.poi.util.LittleEndian;
 public final class HMEFMessage {
    public static final int HEADER_SIGNATURE = 0x223e9f78;
    
+   @SuppressWarnings("unused")
    private int fileId;
-   private List<TNEFAttribute> messageAttributes = new ArrayList<TNEFAttribute>();
-   private List<MAPIAttribute> mapiAttributes = new ArrayList<MAPIAttribute>();
-   private List<Attachment> attachments = new ArrayList<Attachment>();
+   private final List<TNEFAttribute> messageAttributes = new ArrayList<TNEFAttribute>();
+   private final List<MAPIAttribute> mapiAttributes = new ArrayList<MAPIAttribute>();
+   private final List<Attachment> attachments = new ArrayList<Attachment>();
    
    public HMEFMessage(InputStream inp) throws IOException {
        try {
@@ -125,7 +127,7 @@ public final class HMEFMessage {
     *  are stored as {@link MAPIAttribute}s - see {@link #getMessageMAPIAttributes()} 
     */
    public List<TNEFAttribute> getMessageAttributes() {
-      return messageAttributes;
+      return Collections.unmodifiableList(messageAttributes);
    }
    
    /**
@@ -134,14 +136,14 @@ public final class HMEFMessage {
     *  apply to most messages, see {@link #getMessageAttributes()}
     */
    public List<MAPIAttribute> getMessageMAPIAttributes() {
-      return mapiAttributes;
+      return Collections.unmodifiableList(mapiAttributes);
    }
    
    /**
     * Returns all the Attachments of the message.
     */
    public List<Attachment> getAttachments() {
-      return attachments;
+      return Collections.unmodifiableList(attachments);
    }
    
    /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message