1313import java .nio .file .Path ;
1414import java .util .ArrayList ;
1515import java .util .List ;
16+ import java .util .Objects ;
1617import java .util .Optional ;
1718import org .slf4j .Logger ;
1819import org .slf4j .LoggerFactory ;
@@ -24,12 +25,16 @@ public class FileBasedArtifactService implements BaseArtifactService {
2425 private final Path root ;
2526
2627 public FileBasedArtifactService (Path root ) {
27- this .root = root ;
28- try {
29- Files .createDirectories (root );
30- } catch (IOException e ) {
31- LOGGER .error ("Failed to create artifacts directory" , e );
28+ Objects .requireNonNull (root , "root path cannot be null" );
29+ if (!Files .exists (root )) {
30+ try {
31+ Files .createDirectories (root );
32+ } catch (IOException e ) {
33+ LOGGER .error ("Failed to create artifacts directory" , e );
34+ }
3235 }
36+ this .root = root .normalize ().toAbsolutePath ();
37+ LOGGER .info ("Artifacts saved to {}" , this .root );
3338 }
3439
3540 @ Override
@@ -140,7 +145,5 @@ private boolean fileHasUserNamespace(String filename) {
140145 return filename != null && filename .startsWith ("user:" );
141146 }
142147
143- record PathAndVersion (Path path , Integer version ) {
144-
145- }
148+ record PathAndVersion (Path path , Integer version ) {}
146149}
0 commit comments