in spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationHome.java [90:103]
private File findSource(Class<?> sourceClass) {
try {
ProtectionDomain domain = (sourceClass != null) ? sourceClass.getProtectionDomain() : null;
CodeSource codeSource = (domain != null) ? domain.getCodeSource() : null;
URL location = (codeSource != null) ? codeSource.getLocation() : null;
File source = (location != null) ? findSource(location) : null;
if (source != null && source.exists() && !isUnitTest()) {
return source.getAbsoluteFile();
}
}
catch (Exception ex) {
}
return null;
}