1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-27 12:46:22 +01:00

Fix java runtime finder breaking when encountering a bad release file

Rather than blowing up when a release file can't be parsed, log it and
move on. Hopefully a better runtime comes along.
This commit is contained in:
Henry Le Grys 2021-09-27 21:10:32 +01:00
parent 5c3768f1cf
commit 1c663e1c04
2 changed files with 6 additions and 2 deletions

View File

@ -11,15 +11,18 @@ import com.skcraft.launcher.util.Environment;
import com.skcraft.launcher.util.EnvironmentParser;
import com.skcraft.launcher.util.Platform;
import com.skcraft.launcher.util.WinRegistry;
import lombok.extern.java.Log;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.logging.Level;
/**
* Finds the best Java runtime to use.
*/
@Log
public final class JavaRuntimeFinder {
private JavaRuntimeFinder() {
@ -186,7 +189,8 @@ public final class JavaRuntimeFinder {
return releaseDetails.get("JAVA_VERSION");
} catch (IOException e) {
throw new RuntimeException("Failed to read release file", e);
log.log(Level.WARNING, "Failed to read release file " + releaseFile.getAbsolutePath(), e);
return null;
}
}

View File

@ -83,7 +83,7 @@ public class EnvironmentParser {
}
private String parseValue() throws IOException {
StringBuffer buffer = new StringBuffer();
StringBuilder buffer = new StringBuilder();
while (true) {
char c = read();