From d45616031e9b27859b1f884da1a0891c4def0ba5 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Tue, 3 Jan 2017 03:52:58 +0000 Subject: [PATCH] use Collections.singletonList and Collections.emptyList where appropriate git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1777056 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hwpf/usermodel/Picture.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java index 108544efe7..ab230580a1 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Picture.java @@ -21,7 +21,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.zip.InflaterInputStream; @@ -85,7 +85,7 @@ public final class Picture private PICF _picf; private PICFAndOfficeArtData _picfAndOfficeArtData; - private List _blipRecords; + private final List _blipRecords; private byte[] content; private int dataBlockStartOfsset; @@ -100,7 +100,7 @@ public final class Picture */ public Picture( EscherBlipRecord blipRecord ) { - this._blipRecords = Arrays.asList(new EscherBlipRecord[] {blipRecord}); + this._blipRecords = Collections.singletonList(blipRecord); } /** @@ -115,7 +115,9 @@ public final class Picture this.dataBlockStartOfsset = dataBlockStartOfsset; if ( _picfAndOfficeArtData != null && _picfAndOfficeArtData.getBlipRecords() != null) { - _blipRecords = _picfAndOfficeArtData.getBlipRecords(); + _blipRecords = _picfAndOfficeArtData.getBlipRecords(); + } else { + _blipRecords = Collections.emptyList(); } if ( fillBytes ) {