From d0b6fd9e4c3f1a14d865eaec03806caab01985b4 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sat, 8 Aug 2020 11:47:44 +0200 Subject: [PATCH] Don't create unnecessary objects --- .../src/main/java/org/petero/engineserver/EngineServer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EngineServer/src/main/java/org/petero/engineserver/EngineServer.java b/EngineServer/src/main/java/org/petero/engineserver/EngineServer.java index 2601c06..37d13e0 100644 --- a/EngineServer/src/main/java/org/petero/engineserver/EngineServer.java +++ b/EngineServer/src/main/java/org/petero/engineserver/EngineServer.java @@ -55,9 +55,9 @@ public class EngineServer implements ErrorHandler { InputStream is = new FileInputStream(getConfigFile()); prop.load(is); for (int i = 0; i < configs.length; i++) { - boolean enabled = Boolean.valueOf(prop.getProperty("enabled" + i, "false")); + boolean enabled = Boolean.parseBoolean(prop.getProperty("enabled" + i, "false")); String defPort = Integer.toString(4567 + i); - int port = Integer.valueOf(prop.getProperty("port" + i, defPort)); + int port = Integer.parseInt(prop.getProperty("port" + i, defPort)); String filename = prop.getProperty("filename" + i, ""); String arguments = prop.getProperty("arguments" + i, ""); configs[i] = new EngineConfig(enabled, port, filename, arguments); @@ -119,7 +119,7 @@ public class EngineServer implements ErrorHandler { for (int i = 0; i < args.length; i++) { if ("-numengines".equals(args[i]) && i+1 < args.length) { try { - numEngines = Integer.valueOf(args[i+1]); + numEngines = Integer.parseInt(args[i+1]); numEngines = Math.max(1, numEngines); numEngines = Math.min(20, numEngines); i++;