Skip to content

Commit

Permalink
fix: update java version check (#6297)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong authored Dec 15, 2023
1 parent fcbf70f commit fe2e0d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static int getJavaVersion() {
*/
public static int getJavaUpdateVersion() {
//"1.8.0_144" "11.0.2+9" "17.0.8.1"
String runtimeVersion = System.getProperty("java.runtime.version");
String runtimeVersion = System.getProperty("java.version");
return parseUpdate(runtimeVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
package org.owasp.dependencycheck.utils;

import org.junit.Test;

import static org.junit.Assert.*;

/**
*
* @author Jeremy Long
*/
public class UtilsTest {
Expand All @@ -47,6 +47,11 @@ public void testParseUpdate() {
result = Utils.parseUpdate(runtimeVersion);
assertEquals(expResult, result);

runtimeVersion = "11.0.2";
expResult = 2;
result = Utils.parseUpdate(runtimeVersion);
assertEquals(expResult, result);

runtimeVersion = "17.0.8.1";
expResult = 8;
result = Utils.parseUpdate(runtimeVersion);
Expand Down

0 comments on commit fe2e0d8

Please sign in to comment.