Adapt to type parameter added in commons-compress 1.25.0
In 1.25.0 commons-compress added a generic type parameter to ArchiveOutputStream to avoid unchecked/unconfirmed type casts in subclasses. Change-Id: Ib4c208fc1fb65f73ea57c5bf723fde71b0d6d9f7
This commit is contained in:
parent
aab75dba7e
commit
ef901e9aea
|
@ -15,6 +15,7 @@
|
|||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.ArchiveOutputStream;
|
||||
import org.eclipse.jgit.archive.internal.ArchiveText;
|
||||
import org.eclipse.jgit.util.StringUtils;
|
||||
|
@ -42,7 +43,8 @@ public class BaseFormat {
|
|||
* @throws IOException
|
||||
* if an IO error occurred
|
||||
*/
|
||||
protected ArchiveOutputStream applyFormatOptions(ArchiveOutputStream s,
|
||||
protected ArchiveOutputStream<? extends ArchiveEntry> applyFormatOptions(
|
||||
ArchiveOutputStream<? extends ArchiveEntry> s,
|
||||
Map<String, Object> o) throws IOException {
|
||||
for (Map.Entry<String, Object> p : o.entrySet()) {
|
||||
try {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* Unix TAR format (ustar + some PAX extensions).
|
||||
*/
|
||||
public final class TarFormat extends BaseFormat implements
|
||||
ArchiveCommand.Format<ArchiveOutputStream> {
|
||||
ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> {
|
||||
private static final List<String> SUFFIXES = Collections
|
||||
.unmodifiableList(Arrays.asList(".tar")); //$NON-NLS-1$
|
||||
|
||||
|
@ -57,7 +57,7 @@ public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void putEntry(ArchiveOutputStream out,
|
||||
public void putEntry(ArchiveOutputStream<TarArchiveEntry> out,
|
||||
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
|
||||
throws IOException {
|
||||
if (mode == FileMode.SYMLINK) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveOutputStream;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
|
||||
import org.eclipse.jgit.api.ArchiveCommand;
|
||||
import org.eclipse.jgit.lib.FileMode;
|
||||
|
@ -26,12 +27,12 @@
|
|||
/**
|
||||
* bzip2-compressed tarball (tar.bz2) format.
|
||||
*/
|
||||
public final class Tbz2Format extends BaseFormat implements
|
||||
ArchiveCommand.Format<ArchiveOutputStream> {
|
||||
public final class Tbz2Format extends BaseFormat
|
||||
implements ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> {
|
||||
private static final List<String> SUFFIXES = Collections
|
||||
.unmodifiableList(Arrays.asList(".tar.bz2", ".tbz", ".tbz2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat();
|
||||
private final ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> tarFormat = new TarFormat();
|
||||
|
||||
@Override
|
||||
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
|
||||
|
@ -54,7 +55,7 @@ public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void putEntry(ArchiveOutputStream out,
|
||||
public void putEntry(ArchiveOutputStream<TarArchiveEntry> out,
|
||||
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
|
||||
throws IOException {
|
||||
tarFormat.putEntry(out, tree, path, mode, loader);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveOutputStream;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
|
||||
import org.apache.commons.compress.compressors.gzip.GzipParameters;
|
||||
import org.eclipse.jgit.api.ArchiveCommand;
|
||||
|
@ -27,12 +28,12 @@
|
|||
/**
|
||||
* gzip-compressed tarball (tar.gz) format.
|
||||
*/
|
||||
public final class TgzFormat extends BaseFormat implements
|
||||
ArchiveCommand.Format<ArchiveOutputStream> {
|
||||
public final class TgzFormat extends BaseFormat
|
||||
implements ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> {
|
||||
private static final List<String> SUFFIXES = Collections
|
||||
.unmodifiableList(Arrays.asList(".tar.gz", ".tgz")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat();
|
||||
private final ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> tarFormat = new TarFormat();
|
||||
|
||||
@Override
|
||||
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
|
||||
|
@ -57,7 +58,7 @@ public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void putEntry(ArchiveOutputStream out,
|
||||
public void putEntry(ArchiveOutputStream<TarArchiveEntry> out,
|
||||
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
|
||||
throws IOException {
|
||||
tarFormat.putEntry(out, tree, path, mode, loader);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.compress.archivers.ArchiveOutputStream;
|
||||
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
||||
import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream;
|
||||
import org.eclipse.jgit.api.ArchiveCommand;
|
||||
import org.eclipse.jgit.lib.FileMode;
|
||||
|
@ -26,12 +27,12 @@
|
|||
/**
|
||||
* Xz-compressed tar (tar.xz) format.
|
||||
*/
|
||||
public final class TxzFormat extends BaseFormat implements
|
||||
ArchiveCommand.Format<ArchiveOutputStream> {
|
||||
public final class TxzFormat extends BaseFormat
|
||||
implements ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> {
|
||||
private static final List<String> SUFFIXES = Collections
|
||||
.unmodifiableList(Arrays.asList(".tar.xz", ".txz")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private final ArchiveCommand.Format<ArchiveOutputStream> tarFormat = new TarFormat();
|
||||
private final ArchiveCommand.Format<ArchiveOutputStream<TarArchiveEntry>> tarFormat = new TarFormat();
|
||||
|
||||
@Override
|
||||
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
|
||||
|
@ -54,7 +55,7 @@ public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void putEntry(ArchiveOutputStream out,
|
||||
public void putEntry(ArchiveOutputStream<TarArchiveEntry> out,
|
||||
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
|
||||
throws IOException {
|
||||
tarFormat.putEntry(out, tree, path, mode, loader);
|
||||
|
|
Loading…
Reference in New Issue