You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/07/10 11:55:59 UTC

[commons-imaging] branch master updated: Update deprecated

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git


The following commit(s) were added to refs/heads/master by this push:
     new 18d9f47c Update deprecated
18d9f47c is described below

commit 18d9f47c3e8595fc40518de71bc7439dc7fb7937
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jul 10 07:55:55 2023 -0400

    Update deprecated
---
 src/main/java/org/apache/commons/imaging/common/PackBits.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/imaging/common/PackBits.java b/src/main/java/org/apache/commons/imaging/common/PackBits.java
index 2b8622f8..20aaa956 100644
--- a/src/main/java/org/apache/commons/imaging/common/PackBits.java
+++ b/src/main/java/org/apache/commons/imaging/common/PackBits.java
@@ -26,7 +26,9 @@ public class PackBits {
 
     public byte[] compress(final byte[] bytes) throws IOException {
         // max length 1 extra byte for every 128
-        try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream(Allocator.checkByteArray(bytes.length * 2))) {
+        try (UnsynchronizedByteArrayOutputStream baos = UnsynchronizedByteArrayOutputStream.builder()
+                .setBufferSize(Allocator.checkByteArray(bytes.length * 2))
+                .get()) {
             int ptr = 0;
             while (ptr < bytes.length) {
                 int dup = findNextDuplicate(bytes, ptr);