diff options
author | Marius Volkhart <mariusvolkhart@apache.org> | 2021-10-01 11:57:12 +0000 |
---|---|---|
committer | Marius Volkhart <mariusvolkhart@apache.org> | 2021-10-01 11:57:12 +0000 |
commit | 9994a4286df24b9a82254cf580eb8c352cecf9b6 (patch) | |
tree | fbe7fcd7797dde1b294e0ec319d5b512381b5b14 /poi-scratchpad | |
parent | e239fd745f19188c6e67d41f34f4ff730267888d (diff) | |
download | poi-9994a4286df24b9a82254cf580eb8c352cecf9b6.tar.gz poi-9994a4286df24b9a82254cf580eb8c352cecf9b6.zip |
Replace explicit close with try-with-resources
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893778 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad')
-rw-r--r-- | poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java index 6c8ef1214b..572f43fe24 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/util/DoubleByteUtil.java @@ -44,13 +44,13 @@ public class DoubleByteUtil */ public static String cp950ToString(byte[] data, int offset, int lengthInBytes) { StringBuilder sb = new StringBuilder(); - LittleEndianCP950Reader reader = new LittleEndianCP950Reader(data, offset, lengthInBytes); - int c = reader.read(); - while (c != -1) { - sb.append((char)c); - c = reader.read(); + try (LittleEndianCP950Reader reader = new LittleEndianCP950Reader(data, offset, lengthInBytes)) { + int c = reader.read(); + while (c != -1) { + sb.append((char) c); + c = reader.read(); + } } - reader.close(); return sb.toString(); } } |