Commits

Michael Heemskerk committed 81eb881

CR-FE-3635 processed review comments

Comments (0)

Files changed (2)

processutils/src/main/java/com/atlassian/utils/process/ExternalProcessBuilder.java

     private InputHandler input;
     private OutputHandler output;
     private OutputHandler error;
-    private List<ProcessMonitor> monitors;
+    private List<ProcessMonitor> monitors = new ArrayList<ProcessMonitor>();
     private List<String> command;
     private File workingDir;
     private long timeout;
     }
 
     public ExternalProcessBuilder addMonitor(ProcessMonitor... monitors) {
-        if (monitors.length > 0) {
-            if (this.monitors == null) {
-                this.monitors = new ArrayList<ProcessMonitor>();
-            }
-            for (ProcessMonitor mon : monitors) {
-                this.monitors.add(mon);
-            }
+        for (ProcessMonitor mon : monitors) {
+            this.monitors.add(mon);
         }
         return this;
     }
             process.setTimeout(timeout);
         }
         process.setWorkingDir(workingDir);
-        if (monitors != null) {
-            for (ProcessMonitor monitor: monitors) {
-                if (monitor != null) {
-                    process.addMonitor(monitor);
-                }
+        for (ProcessMonitor monitor: monitors) {
+            if (monitor != null) {
+                process.addMonitor(monitor);
             }
         }
 

processutils/src/main/java/com/atlassian/utils/process/ProcessMonitor.java

      * Call-back method, called just before the external process is started.
      * @param process the {@link ExternalProcess} that is about to be started.
      */
-    public void onBeforeStart(ExternalProcess process);
+    void onBeforeStart(ExternalProcess process);
     
     /**
      * Call-back method, called right after the external process has finished. The process might have
      * been finished normally, in an error, or canceled.
      * @param process the {@link ExternalProcess} that has just finished.
      */
-    public void onAfterFinished(ExternalProcess process);
+    void onAfterFinished(ExternalProcess process);
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.