Package org.apache.mina.filter.codec

Examples of org.apache.mina.filter.codec.ProtocolDecoderException


                if (undecodables == decoders.length) {
                    // Throw an exception if all decoders cannot decode data.
                    String dump = in.getHexDump();
                    in.position(in.limit()); // Skip data
                    throw new ProtocolDecoderException(
                            "No appropriate message decoder: " + dump);
                }

                if (currentDecoder == null) {
                    // Decoder is not determined yet (i.e. we need more data)
                    return false;
                }
            }

            MessageDecoderResult result = currentDecoder.decode(session, in,
                    out);
            if (result == MessageDecoder.OK) {
                currentDecoder = null;
                return true;
            } else if (result == MessageDecoder.NEED_DATA) {
                return false;
            } else if (result == MessageDecoder.NOT_OK) {
                currentDecoder = null;
                throw new ProtocolDecoderException(
                        "Message decoder returned NOT_OK.");
            } else {
                currentDecoder = null;
                throw new IllegalStateException(
                        "Unexpected decode result (see your decode()): "
View Full Code Here


                    }
                }
            }
        } catch (MessageParseException e) {
            m = null; // discard reading message
            throw new ProtocolDecoderException("Failed to decode.", e);
        } finally {
            readingMessage = m;
        }
    }
View Full Code Here

        return this;
    }

    public DecodingState finishDecode(ProtocolDecoderOutput out)
            throws Exception {
        throw new ProtocolDecoderException(
                "Unexpected end of session while waiting for a short integer.");
    }
View Full Code Here

        }
    }

    public DecodingState finishDecode(ProtocolDecoderOutput out)
            throws Exception {
        throw new ProtocolDecoderException(
                "Unexpected end of session while waiting for a single byte.");
    }
View Full Code Here

                if (b == LF) {
                    found = true;
                    finished = true;
                    break;
                } else {
                    throw new ProtocolDecoderException(
                            "Expected LF after CR but was: " + (b & 0xff));
                }
            }
        }
View Full Code Here

        if (buffer == null) {
            buffer = IoBuffer.allocate(256).setAutoExpand(true);
        }

        if (buffer.position() + in.remaining() > maxLength) {
            throw new ProtocolDecoderException("Received data exceeds " + maxLength + " byte(s).");
        }
        buffer.put(in);
        return this;
    }
View Full Code Here

        return this;
    }

    public DecodingState finishDecode(ProtocolDecoderOutput out)
            throws Exception {
        throw new ProtocolDecoderException(
                "Unexpected end of session while waiting for an integer.");
    }
View Full Code Here

            if (undecodables == decoders.length) {
                // Throw an exception if all decoders cannot decode data.
                String dump = in.getHexDump();
                in.position(in.limit()); // Skip data
                ProtocolDecoderException e = new ProtocolDecoderException(
                        "No appropriate message decoder: " + dump);
                e.setHexdump(dump);
                throw e;
            }

            if (state.currentDecoder == null) {
                // Decoder is not determined yet (i.e. we need more data)
                return false;
            }
        }

        MessageDecoderResult result = state.currentDecoder.decode(session, in,
                out);
        if (result == MessageDecoder.OK) {
            state.currentDecoder = null;
            return true;
        } else if (result == MessageDecoder.NEED_DATA) {
            return false;
        } else if (result == MessageDecoder.NOT_OK) {
            state.currentDecoder = null;
            throw new ProtocolDecoderException(
                    "Message decoder returned NOT_OK.");
        } else {
            state.currentDecoder = null;
            throw new IllegalStateException(
                    "Unexpected decode result (see your decode()): "
View Full Code Here

            if (undecodables == decoders.length) {
                // Throw an exception if all decoders cannot decode data.
                String dump = in.getHexDump();
                in.position(in.limit()); // Skip data
                ProtocolDecoderException e = new ProtocolDecoderException(
                        "No appropriate message decoder: " + dump);
                e.setHexdump(dump);
                throw e;
            }

            if (state.currentDecoder == null) {
                // Decoder is not determined yet (i.e. we need more data)
                return false;
            }
        }

        MessageDecoderResult result = state.currentDecoder.decode(session, in,
                out);
        if (result == MessageDecoder.OK) {
            state.currentDecoder = null;
            return true;
        } else if (result == MessageDecoder.NEED_DATA) {
            return false;
        } else if (result == MessageDecoder.NOT_OK) {
            state.currentDecoder = null;
            throw new ProtocolDecoderException(
                    "Message decoder returned NOT_OK.");
        } else {
            state.currentDecoder = null;
            throw new IllegalStateException(
                    "Unexpected decode result (see your decode()): "
View Full Code Here

                if (undecodables == decoders.length) {
                    // Throw an exception if all decoders cannot decode data.
                    String dump = in.getHexDump();
                    in.position(in.limit()); // Skip data
                    ProtocolDecoderException e = new ProtocolDecoderException(
                            "No appropriate message decoder: " + dump);
                    e.setHexdump(dump);
                    throw e;
                }

                if (currentDecoder == null) {
                    // Decoder is not determined yet (i.e. we need more data)
                    return false;
                }
            }

            MessageDecoderResult result = currentDecoder.decode(session, in,
                    out);
            if (result == MessageDecoder.OK) {
                currentDecoder = null;
                return true;
            } else if (result == MessageDecoder.NEED_DATA) {
                return false;
            } else if (result == MessageDecoder.NOT_OK) {
                currentDecoder = null;
                throw new ProtocolDecoderException(
                        "Message decoder returned NOT_OK.");
            } else {
                currentDecoder = null;
                throw new IllegalStateException(
                        "Unexpected decode result (see your decode()): "
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.codec.ProtocolDecoderException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.