EMMA Coverage Report (generated Sat Sep 03 11:42:34 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/57)0%   (0/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProtocolViolationException0%   (0/1)0%   (0/7)0%   (0/57)0%   (0/17)
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)
getBuffer (): ByteBuffer 0%   (0/1)0%   (0/3)0%   (0/1)
getMessage (): String 0%   (0/1)0%   (0/34)0%   (0/6)
setBuffer (ByteBuffer): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/*
2 *   @(#) $Id: ProtocolViolationException.java 264677 2005-08-30 02:44:35Z 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 Trustin Lee (trustin@apache.org)
30 * @version $Rev: 264677 $, $Date: 2005-08-30 11:44:35 +0900 $
31 */
32public class ProtocolViolationException extends Exception
33{
34    private static final long serialVersionUID = 3545799879533408565L;
35 
36        private ByteBuffer buffer;
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( buffer != null )
83        {
84            return message + ( ( message.length() > 0 ) ? " " : "" )
85                   + "(Hexdump: " + buffer.getHexDump() + ')';
86        }
87        else
88        {
89            return message;
90        }
91    }
92 
93    /**
94     * Returns unknown message part.
95     */
96    public ByteBuffer getBuffer()
97    {
98        return buffer;
99    }
100 
101    /**
102     * Sets unknown message part.
103     */
104    public void setBuffer( ByteBuffer buffer )
105    {
106        this.buffer = buffer;
107    }
108}

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