diff --git a/pom.xml b/pom.xml
index 3abb9c93943..cf378c1950d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
commons-compress
- 1.24.1-SNAPSHOT
+ 1.25.0-SNAPSHOT
Apache Commons Compress
https://commons.apache.org/proper/commons-compress/
2002
@@ -45,8 +45,8 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.
COMPRESS
12310904
- 1.24.0
- 1.23.0
+ 1.25.0
+ 1.24.0
RC1
4.11.0
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c7616385af1..2f08461babf 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -44,8 +44,9 @@ The type attribute can be add,update,fix,remove.
Apache Commons Compress Release Notes
-
+
+ Add GzipParameters.getFileName() and deprecated getFilename().
Bump org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413.
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
index e1c1a1f7cf1..8792b5a585b 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStream.java
@@ -194,7 +194,7 @@ public void write(final int b) throws IOException {
}
private void writeHeader(final GzipParameters parameters) throws IOException {
- final String fileName = parameters.getFilename();
+ final String fileName = parameters.getFileName();
final String comment = parameters.getComment();
final ByteBuffer buffer = ByteBuffer.allocate(10);
diff --git a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
index 04abf5fc466..9530b8bac56 100644
--- a/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
+++ b/src/main/java/org/apache/commons/compress/compressors/gzip/GzipParameters.java
@@ -69,10 +69,27 @@ public int getDeflateStrategy() {
return deflateStrategy;
}
+ /**
+ * Gets the file name.
+ *
+ * @return the file name.
+ * @deprecated
+ */
+ @Deprecated
public String getFilename() {
return fileName;
}
+ /**
+ * Gets the file name.
+ *
+ * @return the file name.
+ * @since 2.25.0
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
public long getModificationTime() {
return modificationTime;
}
diff --git a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java b/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
index 1aa2da2313b..2b1cbad710c 100644
--- a/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
+++ b/src/test/java/org/apache/commons/compress/compressors/GZipTestCase.java
@@ -245,6 +245,7 @@ public void testMetadataRoundTrip() throws Exception {
assertEquals(Deflater.BEST_COMPRESSION, readParams.getCompressionLevel());
assertEquals(123456000, readParams.getModificationTime());
assertEquals(13, readParams.getOperatingSystem());
+ assertEquals("test3.xml", readParams.getFileName());
assertEquals("test3.xml", readParams.getFilename());
assertEquals("Umlaute möglich?", readParams.getComment());
}
diff --git a/src/test/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStreamTest.java b/src/test/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStreamTest.java
index aa6922d8f4a..4dee3c844b8 100644
--- a/src/test/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/gzip/GzipCompressorOutputStreamTest.java
@@ -44,6 +44,7 @@ private void testFileName(final String expected, final String sourceFile) throws
Files.copy(tempSourceFile, gos);
}
try (GzipCompressorInputStream gis = new GzipCompressorInputStream(Files.newInputStream(targetFile))) {
+ assertEquals(expected, gis.getMetaData().getFileName());
assertEquals(expected, gis.getMetaData().getFilename());
}
}