Fixed Possible NPE's with System.getProperty

This commit is contained in:
SenpaiDipper 2021-12-19 15:05:48 +00:00
parent 86cf51ab05
commit c78813a405
2 changed files with 6 additions and 3 deletions

View File

@ -32,8 +32,8 @@ import java.util.regex.Pattern;
public final class Emulator {
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
private static final String OS_NAME = System.getProperty("os.name");
private static final String CLASS_PATH = System.getProperty("java.class.path");
private static final String OS_NAME = (System.getProperty("os.name") != null ? System.getProperty("os.name") : "Unknown");
private static final String CLASS_PATH = (System.getProperty("java.class.path") != null ? System.getProperty("java.class.path") : "Unknown");
public final static int MAJOR = 3;
public final static int MINOR = 0;

View File

@ -22,8 +22,11 @@ public class WiredHighscoreManager {
private static final Logger LOGGER = LoggerFactory.getLogger(WiredHighscoreManager.class);
private final HashMap<Integer, List<WiredHighscoreDataEntry>> data = new HashMap<>();
private final static String locale = (System.getProperty("user.language") != null ? System.getProperty("user.language") : "en");
private final static String country = (System.getProperty("user.country") != null ? System.getProperty("user.country") : "US");
private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(System.getProperty("user.language"), System.getProperty("user.country"))).getFirstDayOfWeek();
private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(locale, country)).getFirstDayOfWeek();
private final static DayOfWeek lastDayOfWeek = DayOfWeek.of(((firstDayOfWeek.getValue() + 5) % DayOfWeek.values().length) + 1);
private final static ZoneId zoneId = ZoneId.systemDefault();