Repository: karaf-cave Updated Branches: refs/heads/master ff53705c9 -> 7fd5b52b7
[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/7fd5b52b Tree: http://git-wip-us.apache.org/repos/asf/karaf-cave/tree/7fd5b52b Diff: http://git-wip-us.apache.org/repos/asf/karaf-cave/diff/7fd5b52b Branch: refs/heads/master Commit: 7fd5b52b74fde3f6518ebcd7105a2ffe9055e4d3 Parents: ff53705 Author: Jean-Baptiste Onofré <[email protected]> Authored: Fri Jul 3 16:49:53 2015 +0200 Committer: Jean-Baptiste Onofré <[email protected]> Committed: Fri Jul 3 16:49:53 2015 +0200 ---------------------------------------------------------------------- .../karaf/cave/server/storage/Activator.java | 17 ----------------- .../server/storage/CaveRepositoryServiceImpl.java | 4 ++++ 2 files changed, 4 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/7fd5b52b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/Activator.java ---------------------------------------------------------------------- diff --git a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/Activator.java b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/Activator.java index c24e1f8..379dc8f 100644 --- a/server/storage/src/main/java/org/apache/karaf/cave/server/storage/Activator.java +++ b/server/storage/src/main/java/org/apache/karaf/cave/server/storage/Activator.java @@ -17,32 +17,15 @@ package org.apache.karaf.cave.server.storage; import java.io.File; -import java.util.Hashtable; import org.apache.karaf.cave.server.api.CaveRepositoryService; import org.apache.karaf.util.tracker.BaseActivator; import org.apache.karaf.util.tracker.annotation.Managed; import org.apache.karaf.util.tracker.annotation.ProvideService; -import org.apache.karaf.util.tracker.annotation.RequireService; import org.apache.karaf.util.tracker.annotation.Services; import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceRegistration; import org.osgi.service.cm.ManagedService; -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - @Services( provides = { @ProvideService(CaveRepositoryService.class) } ) http://git-wip-us.apache.org/repos/asf/karaf-cave/blob/7fd5b52b/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 9c0981b..60dba4b 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 @@ -213,6 +213,10 @@ public class CaveRepositoryServiceImpl implements CaveRepositoryService { 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 {
