Examples of SSHException


Examples of org.platformlayer.ops.ssh.SshException

      try {
        log.debug("SCP Opening connection");
        channel.open().await(connectTimeout.getTotalMilliseconds());
      } catch (Exception e) {
        ExceptionUtils.handleInterrupted(e);
        throw new SshException("SSH error opening channel", e);
      }
    }
View Full Code Here

Examples of org.platformlayer.ops.ssh.SshException

          // Cmmmm <length> <filename>
          // a single file copy, mmmmm is mode. Example: C0644 299 group

          String[] tokens = nextLine.data.split(" ");
          if (tokens.length != 3) {
            throw new SshException("Invalid SCP line: " + nextLine);
          }
          fileInfo = new FileInfo(tokens[0].substring(1), Long.parseLong(tokens[1]), tokens[2]);
          break;
        }
        throw new SshException("Unexpected SCP status: " + nextLine);
      }

      toStdin.write(0x0);
      toStdin.flush();

      try {
        long remain = fileInfo.length;

        while (remain > 0) {
          int readSize = (int) Math.min(buffer.length, remain);

          int actuallyRead = fromStdout.read(buffer, 0, readSize);

          if (actuallyRead < 0) {
            throw new EOFException();
          }

          destOutputStream.write(buffer, 0, actuallyRead);

          remain -= actuallyRead;
        }
      } finally {
        IoUtils.safeClose(destOutputStream);
      }

      parseFinalLine(readResponseLine());

      toStdin.write(0x0);
      toStdin.flush();

      // Wait for everything to finish
      int flags = channel.waitFor(ClientChannel.EOF, timeout.getTotalMilliseconds());
      if ((flags & ClientChannel.TIMEOUT) != 0) {
        throw new SshException("Timeout while waiting for SSH task to complete");
      }
    }
View Full Code Here

Examples of org.platformlayer.ops.ssh.SshException

        parseFinalLine(nextLine);
        return nextLine;
      }

      if (lineType != 0) {
        throw new SshException("Unexpected reply: " + lineType);
      }

      return nextLine;
    }
View Full Code Here

Examples of org.platformlayer.ops.ssh.SshException

      if (line.lineType == 0) {
        return;
      }

      if ((line.lineType != 1) && (line.lineType != 2)) {
        throw new SshException("Unexpected code found from SCP: " + line);
      }

      if (line.lineType == 2) {
        throw new SshException("SCP error (with no specific message)");
      }

      throw new SshException("SCP error: " + line.data);
    }
View Full Code Here

Examples of org.xulfactory.gliese.SSHException

    ByteArrayInputStream in = new ByteArrayInputStream(key);
    try {
      String format = Utils.decodeString(in);
      if (!format.equals(NAME)) {
        GlieseLogger.LOGGER.error("Invalid host key algorithm: " + format);
        throw new SSHException("Invalid host key algorithm: " + format);
      }
      e = Utils.decodeBigInt(in);
      n = Utils.decodeBigInt(in);
    } catch (IOException ioe) {
      GlieseLogger.LOGGER.error("Host key invalid encoding", ioe);
      throw new SSHException("Host key invalid encoding", ioe);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.