Skip to content

Commit

Permalink
[api] Avoid exception if SecurityManager is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu committed Jun 20, 2023
1 parent 8f841e6 commit f7ab0f1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/src/main/java/ai/djl/util/Ec2Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ private Ec2Utils() {}
* @return true if the current environment is SageMaker
*/
public static boolean isSageMaker() {
return Files.exists(Paths.get(ENDPOINT_METADATA_FILE));
try {
return Files.exists(Paths.get(ENDPOINT_METADATA_FILE));
} catch (SecurityException e) {
logger.warn("Security manager doesn't allow access file");
return false;
}
}

/**
Expand Down

0 comments on commit f7ab0f1

Please sign in to comment.