@@ -24,11 +24,11 @@ private FeatureFacade() {}
2424 * Checks that the given file is inside the baseFolder after normalization.
2525 * Throws IOException if not.
2626 */
27- private static void checkIfInBaseFolder (File baseFolder , File file ) throws IOException {
27+ public static void checkIfInBaseFolder (File baseFolder , File file ) throws IOException {
2828 Path base = baseFolder .getCanonicalFile ().toPath ().normalize ();
2929 Path target = file .getCanonicalFile ().toPath ().normalize ();
3030 if (!target .startsWith (base )) {
31- throw new IOException ("File path " + file . getCanonicalPath () + " is not within permitted base folder " + baseFolder .getCanonicalPath ());
31+ throw new IOException ( String . format ( "File path %s is not within permitted base folder %s" , file . getCanonicalPath (), baseFolder .getCanonicalPath () ) );
3232 }
3333 }
3434
@@ -50,17 +50,17 @@ private static void copyResourcesList( File baseFolder, String mode, String id )
5050 }
5151 }
5252
53- protected static void insureParent ( File file ) throws IOException {
53+ public static void insureParent ( File file ) throws IOException {
5454 File parentFile = file .getParentFile ();
5555 // Defensive: check parent is within project's root as well
5656 if (parentFile != null ) {
5757 File baseFolder = file .getParentFile ().getParentFile ();
5858 if (baseFolder != null ) {
5959 checkIfInBaseFolder (baseFolder , parentFile );
6060 }
61- }
62- if ( ! parentFile .exists () ) {
63- log . info ( "creates parent directory {}, mkdirs:? {}" , parentFile . getCanonicalPath (), parentFile . mkdirs () );
61+ if ( ! parentFile . exists () ) {
62+ log . info ( "creates parent directory {}, mkdirs:? {}" , parentFile .getCanonicalPath (), parentFile . mkdirs () );
63+ }
6464 }
6565 }
6666
0 commit comments