1 19 20 package org.netbeans.api.sendopts; 21 22 import java.text.MessageFormat ; 23 import java.util.ResourceBundle ; 24 25 29 public final class CommandException extends Exception { 30 private final int exitCode; 31 private final String locMsg; 32 33 39 public CommandException(int exitCode) { 40 this("Error code: " + exitCode, exitCode, null); } 42 43 47 public CommandException(int exitCode, String locMsg) { 48 this("Error code: " + exitCode, exitCode, locMsg); } 50 51 52 53 CommandException(String msg, int exitCode, String locMsg) { 54 super(msg); 55 this.exitCode = exitCode; 56 this.locMsg = locMsg; 57 } 58 59 CommandException(String msg, int exitCode) { 60 this(msg, exitCode, null); 61 } 62 63 66 public int getExitCode() { 67 return exitCode; 68 } 69 70 73 public String getLocalizedMessage() { 74 if (locMsg != null) { 75 return locMsg; 76 } 77 if (getCause() != null) { 78 return getCause().getLocalizedMessage(); 79 } 80 return super.getLocalizedMessage(); 81 } 82 } 83 | Popular Tags |