FELIX-3011: make sure dump locations are writable

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1140888 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 6417cdd..fd31a98 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -450,7 +450,9 @@
             getLog().debug( "BND Instructions:" + NL + dumpInstructions( builder.getProperties(), buf ) );
             if ( dumpInstructions != null )
             {
-                FileUtils.fileWrite( dumpInstructions, buf.toString() );
+                getLog().info( "Writing BND instructions to " + dumpInstructions );
+                dumpInstructions.getParentFile().mkdirs();
+                FileUtils.fileWrite( dumpInstructions, "# BND instructions" + NL + buf );
             }
         }
 
@@ -460,7 +462,9 @@
             getLog().debug( "BND Classpath:" + NL + dumpClasspath( builder.getClasspath(), buf ) );
             if ( dumpClasspath != null )
             {
-                FileUtils.fileWrite( dumpClasspath, buf.toString() );
+                getLog().info( "Writing BND classpath to " + dumpClasspath );
+                dumpClasspath.getParentFile().mkdirs();
+                FileUtils.fileWrite( dumpClasspath, "# BND classpath" + NL + buf );
             }
         }
     }