Improve diagnostics in ssh resolver
-----------------------------------
Key: IVY-1267
URL: https://issues.apache.org/jira/browse/IVY-1267
Project: Ivy
Issue Type: Improvement
Affects Versions: 2.2.0
Reporter: Stepan Koltsov
Priority: Minor
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.
{code}
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);
{code}
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira