package lava.net.mmp; /** * **/ public class MMPReceiverException extends MMPException { /** * **/ public final static int NO_ERROR_CODE_GIVEN = 0; /** * **/ public final static int CLOSED = 1; /** * **/ public final static int UNTRUSTED_SOURCE = 2; /** * **/ public final static int MALFORMED_TARGET = 3; /** * **/ public final static int PACKET_LOSS_NO_INITIALIZE = 4; /** * **/ public final static int PACKET_LOSS_COUNTER_DIFFERS = 5; /** * **/ public final static int PACKET_LOSS_COUNTER_NOT_INITIALIZED = 6; /** * **/ public final static int UNKNOWN_LOCAL = 7; /** * **/ private final static String[] errorString = {// "no specific error given", // "remote system closed connection", // "got untrusted source", // "got malformed target", // "lost packet - no initialize tag given", // "lost packet - given counter is greater than it should be", // "lost packet - counter not initialized", // "unknown local",// }; /** * **/ private int errorCode = NO_ERROR_CODE_GIVEN; /** * **/ public MMPReceiverException() { super(); } /** * **/ public MMPReceiverException(int errorCode) { super(errorToString(errorCode)); this.errorCode = errorCode; } /** * **/ public MMPReceiverException(String error) { super(error); } /** * **/ public int getErrorCode() { return errorCode; } /** * **/ public static String errorToString(int errorCode) { try { return errorString[errorCode]; } catch(ArrayIndexOutOfBoundsException e) { return errorString[0]; } } }