@@ -79,8 +79,10 @@ protected NuixEngine() {
7979 }
8080
8181 public static void closeGlobalContainer () {
82- globalContainer .close ();
83- globalContainer = null ;
82+ if (globalContainer != null ) {
83+ globalContainer .close ();
84+ globalContainer = null ;
85+ }
8486 }
8587
8688 /***
@@ -554,9 +556,9 @@ public NuixVersion getNuixVersion() {
554556 * @throws Exception Exceptions are allowed to bubble up.
555557 */
556558 public RubyScriptRunner runRubyScriptAsync (String script , @ Nullable Map <String , Object > additionalVariables ,
557- @ Nullable Consumer <String > standardOutputReceiver ,
558- @ Nullable Consumer <String > errorOutputReceiver ,
559- @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
559+ @ Nullable Consumer <String > standardOutputReceiver ,
560+ @ Nullable Consumer <String > errorOutputReceiver ,
561+ @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
560562 Map <String , Object > vars = new HashMap <>();
561563 if (additionalVariables != null ) {
562564 vars .putAll (additionalVariables );
@@ -567,7 +569,7 @@ public RubyScriptRunner runRubyScriptAsync(String script, @Nullable Map<String,
567569 RubyScriptRunner rubyScriptRunner = new RubyScriptRunner ();
568570 rubyScriptRunner .setStandardOutputConsumer (standardOutputReceiver );
569571 rubyScriptRunner .setErrorOutputConsumer (errorOutputReceiver );
570- if (completedCallback != null ) {
572+ if (completedCallback != null ) {
571573 rubyScriptRunner .whenScriptCompletes (completedCallback );
572574 }
573575 rubyScriptRunner .runScriptAsync (script , getNuixVersionString (), vars );
@@ -591,7 +593,7 @@ public RubyScriptRunner runRubyScriptAsync(String script, @Nullable Map<String,
591593 * @throws Exception Exceptions are allowed to bubble up.
592594 */
593595 public RubyScriptRunner runRubyScriptAsync (String script , @ Nullable Map <String , Object > additionalVariables ,
594- @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
596+ @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
595597 return runRubyScriptAsync (script , additionalVariables , null , null , completedCallback );
596598 }
597599
@@ -610,7 +612,7 @@ public RubyScriptRunner runRubyScriptAsync(String script, @Nullable Map<String,
610612 * @throws Exception Exceptions are allowed to bubble up.
611613 */
612614 public RubyScriptRunner runRubyScriptAsync (String script ,
613- @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
615+ @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
614616 return runRubyScriptAsync (script , null , null , null , completedCallback );
615617 }
616618
@@ -637,9 +639,9 @@ public RubyScriptRunner runRubyScriptAsync(String script,
637639 * @throws Exception Exceptions are allowed to bubble up.
638640 */
639641 public RubyScriptRunner runRubyScriptFileAsync (File scriptFile , @ Nullable Map <String , Object > additionalVariables ,
640- @ Nullable Consumer <String > standardOutputReceiver ,
641- @ Nullable Consumer <String > errorOutputReceiver ,
642- @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
642+ @ Nullable Consumer <String > standardOutputReceiver ,
643+ @ Nullable Consumer <String > errorOutputReceiver ,
644+ @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
643645 Map <String , Object > vars = new HashMap <>();
644646 if (additionalVariables != null ) {
645647 vars .putAll (additionalVariables );
@@ -650,7 +652,7 @@ public RubyScriptRunner runRubyScriptFileAsync(File scriptFile, @Nullable Map<St
650652 RubyScriptRunner rubyScriptRunner = new RubyScriptRunner ();
651653 rubyScriptRunner .setStandardOutputConsumer (standardOutputReceiver );
652654 rubyScriptRunner .setErrorOutputConsumer (errorOutputReceiver );
653- if (completedCallback != null ) {
655+ if (completedCallback != null ) {
654656 rubyScriptRunner .whenScriptCompletes (completedCallback );
655657 }
656658 rubyScriptRunner .runFileAsync (scriptFile , getNuixVersionString (), vars );
@@ -676,7 +678,7 @@ public RubyScriptRunner runRubyScriptFileAsync(File scriptFile, @Nullable Map<St
676678 * @throws Exception Exceptions are allowed to bubble up.
677679 */
678680 public RubyScriptRunner runRubyScriptFileAsync (File scriptFile , @ Nullable Map <String , Object > additionalVariables ,
679- @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
681+ @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
680682 return runRubyScriptFileAsync (scriptFile , additionalVariables , null , null , completedCallback );
681683 }
682684
@@ -697,7 +699,7 @@ public RubyScriptRunner runRubyScriptFileAsync(File scriptFile, @Nullable Map<St
697699 * @throws Exception Exceptions are allowed to bubble up.
698700 */
699701 public RubyScriptRunner runRubyScriptFileAsync (File scriptFile ,
700- @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
702+ @ Nullable BiConsumer <Object , BiVariableMap > completedCallback ) throws Exception {
701703 return runRubyScriptFileAsync (scriptFile , null , null , null , completedCallback );
702704 }
703705
0 commit comments