Ivy
  1. Ivy
  2. IVY-1267

Improve diagnostics in ssh resolver

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0-RC1
    • Component/s: None
    • Labels:
      None

      Description

      Currently I get messages when using SSH resolve:

      ERROR: The uri is in the wrong format

      and

      java.lang.NullPointerException

      This does not help a lot.

      Index: src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
      ===================================================================
      --- src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java      (revision 1066801)
      +++ src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java      (working copy)
      @@ -136,7 +136,7 @@
                   return uri;
               } catch (URISyntaxException e) {
                   Message.error(e.getMessage());
      -            Message.error("The uri is in the wrong format.");
      +            Message.error("The uri is in the wrong format: '" + source + "'");
                   Message.error("Please use scheme://user:pass@hostname/path/to/repository");
                   return null;
               }
      Index: src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
      ===================================================================
      --- src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java   (revision 1066801)
      +++ src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java   (working copy)
      @@ -167,11 +167,12 @@
               ChannelExec channel = null;
               session = getSession(parent);
               channel = getExecChannel(session);
      -        URI parentUri = null;
      +        URI parentUri;
               try {
                   parentUri = new URI(parent);
               } catch (URISyntaxException e1) {
                   // failed earlier
      +           throw new RuntimeException(e1);
               }
               String fullCmd = replaceArgument(listCommand, parentUri.getPath());
               channel.setCommand(fullCmd);
      @@ -235,11 +236,12 @@
               Message.debug("SShRepository:put called: " + destination);
               Session session = getSession(destination);
               try {
      -            URI destinationUri = null;
      +            URI destinationUri;
                   try {
                       destinationUri = new URI(destination);
                   } catch (URISyntaxException e) {
                       // failed earlier in getSession()
      +               throw new RuntimeException(e);
                   }
                   String filePath = destinationUri.getPath();
                   int lastSep = filePath.lastIndexOf(fileSeparator);
      

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Maarten Coene
            Reporter:
            Stepan Koltsov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development