mirror of https://github.com/apache/ant-ivy
Revert commit ecc271c492.
This commit is contained in:
parent
969ba77e95
commit
ab8112ea24
|
|
@ -20,9 +20,6 @@ package org.apache.ivy.core.cache;
|
||||||
import org.apache.ivy.core.module.descriptor.Artifact;
|
import org.apache.ivy.core.module.descriptor.Artifact;
|
||||||
import org.apache.ivy.util.Checks;
|
import org.apache.ivy.util.Checks;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains information about the origin of an artifact.
|
* This class contains information about the origin of an artifact.
|
||||||
*
|
*
|
||||||
|
|
@ -113,23 +110,6 @@ public class ArtifactOrigin {
|
||||||
this.location = location;
|
this.location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the "location" of an ArtifactOrigin is expected to be URL. However,
|
|
||||||
// in certain versions of Ivy we used to save just the path as the location
|
|
||||||
// instead of the URL form. Here we try and read it as a URL. If it can be
|
|
||||||
// read as a URL, we return the URL#getPath. However, if it can't be read
|
|
||||||
// as a URL, then considering backward compatibility, we treat the "location"
|
|
||||||
// as a path and return it back.
|
|
||||||
String getLocationPath() {
|
|
||||||
if (this.location == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return new URL(this.location).getPath();
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
return this.location;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the artifact that this location is pointing at.
|
* Return the artifact that this location is pointing at.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
public File getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin) {
|
public File getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin) {
|
||||||
File archive = new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
|
File archive = new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
|
||||||
if (!archive.exists() && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
|
if (!archive.exists() && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
|
||||||
File original = Checks.checkAbsolute(origin.getLocationPath(), artifact
|
File original = Checks.checkAbsolute(origin.getLocation(), artifact
|
||||||
+ " origin location");
|
+ " origin location");
|
||||||
if (original.exists()) {
|
if (original.exists()) {
|
||||||
return original;
|
return original;
|
||||||
|
|
@ -406,7 +406,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
|
||||||
*/
|
*/
|
||||||
private File getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin, boolean useOrigin) {
|
private File getArchiveFileInCache(Artifact artifact, ArtifactOrigin origin, boolean useOrigin) {
|
||||||
if (useOrigin && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
|
if (useOrigin && !ArtifactOrigin.isUnknown(origin) && origin.isLocal()) {
|
||||||
return Checks.checkAbsolute(origin.getLocationPath(), artifact + " origin location");
|
return Checks.checkAbsolute(origin.getLocation(), artifact + " origin location");
|
||||||
}
|
}
|
||||||
return new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
|
return new File(getRepositoryCacheRoot(), getArchivePathInCache(artifact, origin));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue