Author: maartenc
Date: Thu Feb 3 23:07:37 2011
New Revision: 1067024
URL: http://svn.apache.org/viewvc?rev=1067024&view=rev
Log:
IMPROVEMENT: Improve diagnostics in ssh resolver (IVY-1267)
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1067024&r1=1067023&r2=1067024&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Feb 3 23:07:37 2011
@@ -117,6 +117,7 @@ for detailed view of each issue, please
- NEW: ivy:resolve and post resole task can now have inlined dependencies
declaration.
- NEW: Import Bushel into Ivy core (IVY-1241)
+- IMPROVEMENT: Improve diagnostics in ssh resolver (IVY-1267)
- IMPROVEMENT: ivy:retrieve can now convert 'dotted'-organisation names into a
directory tree.
- FIX: Dynamic version resolution result can be incorrect when ivy metadata
contains extra attributes (IVY-1236)
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java?rev=1067024&r1=1067023&r2=1067024&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/AbstractSshBasedRepository.java
Thu Feb 3 23:07:37 2011
@@ -136,8 +136,8 @@ public abstract class AbstractSshBasedRe
return uri;
} catch (URISyntaxException e) {
Message.error(e.getMessage());
- Message.error("The uri is in the wrong format.");
- Message.error("Please use
scheme://user:pass@hostname/path/to/repository");
+ Message.error("The uri '" + source + "' is in the wrong format.");
+ Message.error("Please use " + getRepositoryScheme() +
"://user:pass@hostname/path/to/repository");
return null;
}
}
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java?rev=1067024&r1=1067023&r2=1067024&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
Thu Feb 3 23:07:37 2011
@@ -170,8 +170,10 @@ public class SshRepository extends Abstr
URI parentUri = null;
try {
parentUri = new URI(parent);
- } catch (URISyntaxException e1) {
- // failed earlier
+ } catch (URISyntaxException e) {
+ IOException ioe = new IOException("The uri '" + parent + "' is not
valid!");
+ ioe.initCause(e);
+ throw ioe;
}
String fullCmd = replaceArgument(listCommand, parentUri.getPath());
channel.setCommand(fullCmd);
@@ -234,13 +236,17 @@ public class SshRepository extends Abstr
public void put(File source, String destination, boolean overwrite) throws
IOException {
Message.debug("SShRepository:put called: " + destination);
Session session = getSession(destination);
+
+ URI destinationUri = null;
+ try {
+ destinationUri = new URI(destination);
+ } catch (URISyntaxException e) {
+ IOException ioe = new IOException("The uri '" + destination + "'
is not valid!");
+ ioe.initCause(e);
+ throw ioe;
+ }
+
try {
- URI destinationUri = null;
- try {
- destinationUri = new URI(destination);
- } catch (URISyntaxException e) {
- // failed earlier in getSession()
- }
String filePath = destinationUri.getPath();
int lastSep = filePath.lastIndexOf(fileSeparator);
String path;
@@ -342,17 +348,17 @@ public class SshRepository extends Abstr
destination.getParentFile().mkdirs();
}
Session session = getSession(source);
+
+ URI sourceUri = null;
+ try {
+ sourceUri = new URI(source);
+ } catch (URISyntaxException e) {
+ IOException ioe = new IOException("The uri '" + source + "' is not
valid!");
+ ioe.initCause(e);
+ throw ioe;
+ }
+
try {
- URI sourceUri = null;
- try {
- sourceUri = new URI(source);
- } catch (URISyntaxException e) {
- // fails earlier
- }
- if (sourceUri == null) {
- Message.error("could not parse URI " + source);
- return;
- }
Scp myCopy = new Scp(session);
myCopy.get(sourceUri.getPath(), destination.getCanonicalPath());
} catch (IOException e) {