public void fillInputData()

in wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/jsch/ScpWagon.java [184:264]


    public void fillInputData(InputData inputData) throws TransferFailedException, ResourceDoesNotExistException {
        Resource resource = inputData.getResource();

        String path = getPath(getRepository().getBasedir(), resource.getName());
        // String cmd = "scp -p -f " + path;
        String cmd = "scp -p -f \"" + path + "\"";

        fireTransferDebug("Executing command: " + cmd);

        try {
            channel = (ChannelExec) session.openChannel(EXEC_CHANNEL);

            channel.setCommand(cmd);

            // get I/O streams for remote scp
            channelOutputStream = channel.getOutputStream();

            InputStream in = channel.getInputStream();
            inputData.setInputStream(in);

            channel.connect();

            sendEom(channelOutputStream);

            int exitCode = in.read();

            if (exitCode == 'T') {
                String line = readLine(in);

                String[] times = line.split(" ");

                resource.setLastModified(Long.valueOf(times[0]).longValue() * 1000);

                sendEom(channelOutputStream);

                exitCode = in.read();
            }

            String line = readLine(in);

            if (exitCode != COPY_START_CHAR) {
                if (exitCode == 1
                        && (line.contains("No such file or directory")
                                || line.indexOf("no such file or directory") != 1)) {
                    throw new ResourceDoesNotExistException(line);
                } else {
                    throw new IOException("Exit code: " + exitCode + " - " + line);
                }
            }

            if (line == null) {
                throw new EOFException("Unexpected end of data");
            }

            String perms = line.substring(0, 4);
            fireTransferDebug("Remote file permissions: " + perms);

            if (line.charAt(4) != ACK_SEPARATOR && line.charAt(5) != ACK_SEPARATOR) {
                throw new IOException("Invalid transfer header: " + line);
            }

            int index = line.indexOf(ACK_SEPARATOR, 5);
            if (index < 0) {
                throw new IOException("Invalid transfer header: " + line);
            }

            long filesize = Long.parseLong(line.substring(5, index));
            fireTransferDebug("Remote file size: " + filesize);

            resource.setContentLength(filesize);

            String filename = line.substring(index + 1);
            fireTransferDebug("Remote filename: " + filename);

            sendEom(channelOutputStream);
        } catch (JSchException e) {
            handleGetException(resource, e);
        } catch (IOException e) {
            handleGetException(resource, e);
        }
    }