From 7c94dea7b568a84c080e8d4ba785e40c9818105d Mon Sep 17 00:00:00 2001 From: Emmanuel Bigeon Date: Sun, 14 Oct 2018 09:26:27 -0400 Subject: [PATCH] Avoid multiple creation of empty array --- .../java/net/bigeon/gclc/command/base/ScriptExecution.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gclc/src/main/java/net/bigeon/gclc/command/base/ScriptExecution.java b/gclc/src/main/java/net/bigeon/gclc/command/base/ScriptExecution.java index 8add260..cb0427e 100644 --- a/gclc/src/main/java/net/bigeon/gclc/command/base/ScriptExecution.java +++ b/gclc/src/main/java/net/bigeon/gclc/command/base/ScriptExecution.java @@ -139,6 +139,7 @@ public final class ScriptExecution extends Command { try (InputStreamReader fReader = new InputStreamReader( Files.newInputStream(Paths.get(scriptFile)), charset); BufferedReader reader = new BufferedReader(fReader)) { + String[] emptyArray = new String[0]; while ((cmd = reader.readLine()) != null) { lineNo++; final String cmdLine = readCommandLine(cmd, params); @@ -147,7 +148,7 @@ public final class ScriptExecution extends Command { } final List ps = GCLCConstants.splitCommand(cmdLine); final String command = ps.remove(0); - application.executeSub(out, in, command, ps.toArray(new String[0])); + application.executeSub(out, in, command, ps.toArray(emptyArray)); } } catch (final CommandParsingException e) { throw new CommandRunException(