@@ -24,19 +24,27 @@ public static void main(String[] args) throws IOException {
2424 System .out .print ("Starting validator ..." );
2525 File tempFolder = Files .createTempDirectory ("jsonvalidator" ).toFile ();
2626 Runtime .getRuntime ().addShutdownHook (new Thread (() -> FileUtils .deleteQuietly (tempFolder )));
27+ // Setup folders - start
28+ File resourceFolder = new File (tempFolder , "resources" );
29+ File logFolder = new File (tempFolder , "logs" );
30+ File workFolder = new File (tempFolder , "work" );
31+ if (!resourceFolder .mkdirs () || !logFolder .mkdirs () || !workFolder .mkdirs ()) {
32+ throw new IllegalStateException ("Unable to create work directories under [" +tempFolder .getAbsolutePath ()+"]" );
33+ }
2734 // Set the resource root so that it can be used. This is done before app startup to avoid PostConstruct issues.
28- String resourceRoot = tempFolder .getAbsolutePath ();
35+ String resourceRoot = resourceFolder .getAbsolutePath ();
2936 if (!resourceRoot .endsWith (File .separator )) {
3037 resourceRoot += File .separator ;
3138 }
39+ System .setProperty ("LOG_PATH" , logFolder .getAbsolutePath ());
40+ System .setProperty ("validator.tmpFolder" , workFolder .getAbsolutePath ());
3241 System .setProperty ("validator.resourceRoot" , resourceRoot );
33- prepareConfigForStandalone (tempFolder );
42+ // Setup folders - end
43+ prepareConfigForStandalone (resourceFolder );
3444 // Start the application.
3545 ApplicationContext ctx = SpringApplication .run (Application .class , args );
3646 // Post process config.
3747 ApplicationConfig config = ctx .getBean (ApplicationConfig .class );
38- // Set report folder for use as a temp file generation target.
39- config .setTmpFolder (tempFolder .getAbsolutePath ());
4048 System .out .println (" Done." );
4149 try {
4250 ValidationRunner runner = ctx .getBean (ValidationRunner .class );
0 commit comments