Skip to content

Commit b790075

Browse files
committed
Defensively check existence of file
1 parent da3a216 commit b790075

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/samm-cli/src/main/java/org/eclipse/esmf/FileInputHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ protected String expectedAspectName() {
7373
}
7474

7575
public static boolean appliesToInput( final String input ) {
76-
return absoluteFile( new File( input ) ).exists();
76+
try {
77+
return absoluteFile( new File( input ) ).exists();
78+
} catch ( final Exception exception ) {
79+
// This could file with e.g. a InvalidPathException or with platform-specific exceptions when the input is indeed not a valid file
80+
return false;
81+
}
7782
}
7883

7984
@Override

0 commit comments

Comments
 (0)