diff --git a/instrumentation/spring/spring-boot-resources/library/src/main/java/io/opentelemetry/instrumentation/spring/resources/SpringBootServiceNameDetector.java b/instrumentation/spring/spring-boot-resources/library/src/main/java/io/opentelemetry/instrumentation/spring/resources/SpringBootServiceNameDetector.java index 9eccd46b4457..d7a2991ac68e 100644 --- a/instrumentation/spring/spring-boot-resources/library/src/main/java/io/opentelemetry/instrumentation/spring/resources/SpringBootServiceNameDetector.java +++ b/instrumentation/spring/spring-boot-resources/library/src/main/java/io/opentelemetry/instrumentation/spring/resources/SpringBootServiceNameDetector.java @@ -259,7 +259,7 @@ private static String getAppNamePropertyFromStream(InputStream in) { @Nullable private String loadFromClasspath(String filename, Function parser) { try (InputStream in = system.openClasspathResource(filename)) { - return parser.apply(in); + return in != null ? parser.apply(in) : null; } catch (Exception e) { return null; }