Revert commit 7131e1c028e0035de548c6b37e1e8c9624417440.
authorJaikiran Pai <jaikiran@apache.org>
Mon, 10 Sep 2018 13:34:42 +0000 (19:04 +0530)
committerJaikiran Pai <jaikiran@apache.org>
Mon, 10 Sep 2018 13:34:42 +0000 (19:04 +0530)
src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
test/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManagerTest.java

index 91257b0..540cf92 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.ivy.core.cache;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.charset.StandardCharsets;
@@ -1010,7 +1011,7 @@ public class DefaultRepositoryCacheManager implements RepositoryCacheManager, Iv
                         if (useOrigin && artifactRes.isLocal()) {
                             if (artifactRes instanceof LocalizableResource) {
                                 origin.setLocation(((LocalizableResource) artifactRes).getFile()
-                                        .toURI().toURL().toExternalForm());
+                                        .getAbsolutePath());
                             }
                             saveArtifactOrigin(artifact, origin);
                             archiveFile = getArchiveFileInCache(artifact, origin);
index ff00a32..2333802 100644 (file)
@@ -24,7 +24,6 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.net.URL;
 import java.util.Date;
 
 import org.apache.ivy.Ivy;
@@ -49,7 +48,6 @@ import org.apache.ivy.util.Message;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Delete;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -194,23 +192,6 @@ public class DefaultRepositoryCacheManagerTest {
         assertEquals(rmr11, rmrFromCache);
     }
 
-    /**
-     * Tests that the {@link ArtifactOrigin#getLocation()} and {@link ArtifactOrigin#setLocation(String)} values
-     * are treated as {@link URL} while saving and retrieving the artifact origin information
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testArtificationOriginalLocation() throws Exception {
-        final Artifact simpleArtifact = createArtifact("org", "dummy", "1.0.0", "hello", "jar", "jar");
-        final URL location = new File("dummylocation").toURI().toURL();
-        final ArtifactOrigin originatedFrom = new ArtifactOrigin(simpleArtifact, true, location.toExternalForm());
-        cacheManager.saveArtifactOrigin(simpleArtifact, originatedFrom);
-        final ArtifactOrigin restored = cacheManager.getSavedArtifactOrigin(simpleArtifact);
-        Assert.assertNotNull("Location of artifact origin wasn't expected to be null", restored.getLocation());
-        Assert.assertEquals("Unexpected artifact origin location", location, new URL(restored.getLocation()));
-    }
-
     private static DefaultArtifact createArtifact(String org, String module, String rev,
                                                   String name, String type, String ext) {
         ModuleId mid = new ModuleId(org, module);