fix: admin console setup page: check JRE version with Runtime.Version
Split from #2563 to simplify of review.
Fixed a bug that I had on 23-ea OpenJDK version.
Use Runtime.version() to compare JRE version. It works correctly now.
Yes, but the min jdk was raised to 11 in openfire v4.9 and then to 17 in v5.0
By that measure, why have the check at all?
This is pre-instalation check for the min JDK
So we should make sure it errors gracefully on Java 8?
if the OF was compiled with -source 11 level then the class files may have a new bytecode instructions and when starting on older JRE the java.lang.UnsupportedClassVersionError may occur. It may be need to test if you can get to the page in the JRE8
That would be interesting: can we get to this page using JRE8? If so, then I believe that we should generate a 'proper' error message, rather than having an UnsupportedClassVersionError or something similar. As Openfire has been using Java 8 for years, I do suspect that a lot of people will still use Java 8 when installing Openfire. Let's give them a clear error condition, rather than a weird stack trace.
What was the original problem with 23-ea? Maybe we can resolve that in a way that doesn't involve using API not available in Java 8?
This all seems very puzzling to me.
- I would be surprised that you could to get to the referenced code when invoked from Java 8
- I sort of agree with Fishbowler and wonder why this check exists at all?
- Moreover, this check needs to reference something more global in scope than a magic number buried in a JSP
Anybody wish to champion getting this across the finish line for Openfire 5.0 ?
I guess no one will try to install the Openfire on the JRE8, 9, 10 or at least they'll figure out themselves in a such situation. I had a real bug, not critical, but still. So I think it may be better to merge the PR.
If not, then the simpler fix would be to keep the old version parsing but split also by hyphen - i.e. replace version.split("\\.") with version.split("[-.]+")