1 20 package org.apache.mina.filter.codec; 21 22 import org.apache.mina.common.ByteBuffer; 23 24 32 public class ProtocolDecoderException extends ProtocolCodecException { 33 private static final long serialVersionUID = 3545799879533408565L; 34 35 private String hexdump; 36 37 40 public ProtocolDecoderException() { 41 } 42 43 46 public ProtocolDecoderException(String message) { 47 super(message); 48 } 49 50 53 public ProtocolDecoderException(Throwable cause) { 54 super(cause); 55 } 56 57 61 public ProtocolDecoderException(String message, Throwable cause) { 62 super(message, cause); 63 } 64 65 68 public String getMessage() { 69 String message = super.getMessage(); 70 71 if (message == null) { 72 message = ""; 73 } 74 75 if (hexdump != null) { 76 return message + ((message.length() > 0) ? " " : "") + "(Hexdump: " 77 + hexdump + ')'; 78 } else { 79 return message; 80 } 81 } 82 83 86 public String getHexdump() { 87 return hexdump; 88 } 89 90 93 public void setHexdump(String hexdump) { 94 if (this.hexdump != null) { 95 throw new IllegalStateException ( 96 "Hexdump cannot be set more than once."); 97 } 98 this.hexdump = hexdump; 99 } 100 } | Popular Tags |