Skip to content

Commit 28617ed

Browse files
committed
Fix NPE in computing java version
1 parent 4bce9a2 commit 28617ed

File tree

1 file changed

+2
-1
lines changed
  • headless-services/jdt-ls-extension/org.springframework.tooling.jdt.ls.commons/src/org/springframework/tooling/jdt/ls/commons/classpath

1 file changed

+2
-1
lines changed

headless-services/jdt-ls-extension/org.springframework.tooling.jdt.ls.commons/src/org/springframework/tooling/jdt/ls/commons/classpath/ClasspathUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public static Classpath resolve(IJavaProject javaProject, Logger logger) throws
9494
}
9595
}
9696
}
97-
String javaVersion = extractJavaVersion(getJreContainer(javaProject.getRawClasspath()).getPath().lastSegment());
97+
IClasspathEntry jreContainer = getJreContainer(javaProject.getRawClasspath());
98+
String javaVersion = jreContainer == null ? null : extractJavaVersion(jreContainer.getPath().lastSegment());
9899
Classpath classpath = new Classpath(cpEntries, javaVersion);
99100
logger.debug("classpath=" + classpath.getEntries().size() + " entries");
100101
return classpath;

0 commit comments

Comments
 (0)