You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by mi...@apache.org on 2004/07/03 14:52:23 UTC
cvs commit: maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon WagonUtils.java
michal 2004/07/03 05:52:23
Modified: wagon-providers/ssh/src/main/java/org/apache/maven/wagon/providers/ssh
ScpWagon.java
wagon-providers/ssh/src/test/java/org/apache/maven/wagon/providers/ssh
ScpWagonTest.java
ScpWagonWithSshPrivateKeySearchTest.java
wagon-providers/http/src/main/java/org/apache/maven/wagon/providers/http
HttpWagon.java
wagon-api/src/main/java/org/apache/maven/wagon/observers
Debug.java
wagon-api/src/main/java/org/apache/maven/wagon
WagonUtils.java
Log:
Bug fixing - some paths were wrong
Revision Changes Path
1.14 +18 -23 maven-wagon/wagon-providers/ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
Index: ScpWagon.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-providers/ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ScpWagon.java 1 Jul 2004 17:50:17 -0000 1.13
+++ ScpWagon.java 3 Jul 2004 12:52:22 -0000 1.14
@@ -232,15 +232,13 @@
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
- String chdirCmd = "cd " + getRepository().getBasedir() + "\n";
-
- executeCommand( chdirCmd );
+ String basedir = getRepository().getBasedir();
String dir = PathUtils.dirname( resource );
if ( dir != null && dir.length() > 0)
{
- String mkdirCmd = "mkdir -p " + dir + "\n";
+ String mkdirCmd = "mkdir -p " + basedir + "/" + dir + "\n";
executeCommand( mkdirCmd );
}
@@ -255,7 +253,7 @@
try
{
// exec 'scp -t rfile' remotely
- String command = "scp -t " + resource;
+ String command = "scp -t " + basedir + "/" + resource;
fireTransferDebug( "Executing command: " + command );
@@ -334,7 +332,7 @@
if ( authInfo != null && authInfo.getGroup() != null )
{
- String chgrpCmd = "chgrp " + authInfo.getGroup() + " " + getRepository().getBasedir() + "/" + resource + "\n";
+ String chgrpCmd = "chgrp " + authInfo.getGroup() + " " + basedir + "/" + resource + "\n";
executeCommand( chgrpCmd );
@@ -366,12 +364,13 @@
InputStream in = null;
-
LazyFileOutputStream outputStream = new LazyFileOutputStream( destination );
+ String basedir = getRepository().getBasedir();
+
try
{
- String cmd = "scp -f " + resource;
+ String cmd = "scp -f " + basedir + "/" + resource;
fireTransferDebug( "Executing command: " + cmd );
@@ -421,7 +420,6 @@
filesize = filesize * 10 + ( buf[ 0 ] - '0' );
}
-
for ( int i = 0; ; i++ )
{
in.read( buf, i, 1 );
@@ -445,7 +443,6 @@
try
{
-
while ( true )
{
int len = Math.min( buf.length, filesize );
@@ -488,7 +485,6 @@
}
-
fireGetCompleted( resource, destination );
if ( checkAck( in ) != 0 )
@@ -530,10 +526,7 @@
String msg = "Error occured while deploying to remote repository:" + getRepository();
-
throw new TransferFailedException( msg, e );
-
-
}
finally
{
@@ -546,7 +539,6 @@
channel.disconnect();
}
-
shutdownStream( outputStream );
}
}
@@ -599,17 +591,16 @@
static int checkAck( InputStream in ) throws IOException
{
int b = in.read();
-// b may be 0 for success,
-// 1 for error,
-// 2 for fatal error,
-// -1
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+ // -1
if ( b == 0 || b == -1 )
{
return b;
}
-
if ( b == 1 || b == 2 )
{
StringBuffer sb = new StringBuffer();
@@ -623,15 +614,19 @@
sb.append( ( char ) c );
}
while ( c != '\n' );
+
if ( b == 1 )
- { // error
+ {
+ // error
System.out.print( sb.toString() );
}
if ( b == 2 )
- { // fatal error
+ {
+ // fatal error
System.out.print( sb.toString() );
}
}
+
return b;
}
1.5 +9 -3 maven-wagon/wagon-providers/ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java
Index: ScpWagonTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-providers/ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ScpWagonTest.java 29 Jun 2004 18:44:41 -0000 1.4
+++ ScpWagonTest.java 3 Jul 2004 12:52:22 -0000 1.5
@@ -69,9 +69,15 @@
private String getUserName()
{
- String userName = System.getProperty( "user.name" );
- return userName;
+ String retValue = System.getProperty( "testuser.name" );
+
+ if ( retValue == null )
+ {
+ retValue = System.getProperty( "user.name" );
+ }
+
+ return retValue;
}
}
1.5 +10 -3 maven-wagon/wagon-providers/ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java
Index: ScpWagonWithSshPrivateKeySearchTest.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-providers/ssh/src/test/java/org/apache/maven/wagon/providers/ssh/ScpWagonWithSshPrivateKeySearchTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ScpWagonWithSshPrivateKeySearchTest.java 29 Jun 2004 18:44:41 -0000 1.4
+++ ScpWagonWithSshPrivateKeySearchTest.java 3 Jul 2004 12:52:22 -0000 1.5
@@ -59,7 +59,14 @@
private String getUserName()
{
- String userName = System.getProperty( "user.name" );
- return userName;
+
+ String retValue = System.getProperty( "testuser.name" );
+
+ if ( retValue == null )
+ {
+ retValue = System.getProperty( "user.name" );
+ }
+
+ return retValue;
}
}
1.10 +3 -8 maven-wagon/wagon-providers/http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
Index: HttpWagon.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-providers/http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- HttpWagon.java 19 Jun 2004 21:48:04 -0000 1.9
+++ HttpWagon.java 3 Jul 2004 12:52:22 -0000 1.10
@@ -203,13 +203,9 @@
{
}
- public String[] getSupportedProtocols()
- {
- return new String[]{"http", "https"};
- }
- // get
+ // get
public void get( Artifact artifact, File destination )
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
{
@@ -285,14 +281,13 @@
InputStream is = null;
-
File dir = destination.getParentFile();
if ( dir != null && !dir.exists() )
{
+
if ( ! dir.mkdirs() )
{
-
String msg = "Some of the required local directories do not exist and could not be created. " +
"Requested local path: " + destination.getAbsolutePath();
1.4 +2 -1 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/observers/Debug.java
Index: Debug.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/observers/Debug.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Debug.java 3 Jun 2004 18:26:59 -0000 1.3
+++ Debug.java 3 Jul 2004 12:52:22 -0000 1.4
@@ -190,6 +190,7 @@
" bytes copied in " +
duration +
" seconds";
+
out.println( message );
}
1.7 +2 -3 maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/WagonUtils.java
Index: WagonUtils.java
===================================================================
RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/WagonUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WagonUtils.java 30 Jun 2004 17:19:45 -0000 1.6
+++ WagonUtils.java 3 Jul 2004 12:52:23 -0000 1.7
@@ -51,8 +51,7 @@
return retValue;
}
finally
- {
-
+ {
if ( file != null )
{
boolean deleted = file.delete();
---------------------------------------------------------------------
To unsubscribe, e-mail: wagon-cvs-unsubscribe@maven.apache.org
For additional commands, e-mail: wagon-cvs-help@maven.apache.org