Skip to content

Commit

Permalink
8326100: DeflaterDictionaryTests should use Deflater.getBytesWritten …
Browse files Browse the repository at this point in the history
…instead of Deflater.getTotalOut

Backport-of: 9451677daaf1184f67759c87114af3f81fa74f23
  • Loading branch information
GoeLin committed Sep 23, 2024
1 parent 1dcecb3 commit 8f5f8f3
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/jdk/java/util/zip/DeflaterDictionaryTests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -95,9 +95,9 @@ public void testByteArray(int dictionary_offset) throws Exception {
deflater.setInput(input);
deflater.finish();
int compressedDataLength = deflater.deflate(output, 0, output.length, Deflater.NO_FLUSH);
System.out.printf("Deflater::getTotalOut:%s, Deflater::getAdler: %s," +
" compressed length: %s%n", deflater.getTotalOut(),
deflater.getTotalOut(), compressedDataLength);
System.out.printf("Deflater::getBytesWritten:%d, Deflater::getAdler: %d," +
" compressed length: %d%n", deflater.getBytesWritten(),
deflater.getAdler(), compressedDataLength);
deflater.finished();

// Decompress the bytes
Expand All @@ -112,7 +112,7 @@ public void testByteArray(int dictionary_offset) throws Exception {
System.out.println("Did not need to use a Dictionary");
}
inflater.finished();
System.out.printf("Inflater::getAdler:%s, length: %s%n",
System.out.printf("Inflater::getAdler:%d, length: %d%n",
inflater.getAdler(), resultLength);

Assert.assertEquals(SRC_DATA.length(), resultLength);
Expand Down Expand Up @@ -143,9 +143,9 @@ public void testHeapByteBuffer() throws Exception {
deflater.setInput(input);
deflater.finish();
int compressedDataLength = deflater.deflate(output, 0, output.length, Deflater.NO_FLUSH);
System.out.printf("Deflater::getTotalOut:%s, Deflater::getAdler: %s," +
" compressed length: %s%n", deflater.getTotalOut(),
deflater.getTotalOut(), compressedDataLength);
System.out.printf("Deflater::getBytesWritten:%d, Deflater::getAdler: %d," +
" compressed length: %d%n", deflater.getBytesWritten(),
deflater.getAdler(), compressedDataLength);
deflater.finished();

// Decompress the bytes
Expand All @@ -160,7 +160,7 @@ public void testHeapByteBuffer() throws Exception {
System.out.println("Did not need to use a Dictionary");
}
inflater.finished();
System.out.printf("Inflater::getAdler:%s, length: %s%n",
System.out.printf("Inflater::getAdler:%d, length: %d%n",
inflater.getAdler(), resultLength);

Assert.assertEquals(SRC_DATA.length(), resultLength);
Expand Down Expand Up @@ -197,9 +197,9 @@ public void testByteBufferDirect() throws Exception {
deflater.setInput(input);
deflater.finish();
int compressedDataLength = deflater.deflate(output, 0, output.length, Deflater.NO_FLUSH);
System.out.printf("Deflater::getTotalOut:%s, Deflater::getAdler: %s," +
" compressed length: %s%n", deflater.getTotalOut(),
deflater.getTotalOut(), compressedDataLength);
System.out.printf("Deflater::getBytesWritten:%d, Deflater::getAdler: %d," +
" compressed length: %d%n", deflater.getBytesWritten(),
deflater.getAdler(), compressedDataLength);
deflater.finished();

// Decompress the bytes
Expand All @@ -214,7 +214,7 @@ public void testByteBufferDirect() throws Exception {
System.out.println("Did not need to use a Dictionary");
}
inflater.finished();
System.out.printf("Inflater::getAdler:%s, length: %s%n",
System.out.printf("Inflater::getAdler:%d, length: %d%n",
inflater.getAdler(), resultLength);

Assert.assertEquals(SRC_DATA.length(), resultLength);
Expand Down

1 comment on commit 8f5f8f3

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.