You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/01/30 00:05:33 UTC

svn commit: r739070 - in /maven/core-integration-testing/trunk/core-it-support/core-it-wagon: pom.xml src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java

Author: bentmann
Date: Thu Jan 29 23:05:33 2009
New Revision: 739070

URL: http://svn.apache.org/viewvc?rev=739070&view=rev
Log:
o Fixed properties encoding

Modified:
    maven/core-integration-testing/trunk/core-it-support/core-it-wagon/pom.xml
    maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java

Modified: maven/core-integration-testing/trunk/core-it-support/core-it-wagon/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-wagon/pom.xml?rev=739070&r1=739069&r2=739070&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-wagon/pom.xml (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-wagon/pom.xml Thu Jan 29 23:05:33 2009
@@ -34,9 +34,15 @@
 
   <dependencies>
     <dependency>
+      <!--
+      NOTE: This is a dummy dependency required to make the DefaultExtensionManager load the wagon into the extension
+      container and not the core container. To be loaded into the extension container, an extension needs at least two
+      dependencies (not counting the ever present plexus-utils).
+      -->
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.1</version>
+      <version>3.8.2</version>
+      <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>

Modified: maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java?rev=739070&r1=739069&r2=739070&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-wagon/src/main/java/org/apache/maven/wagon/providers/ssh/external/ScpExternalWagon.java Thu Jan 29 23:05:33 2009
@@ -19,11 +19,14 @@
  * under the License.
  */
 
+import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Properties;
 
 import org.apache.maven.wagon.AbstractWagon;
 import org.apache.maven.wagon.ConnectionException;
@@ -34,8 +37,6 @@
 import org.apache.maven.wagon.authentication.AuthenticationException;
 import org.apache.maven.wagon.authorization.AuthorizationException;
 import org.apache.maven.wagon.resource.Resource;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.StringInputStream;
 
 /**
  * NOTE: Plexus will only pick this correctly if the Class package and name are the same as that in core. This is
@@ -119,31 +120,47 @@
     public void fillInputData( InputData inputData )
         throws TransferFailedException, ResourceDoesNotExistException
     {
-        inputData.setInputStream( new StringInputStream( "<metadata />" ) );
+        try
+        {
+            inputData.setInputStream( new ByteArrayInputStream( "<metadata />".getBytes( "UTF-8" ) ) );
+        }
+        catch ( IOException e )
+        {
+            throw new TransferFailedException( "Broken JVM", e );
+        }
     }
 
     public void fillOutputData( OutputData outputData )
         throws TransferFailedException
     {
-        String content = "";
+        Properties props = new Properties();
         if ( getRepository().getPermissions() != null )
         {
             String dirPerms = getRepository().getPermissions().getDirectoryMode();
 
             if ( dirPerms != null )
             {
-                content += "directory.mode = " + dirPerms + "\n";
+                props.setProperty( "directory.mode", dirPerms );
             }
 
             String filePerms = getRepository().getPermissions().getFileMode();
             if ( filePerms != null )
             {
-                content += "file.mode = " + filePerms + "\n";
+                props.setProperty( "file.mode", filePerms );
             }
         }
+
         try
         {
-            FileUtils.fileWrite( "target/wagon.properties", content );
+            OutputStream os = new FileOutputStream( "target/wagon.properties" );
+            try
+            {
+                props.store( os, "MAVEN-CORE-IT-WAGON" );
+            }
+            finally
+            {
+                os.close();
+            }
         }
         catch ( IOException e )
         {