Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/org/codehaus/plexus/archiver/AbstractArchiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,20 @@ public void setIncludeEmptyDirs(final boolean includeEmptyDirs) {
}

@Override
@Deprecated
public void addDirectory(@Nonnull final File directory) throws ArchiverException {
addFileSet(fileSet(directory).prefixed("").includeExclude(null, null).includeEmptyDirs(includeEmptyDirs));
}

@Override
@Deprecated
public void addDirectory(@Nonnull final File directory, final String prefix) throws ArchiverException {
addFileSet(
fileSet(directory).prefixed(prefix).includeExclude(null, null).includeEmptyDirs(includeEmptyDirs));
}

@Override
@Deprecated
public void addDirectory(@Nonnull final File directory, final String[] includes, final String[] excludes)
throws ArchiverException {
addFileSet(fileSet(directory)
Expand All @@ -304,6 +307,7 @@ public void addDirectory(@Nonnull final File directory, final String[] includes,
}

@Override
@Deprecated
public void addDirectory(
@Nonnull final File directory, final String prefix, final String[] includes, final String[] excludes)
throws ArchiverException {
Expand Down Expand Up @@ -613,6 +617,7 @@ private static void closeQuietlyIfCloseable(Object resource) {
}

@Override
@Deprecated
public Map<String, ArchiveEntry> getFiles() {
try {
final Map<String, ArchiveEntry> map = new HashMap<>();
Expand Down Expand Up @@ -719,6 +724,7 @@ public void addArchivedFileSet(final ArchivedFileSet fileSet, Charset charset) t
* @since 1.0-alpha-7
*/
@Override
@Deprecated
public void addArchivedFileSet(
@Nonnull final File archiveFile, final String prefix, final String[] includes, final String[] excludes)
throws ArchiverException {
Expand All @@ -732,6 +738,7 @@ public void addArchivedFileSet(
* @since 1.0-alpha-7
*/
@Override
@Deprecated
public void addArchivedFileSet(@Nonnull final File archiveFile, final String prefix) throws ArchiverException {
addArchivedFileSet(archivedFileSet(archiveFile).prefixed(prefix).includeEmptyDirs(includeEmptyDirs));
}
Expand All @@ -740,6 +747,7 @@ public void addArchivedFileSet(@Nonnull final File archiveFile, final String pre
* @since 1.0-alpha-7
*/
@Override
@Deprecated
public void addArchivedFileSet(@Nonnull final File archiveFile, final String[] includes, final String[] excludes)
throws ArchiverException {
addArchivedFileSet(
Expand All @@ -750,6 +758,7 @@ public void addArchivedFileSet(@Nonnull final File archiveFile, final String[] i
* @since 1.0-alpha-7
*/
@Override
@Deprecated
public void addArchivedFileSet(@Nonnull final File archiveFile) throws ArchiverException {
addArchivedFileSet(archivedFileSet(archiveFile).includeEmptyDirs(includeEmptyDirs));
}
Expand Down Expand Up @@ -960,6 +969,7 @@ protected void cleanUp() throws IOException {
* @since 1.1
*/
@Override
@Deprecated
public boolean isUseJvmChmod() {
return useJvmChmod;
}
Expand All @@ -968,6 +978,7 @@ public boolean isUseJvmChmod() {
* @since 1.1
*/
@Override
@Deprecated
public void setUseJvmChmod(final boolean useJvmChmod) {
this.useJvmChmod = useJvmChmod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ protected boolean isSelected(final String fileName, final PlexusIoResource fileI
* @since 1.1
*/
@Override
@Deprecated
public boolean isUseJvmChmod() {
return useJvmChmod;
}
Expand All @@ -251,6 +252,7 @@ public boolean isUseJvmChmod() {
* @since 1.1
*/
@Override
@Deprecated
public void setUseJvmChmod(final boolean useJvmChmod) {
this.useJvmChmod = useJvmChmod;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/codehaus/plexus/archiver/Archiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ void addDirectory(@Nonnull File directory, String prefix, String[] includes, Str
*
* @deprecated Will go away in next major version
*/
@Deprecated
void addArchivedFileSet(@Nonnull File archiveFile) throws ArchiverException;

/**
Expand Down Expand Up @@ -261,6 +262,7 @@ void addArchivedFileSet(@Nonnull File archiveFile, String prefix, String[] inclu
/**
* @deprecated Use {@link #getResources()}
*/
@Deprecated
Map<String, ArchiveEntry> getFiles();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;

import org.codehaus.plexus.components.io.attributes.FileAttributes;
import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
Expand All @@ -31,7 +30,7 @@ public class PlexusIoBzip2ResourceCollection extends PlexusIoCompressedFileResou

@Override
protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
return new FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
return new FileAttributes(file);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public ResourceIterator getResources() throws ArchiverException {
}

@Override
@Deprecated
public Map<String, ArchiveEntry> getFiles() {
return target.getFiles();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private void debug(final String message) {
* {@inheritDoc}
*/
@Override
@Deprecated
public void addArchivedFileSet(final @Nonnull File archiveFile, final String prefix) throws ArchiverException {
debug("DRY RUN: Skipping delegated call to: " + getMethodName());
}
Expand Down Expand Up @@ -115,6 +116,7 @@ public void addSymlink(String symlinkName, int permissions, String symlinkDestin
* {@inheritDoc}
*/
@Override
@Deprecated
public void addDirectory(final @Nonnull File directory, final String prefix) throws ArchiverException {
debug("DRY RUN: Skipping delegated call to: " + getMethodName());
}
Expand All @@ -123,6 +125,7 @@ public void addDirectory(final @Nonnull File directory, final String prefix) thr
* {@inheritDoc}
*/
@Override
@Deprecated
public void addDirectory(final @Nonnull File directory, final String[] includes, final String[] excludes)
throws ArchiverException {
debug("DRY RUN: Skipping delegated call to: " + getMethodName());
Expand All @@ -132,6 +135,7 @@ public void addDirectory(final @Nonnull File directory, final String[] includes,
* {@inheritDoc}
*/
@Override
@Deprecated
public void addDirectory(final @Nonnull File directory) throws ArchiverException {
debug("DRY RUN: Skipping delegated call to: " + getMethodName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ public void addDirectory(@Nonnull File directory) throws ArchiverException {}
public void addDirectory(@Nonnull File directory, String prefix) throws ArchiverException {}

@Override
@Deprecated
public void addDirectory(@Nonnull File directory, String[] includes, String[] excludes) throws ArchiverException {}

@Override
@Deprecated
public void addDirectory(@Nonnull File directory, String prefix, String[] includes, String[] excludes)
throws ArchiverException {}

Expand All @@ -78,15 +80,18 @@ public void addFile(@Nonnull File inputFile, @Nonnull String destFileName, int p
throws ArchiverException {}

@Override
@Deprecated
public void addArchivedFileSet(@Nonnull File archiveFile) throws ArchiverException {}

@Override
@Deprecated
public void addArchivedFileSet(@Nonnull File archiveFile, String prefix) throws ArchiverException {}

@Override
public void addArchivedFileSet(File archiveFile, String[] includes, String[] excludes) throws ArchiverException {}

@Override
@Deprecated
public void addArchivedFileSet(@Nonnull File archiveFile, String prefix, String[] includes, String[] excludes)
throws ArchiverException {}

Expand Down Expand Up @@ -186,6 +191,7 @@ public void remove() {
}

@Override
@Deprecated
public Map<String, ArchiveEntry> getFiles() {
return Collections.emptyMap();
}
Expand All @@ -212,11 +218,13 @@ public String getDuplicateBehavior() {
public void setDuplicateBehavior(String duplicate) {}

@Override
@Deprecated
public void setUseJvmChmod(boolean useJvmChmod) {
this.useJvmChmod = useJvmChmod;
}

@Override
@Deprecated
public boolean isUseJvmChmod() {
return useJvmChmod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,20 @@ public void addDirectory(final @Nonnull File directory) throws ArchiverException
}

@Override
@Deprecated
public void addDirectory(final @Nonnull File directory, final String prefix) throws ArchiverException {
added.add(new Addition(directory, prefix, null, null, PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE));
}

@Override
@Deprecated
public void addDirectory(final @Nonnull File directory, final String[] includes, final String[] excludes)
throws ArchiverException {
added.add(new Addition(directory, null, includes, excludes, PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE));
}

@Override
@Deprecated
public void addDirectory(
final @Nonnull File directory, final String prefix, final String[] includes, final String[] excludes)
throws ArchiverException {
Expand Down Expand Up @@ -107,6 +110,7 @@ public void addArchivedFileSet(final @Nonnull File archiveFile) throws ArchiverE
}

@Override
@Deprecated
public void addArchivedFileSet(final @Nonnull File archiveFile, final String prefix) throws ArchiverException {
added.add(new Addition(archiveFile, prefix, null, null, PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE));
}
Expand All @@ -122,12 +126,14 @@ public void addSymlink(String s, int i, String s2) throws ArchiverException {
}

@Override
@Deprecated
public void addArchivedFileSet(final File archiveFile, final String[] includes, final String[] excludes)
throws ArchiverException {
added.add(new Addition(archiveFile, null, includes, excludes, PlexusIoResourceAttributes.UNKNOWN_OCTAL_MODE));
}

@Override
@Deprecated
public void addArchivedFileSet(
final @Nonnull File archiveFile, final String prefix, final String[] includes, final String[] excludes)
throws ArchiverException {
Expand Down Expand Up @@ -223,6 +229,7 @@ public void setDotFileDirectory(final File dotFileDirectory) {}
}

@Override
@Deprecated
public Map<String, ArchiveEntry> getFiles() {
return new HashMap<>();
}
Expand Down Expand Up @@ -306,11 +313,13 @@ public Addition(
}

@Override
@Deprecated
public boolean isUseJvmChmod() {
return useJvmChmod;
}

@Override
@Deprecated
public void setUseJvmChmod(final boolean useJvmChmod) {
this.useJvmChmod = useJvmChmod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.zip.GZIPInputStream;

import org.codehaus.plexus.components.io.attributes.FileAttributes;
Expand Down Expand Up @@ -36,6 +35,6 @@ protected InputStream getInputStream(File file) throws IOException {

@Override
protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
return new FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
return new FileAttributes(file);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,10 @@ private void grabFilesAndDirs(String file, List<String> dirs, List<String> files
} else if (zipFile.isDirectory()) {
getLogger().info("JarArchiver skipping indexJar " + zipFile + " because it is not a jar");
} else {
try (ZipFile zf = new ZipFile(file, "utf-8")) {
try (ZipFile zf = ZipFile.builder()
.setFile(file)
.setCharset(StandardCharsets.UTF_8)
.get()) {
Enumeration<ZipArchiveEntry> entries = zf.getEntries();
HashSet<String> dirSet = new HashSet<>();
while (entries.hasMoreElements()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private boolean isJarDateOptionSupported(Method runMethod) {
// Test the output code validating the --date option.
String[] args = {"--date", "2099-12-31T23:59:59Z", "--version"};

PrintStream nullPrintStream = NullPrintStream.NULL_PRINT_STREAM;
PrintStream nullPrintStream = NullPrintStream.INSTANCE;
Integer result = (Integer) runMethod.invoke(jarTool, nullPrintStream, nullPrintStream, args);

return result != null && result.intValue() == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;

import org.codehaus.plexus.archiver.util.Streams;
import org.codehaus.plexus.components.io.attributes.FileAttributes;
Expand All @@ -29,7 +28,7 @@ public class PlexusIoSnappyResourceCollection extends PlexusIoCompressedFileReso

@Override
protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
return new FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
return new FileAttributes(file);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/codehaus/plexus/archiver/tar/TarFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Enumeration<org.apache.commons.compress.archivers.ArchiveEntry> getEntrie
public boolean hasMoreElements() {
if (!currentEntryValid) {
try {
currentEntry = inputStream.getNextTarEntry();
currentEntry = inputStream.getNextEntry();
} catch (IOException e) {
throw new UndeclaredThrowableException(e);
}
Expand Down Expand Up @@ -155,7 +155,7 @@ private void open() throws IOException {

private boolean findEntry(TarArchiveEntry entry, TarArchiveEntry currentEntry) throws IOException {
for (; ; ) {
this.currentEntry = inputStream.getNextTarEntry();
this.currentEntry = inputStream.getNextEntry();
if (this.currentEntry == null || (currentEntry != null && this.currentEntry.equals(currentEntry))) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void execute(File sourceFile, File destDirectory, FileMapper[] fileMap
try (TarArchiveInputStream tis = new TarArchiveInputStream(
decompress(compression, sourceFile, bufferedInputStream(fileInputStream(sourceFile))))) {
TarArchiveEntry te;
while ((te = tis.getNextTarEntry()) != null) {
while ((te = tis.getNextEntry()) != null) {
TarResource fileInfo = new TarResource(tarFile, te);
if (isSelected(te.getName(), fileInfo)) {
final String symlinkDestination = te.isSymbolicLink() ? te.getLinkName() : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;

import org.codehaus.plexus.archiver.util.Streams;
import org.codehaus.plexus.components.io.attributes.FileAttributes;
Expand All @@ -36,7 +35,7 @@ public class PlexusIoXZResourceCollection extends PlexusIoCompressedFileResource

@Override
protected PlexusIoResourceAttributes getAttributes(File file) throws IOException {
return new FileAttributes(file, new HashMap<Integer, String>(), new HashMap<Integer, String>());
return new FileAttributes(file);
}

@Override
Expand Down
Loading
Loading