/*
 * @(#)BadVersionException.java
 *
 * Copyright (c) 2001-2004 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */
package com.jscape.inet.sftp;


import com.jscape.util.SuppressObfuscation;

/**
 * The SFTP incompatible client/server versions error.
 * May be thrown while SFTP protocol initialization.
 *
 * @author Alex Usun
 */
@SuppressObfuscation
public class BadVersionException
        extends SftpException {

    private final int clientVersion;
    private final int serverVersion;

    /**
     * Creates a new error instance for specified client/server protocol
     * versions.
     *
     * @param clientVersion client protocol version
     * @param serverVersion server protocol version
     */
    public BadVersionException(int clientVersion, int serverVersion) {
        super("Incompatible protocol versions. Client: " + clientVersion + ", server: " + serverVersion);
        this.clientVersion = clientVersion;
        this.serverVersion = serverVersion;
    }

    /**
     * Creates a new error instance with specified message.
     *
     * @param message       error message
     * @param clientVersion client protocol version
     * @param serverVersion server protocol version
     */
    public BadVersionException(String message,
                               int clientVersion,
                               int serverVersion) {
        super(message);

        this.clientVersion = clientVersion;
        this.serverVersion = serverVersion;
    }

    /**
     * Obtains client protocol version.
     *
     * @return client protocol version
     */
    public int getClientVersion() {
        return this.clientVersion;
    }

    /**
     * Obtains server protocol version.
     *
     * @return server protocol version
     */
    public int getServerVersion() {
        return this.serverVersion;
    }

}
