1 package org.bouncycastle.asn1; 2 3 import java.io.IOException; 4 5 /** 6 * Exception thrown in cases of corrupted or unexpected data in a stream. 7 */ 8 public class ASN1Exception 9 extends IOException 10 { 11 private Throwable cause; 12 13 /** 14 * Base constructor 15 * 16 * @param message a message concerning the exception. 17 */ 18 ASN1Exception(String message) 19 { 20 super(message); 21 } 22 23 /** 24 * Constructor when this exception is due to another one. 25 * 26 * @param message a message concerning the exception. 27 * @param cause the exception that caused this exception to be thrown. 28 */ 29 ASN1Exception(String message, Throwable cause) 30 { 31 super(message); 32 this.cause = cause; 33 } 34 35 /** 36 * Return the underlying cause of this exception, if any. 37 * 38 * @return the exception causing this one, null if there isn't one. 39 */ 40 public Throwable getCause() 41 { 42 return cause; 43 } 44 } 45