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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.LinkedHashSet;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem;
import org.apache.maven.plugins.dependency.utils.DependencyUtil;
Expand Down Expand Up @@ -284,7 +283,7 @@ public boolean isArtifactIncluded(ArtifactItem item) throws ArtifactFilterExcept
}

File destFile;
if (StringUtils.isEmpty(item.getDestFileName())) {
if (item.getDestFileName() == null || item.getDestFileName().isEmpty()) {
String formattedFileName = DependencyUtil.getFormattedFileName(
artifact, removeVersion, prependGroupId, useBaseVersion, removeClassifier);
destFile = new File(destFolder, formattedFileName);
Expand All @@ -298,13 +297,13 @@ public boolean isArtifactIncluded(ArtifactItem item) throws ArtifactFilterExcept
}

/**
* Using simply {@code File.getLastModified} will return sometimes a wrong value see JDK bug for details.
* {@code File.getLastModified} sometimes returns a wrong value. See JDK bug for details.
* <p>
* https://bugs.openjdk.java.net/browse/JDK-8177809
*
* @param file {@link File}
* @return the last modification time in milliseconds.
* @throws ArtifactFilterException in case of a IO Exception.
* @throws ArtifactFilterException in case of an IOException
*/
private long getLastModified(File file) throws ArtifactFilterException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.io.File;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugins.dependency.fromConfiguration.ArtifactItem;

/**
Expand Down Expand Up @@ -52,22 +51,22 @@ public UnpackFileMarkerHandler(ArtifactItem artifactItem, File markerFilesDirect
protected File getMarkerFile() {
/*
* Build a hash of all include/exclude strings, to determine if an artifactItem has been unpacked using the
* include/exclude parameters, this will allow an artifact to be included multiple times with different
* include/exclude parameters
* include/exclude parameters. This allows an artifact to be included multiple times with different
* include/exclude parameters.
*/
File markerFile;
if (this.artifactItem == null
|| (StringUtils.isEmpty(this.artifactItem.getIncludes())
&& StringUtils.isEmpty(this.artifactItem.getExcludes()))) {
|| this.artifactItem.getIncludes().isEmpty()
&& this.artifactItem.getExcludes().isEmpty()) {
markerFile = super.getMarkerFile();
} else {
int includeExcludeHash = 0;

if (StringUtils.isNotEmpty(this.artifactItem.getIncludes())) {
if (!this.artifactItem.getIncludes().isEmpty()) {
includeExcludeHash += this.artifactItem.getIncludes().hashCode();
}

if (StringUtils.isNotEmpty(this.artifactItem.getExcludes())) {
if (!this.artifactItem.getExcludes().isEmpty()) {
includeExcludeHash += this.artifactItem.getExcludes().hashCode();
}

Expand Down