commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [24/50] [abbrv] commons-imaging git commit: Use try with resources.
Date Wed, 24 May 2017 18:41:12 GMT
Use try with resources.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1775930 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/fabe22ad
Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/fabe22ad
Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/fabe22ad

Branch: refs/heads/master
Commit: fabe22ad4250319db5f5f125d27c8528093d29f0
Parents: 0c07670
Author: Gary D. Gregory <ggregory@apache.org>
Authored: Fri Dec 23 23:26:38 2016 +0000
Committer: Gary D. Gregory <ggregory@apache.org>
Committed: Fri Dec 23 23:26:38 2016 +0000

----------------------------------------------------------------------
 .../imaging/formats/tiff/write/TiffImageWriterLossless.java   | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/fabe22ad/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index 8e80447..0347fb4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -314,9 +314,10 @@ public class TiffImageWriterLossless extends TiffImageWriterBase {
 
         // write in the new items
         for (final TiffOutputItem outputItem : outputItems) {
-            final BufferOutputStream tos = new BufferOutputStream(output, (int) outputItem.getOffset());
-            final BinaryOutputStream bos = new BinaryOutputStream(tos, byteOrder);
-            outputItem.writeItem(bos);
+            try (final BinaryOutputStream bos = new BinaryOutputStream(
+                    new BufferOutputStream(output, (int) outputItem.getOffset()), byteOrder))
{
+                outputItem.writeItem(bos);
+            }
         }
 
         os.write(output);


Mime
View raw message