You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2015/05/12 20:53:48 UTC
karaf-cave git commit: Support re-uploading an artifact
Repository: karaf-cave
Updated Branches:
refs/heads/master 48e7e98e5 -> 8c2e709e6
Support re-uploading an artifact
Project: http://git-wip-us.apache.org/repos/asf/karaf-cave/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf-cave/commit/8c2e709e
Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/8c2e709e
Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/8c2e709e
Branch: refs/heads/master
Commit: 8c2e709e6aef00c2398068084cc21f70b21b3dd1
Parents: 48e7e98
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue May 12 20:53:36 2015 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue May 12 20:53:36 2015 +0200
----------------------------------------------------------------------
.../apache/karaf/cave/server/storage/CaveRepositoryImpl.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/8c2e709e/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
index a0f3397..edb8a63 100644
--- a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
+++ b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryImpl.java
@@ -27,6 +27,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -303,7 +304,7 @@ public class CaveRepositoryImpl implements CaveRepository {
}
}
- Map<String, String> getHeaders(URL url) throws IOException {
+ Map<String, String> getHeaders(URL url) throws IOException, BundleException {
try (InputStream is = url.openStream()) {
ZipInputStream zis = new ZipInputStream(is);
ZipEntry entry;
@@ -318,7 +319,7 @@ public class CaveRepositoryImpl implements CaveRepository {
}
}
}
- throw new IllegalArgumentException("Resource " + url + " does not contain a manifest");
+ throw new BundleException("Resource " + url + " does not contain a manifest");
}
/**
@@ -420,7 +421,7 @@ public class CaveRepositoryImpl implements CaveRepository {
// copy the resource
Path destination = getLocationPath().resolve(filesystem.getName());
LOGGER.debug("Copy from {} to {}", filesystem.getAbsolutePath(), destination.toAbsolutePath().toString());
- Files.copy(filesystem.toPath(), destination);
+ Files.copy(filesystem.toPath(), destination, StandardCopyOption.REPLACE_EXISTING);
if (update) {
resource = createResource(destination.toUri().toURL());
LOGGER.debug("Update the OBR metadata with {}-{}", ResolverUtil.getSymbolicName(resource), ResolverUtil.getVersion(resource));