Example usage for org.apache.commons.net.nntp NNTPConnectionClosedException NNTPConnectionClosedException

List of usage examples for org.apache.commons.net.nntp NNTPConnectionClosedException NNTPConnectionClosedException

Introduction

In this page you can find the example usage for org.apache.commons.net.nntp NNTPConnectionClosedException NNTPConnectionClosedException.

Prototype

public NNTPConnectionClosedException(String message) 

Source Link

Document

Constructs a NNTPConnectionClosedException with a specified message.

Usage

From source file:org.random_access.newsreader.nntp.CustomNNTP.java

private void __getReply() throws IOException {
    this._replyString = this._reader_.readLine();
    if (this._replyString == null) {
        throw new NNTPConnectionClosedException("Connection closed without indication.");
    } else if (this._replyString.length() < 3) {
        throw new MalformedServerReplyException("Truncated server reply: " + this._replyString);
    } else {/* www. j a va2 s .  c  om*/
        try {
            this._replyCode = Integer.parseInt(this._replyString.substring(0, 3));
        } catch (NumberFormatException var2) {
            throw new MalformedServerReplyException(
                    "Could not parse response code.\nServer Reply: " + this._replyString);
        }

        this.fireReplyReceived(this._replyCode, this._replyString + "\r\n");
        if (this._replyCode == 400) {
            throw new NNTPConnectionClosedException("NNTP response 400 received.  Server closed connection.");
        }
    }
}