Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: admin console setup page: check JRE version with Runtime.Version #2721

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions xmppserver/src/main/webapp/setup/index.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@
boolean openfireHomeExists = false;
Path openfireHome = null;

// Check for JRE 1.8
try {
String version = System.getProperty("java.version");
jreVersionCompatible = Integer.parseInt(version.split("\\.")[0]) >= 11;
}
catch (Throwable t) {}
// Check for min JRE requirement
Runtime.Version MIN_JAVA_VERSION = Runtime.Version.parse("11");
jreVersionCompatible = MIN_JAVA_VERSION.compareTo(Runtime.version()) <= 0;
Comment on lines +46 to +48

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider extracting the MIN_JAVA_VERSION constant to a more global scope if it's used elsewhere, or making it a static final field within the JSP if it's specific to this page. This would improve readability and maintainability.

Comment on lines +47 to +48
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a user runs Java 8, this will fail, since the Runtime API was introduced in Java 10.

I suspect other stuff will also fail in Java 8 too though... @guusdk ?

// Check for Servlet 2.3:
try {
Class c = ClassUtils.forName("javax.servlet.http.HttpSession");
Expand Down
Loading