Repository: karaf-cave Updated Branches: refs/heads/cave-2.x d245aafa7 -> 14c712633
[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/14c71263 Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/14c71263 Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/14c71263 Branch: refs/heads/cave-2.x Commit: 14c7126339640033e77219b2ebf610fb95f9a105 Parents: d245aaf Author: Jean-Baptiste Onofré <[email protected]> Authored: Fri Jul 3 17:17:54 2015 +0200 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Fri Jul 3 17:17:54 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/14c71263/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 735067f..ac758d8 100644 --- a/pom.xml +++ b/pom.xml @@ -164,7 +164,7 @@ <version>[3.0,4)</version> </requireMavenVersion> <requireJavaVersion> - <version>[1.7,1.8]</version> + <version>[1.7,1.8)</version> </requireJavaVersion> </rules> </configuration> http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/14c71263/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..f668c62 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,14 +186,18 @@ 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 { os = new FileOutputStream(location); + if (!location.exists()) { + location.getParentFile().mkdirs(); + location.createNewFile(); + } properties.store(os, comment); } finally { if (os != null) {
