1 58 package org.krysalis.barcode.cli; 59 60 import org.apache.avalon.framework.ExceptionUtil; 61 62 67 public abstract class AbstractExitHandler implements ExitHandler { 68 69 70 public void successfulExit(Main app) { 71 } 73 74 75 public void failureExit(Main app, String msg, Throwable t, int exitCode) { 76 if (msg == null) { 77 throw new NullPointerException ("msg must not be null"); 78 } 79 if (exitCode == 0) { 80 throw new IllegalArgumentException ("exitCode must not be zero"); 81 } 82 app.printAppHeader(); 83 Main.stderr.println(msg); 84 if (t != null) { 85 Main.stderr.println(ExceptionUtil.printStackTrace(t)); 86 } 87 } 88 89 } 90 | Popular Tags |