File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
extide/gradle/src/org/netbeans/modules/gradle Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -143,8 +143,13 @@ private static int getJavaMajorVersion(File javaHome) {
143143
144144 }
145145 String javaVersion = releasePros .getProperty ("JAVA_VERSION" ); //NOI18N
146+ // This should look like "17" or "17.0.9"
147+ //TODO: Use Runtime.Version (when we move to Java 11)
146148 if ((javaVersion != null ) && javaVersion .startsWith ("\" " ) && javaVersion .endsWith ("\" " )) {
147- javaVersion = javaVersion .substring (1 , javaVersion .indexOf ('.' ));
149+ int dot = javaVersion .indexOf ('.' );
150+ javaVersion = dot > 0
151+ ? javaVersion .substring (1 , javaVersion .indexOf ('.' ))
152+ : javaVersion .substring (1 , javaVersion .length () - 1 );
148153 try {
149154 ret = Integer .parseInt (javaVersion );
150155 } catch (NumberFormatException ex ) {
You can’t perform that action at this time.
0 commit comments