GH-995 Wrapped SCF version discovery in AWS Custom Runtime with try/catch
Resolves #995
This commit is contained in:
@@ -266,17 +266,19 @@ public final class CustomRuntimeEventLoop implements SmartLifecycle {
|
||||
}
|
||||
|
||||
private static String extractVersion() {
|
||||
String path = CustomRuntimeEventLoop.class.getProtectionDomain().getCodeSource().getLocation().toString();
|
||||
int endIndex = path.lastIndexOf('.');
|
||||
if (endIndex < 0) {
|
||||
return "UNKNOWN-VERSION";
|
||||
}
|
||||
int startIndex = path.lastIndexOf("/") + 1;
|
||||
try {
|
||||
String path = CustomRuntimeEventLoop.class.getProtectionDomain().getCodeSource().getLocation().toString();
|
||||
int endIndex = path.lastIndexOf('.');
|
||||
if (endIndex < 0) {
|
||||
return "UNKNOWN-VERSION";
|
||||
}
|
||||
int startIndex = path.lastIndexOf("/") + 1;
|
||||
return path.substring(startIndex, endIndex).replace("spring-cloud-function-adapter-aws-", "");
|
||||
}
|
||||
catch (Throwable e) {
|
||||
logger.info("Failed to deterimine framework version");
|
||||
catch (Exception e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to detect version", e);
|
||||
}
|
||||
return "UNKNOWN-VERSION";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user