Skip to content

Commit

Permalink
- pulled in PR audit4j#94, keep support but deprecated getjavaersion()
Browse files Browse the repository at this point in the history
- bumped version to 2.6.2-ghx
  • Loading branch information
Yu Chen committed Mar 15, 2021
1 parent a5f6867 commit 7ee3c34
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 43 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<artifactId>audit4j-core</artifactId>
<packaging>jar</packaging>
<name>Audit4j - Core</name>
<version>2.6.1-ghx</version>
<version>2.6.2-ghx</version>
<url>http://audit4j.org</url>
<description>Audit4j - An open-source auditing framework for Java, Core</description>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/audit4j/core/CoreConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class CoreConstants {
public static final String APP_NAME = "Audit4j";

/** The Constant RELEASE_VERSION. */
public static final String RELEASE_VERSION = "2.5.0";
public static final String RELEASE_VERSION = "2.6.2-ghx";

/** The Constant RELEASE_DATE. */
public static final String RELEASE_DATE = "2015-11-01T12:40:21.077Z";
Expand Down
48 changes: 7 additions & 41 deletions src/main/java/org/audit4j/core/util/EnvUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
package org.audit4j.core.util;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletContext;

Expand All @@ -33,69 +31,38 @@
*/
public class EnvUtil {


/**
* private constructor to avoid instantiation of this class
*/
private EnvUtil(){

}

/**
* Checks if is jD k_ n_ or higher.
*
* @param n
* the n
* @return true, if is jD k_ n_ or higher
*/
private static boolean isJDK_N_OrHigher(int n) {
List<String> versionList = new ArrayList<String>();
// this code should work at least until JDK 10 (assuming n parameter is
// always 6 or more)
for (int i = 0; i < 5; i++) {
//Till JDK 1.8 versioning is 1.x after 10 its will JDK N.x
if(n + i<10)
versionList.add("1." + (n + i));
else
versionList.add((n + i)+".");
}

String javaVersion = System.getProperty("java.version");
if (javaVersion == null) {
return false;
}
for (String v : versionList) {
if (javaVersion.startsWith(v))
return true;
}
return false;
}

/**
* Checks if is jD k5.
* Checks if is jDK5.
*
* @return true, if is jD k5
*/
static public boolean isJDK5() {
return isJDK_N_OrHigher(5);
return JavaVersion.isJDK_N_OrHigher(5, getJavaVersion());
}

/**
* Checks if is jD k6 or higher.
* Checks if is jDK6 or higher.
*
* @return true, if is jD k6 or higher
*/
static public boolean isJDK6OrHigher() {
return isJDK_N_OrHigher(6);
return JavaVersion.isJDK_N_OrHigher(6, getJavaVersion());
}

/**
* Checks if is jD k7 or higher.
* Checks if is jDK7 or higher.
*
* @return true, if is jD k7 or higher
*/
static public boolean isJDK7OrHigher() {
return isJDK_N_OrHigher(7);
return JavaVersion.isJDK_N_OrHigher(7, getJavaVersion());
}


Expand Down Expand Up @@ -126,8 +93,7 @@ static public boolean isJaninoAvailable() {
/**
* Checks if is servlet spec 3 or higher.
*
* @param context
* the context
* @param context the context
* @return true, if is servlet spec3 or higher
*/
public static boolean isServletSpec3OrHigher(ServletContext context) {
Expand Down

0 comments on commit 7ee3c34

Please sign in to comment.