EMMA Coverage Report (generated Tue Dec 20 11:01:01 KST 2005)
[all classes][org.apache.mina.protocol]

COVERAGE SUMMARY FOR SOURCE FILE [ProtocolViolationException.java]

nameclass, %method, %block, %line, %
ProtocolViolationException.java0%   (0/1)0%   (0/7)0%   (0/64)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProtocolViolationException0%   (0/1)0%   (0/7)0%   (0/64)0%   (0/19)
ProtocolViolationException (): void 0%   (0/1)0%   (0/3)0%   (0/2)
ProtocolViolationException (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
ProtocolViolationException (String, Throwable): void 0%   (0/1)0%   (0/5)0%   (0/2)
ProtocolViolationException (Throwable): void 0%   (0/1)0%   (0/4)0%   (0/2)
getHexdump (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getMessage (): String 0%   (0/1)0%   (0/33)0%   (0/6)
setHexdump (String): void 0%   (0/1)0%   (0/12)0%   (0/4)

1/*
2 *   @(#) $Id: ProtocolViolationException.java 357871 2005-12-20 01:56:40Z trustin $
3 *
4 *   Copyright 2004 The Apache Software Foundation
5 *
6 *   Licensed under the Apache License, Version 2.0 (the "License");
7 *   you may not use this file except in compliance with the License.
8 *   You may obtain a copy of the License at
9 *
10 *       http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *   Unless required by applicable law or agreed to in writing, software
13 *   distributed under the License is distributed on an "AS IS" BASIS,
14 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *   See the License for the specific language governing permissions and
16 *   limitations under the License.
17 *
18 */
19package org.apache.mina.protocol;
20 
21import org.apache.mina.common.ByteBuffer;
22 
23/**
24 * An exception that is thrown when {@link ProtocolEncoder} cannot understand or
25 * failed to validate the specified message, or when {@link ProtocolDecoder}
26 * cannot understand or failed to validate the specified {@link ByteBuffer}
27 * content.
28 * 
29 * @author The Apache Directory Project (dev@directory.apache.org)
30 * @version $Rev: 357871 $, $Date: 2005-12-20 10:56:40 +0900 (Tue, 20 Dec 2005) $
31 */
32public class ProtocolViolationException extends Exception
33{
34    private static final long serialVersionUID = 3545799879533408565L;
35 
36        private String hexdump;
37 
38    /**
39     * Constructs a new instance.
40     */
41    public ProtocolViolationException()
42    {
43    }
44 
45    /**
46     * Constructs a new instance with the specified message.
47     */
48    public ProtocolViolationException( String message )
49    {
50        super( message );
51    }
52 
53    /**
54     * Constructs a new instance with the specified cause.
55     */
56    public ProtocolViolationException( Throwable cause )
57    {
58        super( cause );
59    }
60 
61    /**
62     * Constructs a new instance with the specified message and the specified
63     * cause.
64     */
65    public ProtocolViolationException( String message, Throwable cause )
66    {
67        super( message, cause );
68    }
69 
70    /**
71     * Returns the message and the hexdump of the unknown part.
72     */
73    public String getMessage()
74    {
75        String message = super.getMessage();
76 
77        if( message == null )
78        {
79            message = "";
80        }
81 
82        if( hexdump != null )
83        {
84            return message + ( ( message.length() > 0 ) ? " " : "" )
85                   + "(Hexdump: " + hexdump + ')';
86        }
87        else
88        {
89            return message;
90        }
91    }
92 
93    /**
94     * Returns the hexdump of the unknown message part.
95     */
96    public String getHexdump()
97    {
98        return hexdump;
99    }
100 
101    /**
102     * Sets the hexdump of the unknown message part.
103     */
104    public void setHexdump( String hexdump )
105    {
106        if( this.hexdump != null )
107        {
108            throw new IllegalStateException( "Hexdump cannot be set more than once." );
109        }
110        this.hexdump = hexdump;
111    }
112}

[all classes][org.apache.mina.protocol]
EMMA 2.0.4217 (C) Vladimir Roubtsov