You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by an...@apache.org on 2010/12/12 20:25:45 UTC
svn commit: r1044893 -
/karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
Author: anierbeck
Date: Sun Dec 12 19:25:45 2010
New Revision: 1044893
URL: http://svn.apache.org/viewvc?rev=1044893&view=rev
Log:
[KARAF-309] Changed the creation of the file, to make sure the directory is created beforehand. The only valid base directory is the karaf.base dir.
Modified:
karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
Modified: karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java?rev=1044893&r1=1044892&r2=1044893&view=diff
==============================================================================
--- karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java (original)
+++ karaf/trunk/features/core/src/main/java/org/apache/karaf/features/internal/FeaturesServiceImpl.java Sun Dec 12 19:25:45 2010
@@ -627,25 +627,22 @@ public class FeaturesServiceImpl impleme
public void installConfigurationFile(String fileLocation, String finalname) throws IOException {
LOGGER.debug("Checking " + fileLocation);
+ String basePath = System.getProperty("karaf.base");
+
if (finalname.indexOf("${") != -1) {
- //found a leading place holder
+ //remove any placeholder or variable part, this is not valid.
int marker = finalname.indexOf("}");
- String placeholder = finalname.substring(2, marker);
finalname = finalname.substring(marker+1);
- String path = System.getProperty(placeholder);
- if (path == null) {
- path = System.getenv(placeholder);
- }
- if (path == null) { //ok this property wasn't found, take the default base dir then
- path = System.getProperty("karaf.base");
- }
-
- finalname = path + File.separator + finalname;
}
+ finalname = basePath + File.separator + finalname;
+
File file = new File(finalname);
if (!file.exists()) {
+ File parentFile = file.getParentFile();
+ if (parentFile != null)
+ parentFile.mkdirs();
file.createNewFile();
}