Skip to content

Commit

Permalink
Add GzipParameters.getFileName() and deprecated getFilename()
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 19, 2023
1 parent 3714fdd commit 030034f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</parent>

<artifactId>commons-compress</artifactId>
<version>1.24.1-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
<name>Apache Commons Compress</name>
<url>https://commons.apache.org/proper/commons-compress/</url>
<inceptionYear>2002</inceptionYear> <!-- from NOTICE file -->
Expand All @@ -45,8 +45,8 @@ Brotli, Zstandard and ar, cpio, jar, tar, zip, dump, 7z, arj.
<commons.jira.id>COMPRESS</commons.jira.id>
<commons.jira.pid>12310904</commons.jira.pid>
<!-- configuration bits for cutting a release candidate -->
<commons.release.version>1.24.0</commons.release.version>
<commons.bc.version>1.23.0</commons.bc.version>
<commons.release.version>1.25.0</commons.release.version>
<commons.bc.version>1.24.0</commons.bc.version>
<commons.rc.version>RC1</commons.rc.version>
<mockito.version>4.11.0</mockito.version>

Expand Down
3 changes: 2 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ The <action> type attribute can be add,update,fix,remove.
<title>Apache Commons Compress Release Notes</title>
</properties>
<body>
<release version="1.24.1" date="202Y-MM-DD" description="Minor feature and maintenance release.">
<release version="1.25.0" date="202Y-MM-DD" description="Minor feature and maintenance release.">
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Add GzipParameters.getFileName() and deprecated getFilename().</action>
<!-- FIX -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot">Bump org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413.</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down

0 comments on commit 030034f

Please sign in to comment.