Repository: karaf-cave Updated Branches: refs/heads/cave-3.x 14a5d6167 -> ba1b0c207
[KARAF-3826] Create the directory and cave repository properties file if needed Project: http://git-wip-us.apache.org/repos/asf/karaf-cave/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf-cave/commit/ba1b0c20 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/ba1b0c20 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/ba1b0c20 Branch: refs/heads/cave-3.x Commit: ba1b0c20773b353f51a061d138d471e31b4e84f4 Parents: 14a5d61 Author: Jean-Baptiste Onofré <[email protected]> Authored: Fri Jul 3 17:08:38 2015 +0200 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Fri Jul 3 17:08:38 2015 +0200 ---------------------------------------------------------------------- pom.xml | 2 +- .../server/storage/CaveRepositoryServiceImpl.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/ba1b0c20/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 54e64a6..2c9547b 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,7 @@ <version>[3.0,4)</version> </requireMavenVersion> <requireJavaVersion> - <version>[1.7,1.8]</version> + <version>[1.7,1.9)</version> </requireJavaVersion> </rules> </configuration> http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/ba1b0c20/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java index eb1ec8a..eb7f6d9 100644 --- a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java +++ b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/CaveRepositoryServiceImpl.java @@ -62,7 +62,7 @@ public class CaveRepositoryServiceImpl implements CaveRepositoryService { * * @param name the name of the repository * @param scan if true, the repository is scanned at creation time. - * @return the Cave repository. + * @return the Cave repository. * @throws Exception in case of creation failure. */ public synchronized CaveRepository create(String name, boolean scan) throws Exception { @@ -73,9 +73,9 @@ public class CaveRepositoryServiceImpl implements CaveRepositoryService { /** * Create a Cave repository. * - * @param name the name of the repository. + * @param name the name of the repository. * @param location the storage location of the repository. - * @param scan if true, the repository is scanned at creation time. + * @param scan if true, the repository is scanned at creation time. * @return the Cave repository. * @throws Exception in case of creation failure. */ @@ -106,6 +106,7 @@ public class CaveRepositoryServiceImpl implements CaveRepositoryService { /** * Remove a Cave repository from the repositories registry. + * * @param name the name of the repository. * @throws Exception */ @@ -185,13 +186,17 @@ public class CaveRepositoryServiceImpl implements CaveRepositoryService { * Write the Cave repositories storage properties into a file. * * @param properties the Cave repositories storage properties. - * @param location the output file location. - * @param comment a comment to write in the properties file. + * @param location the output file location. + * @param comment a comment to write in the properties file. * @throws IOException in case of saving failure. */ private void saveStorage(Properties properties, File location, String comment) throws IOException { OutputStream os = null; try { + if (!location.exists()) { + location.getParentFile().mkdirs(); + location.createNewFile(); + } os = new FileOutputStream(location); properties.store(os, comment); } finally {
