This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[4.1] Patch: FYI: PR 27163


I'm checking this in on the 4.1 branch.

PR 27163 was reported against 4.1.  This patch pulls in the latest ftp
protocol handler code, fixing the gcj part of problem.  It is binary
compatible.

Whether the rest of the PR is really a bug is hard to say, but I
suspect not.  See the PR for details if you are interested.

svn trunk does not have this bug.

Tom

Index: ChangeLog.gcj
from  Tom Tromey  <tromey@redhat.com>

	PR classpath/27163:
	* gnu/java/net/protocol/ftp/ActiveModeDTP.java: Replaced with
	latest classpath version.
	* gnu/java/net/protocol/ftp/FTPURLConnection.java: Likewise.

Index: gnu/java/net/protocol/ftp/ActiveModeDTP.java
===================================================================
--- gnu/java/net/protocol/ftp/ActiveModeDTP.java	(revision 113013)
+++ gnu/java/net/protocol/ftp/ActiveModeDTP.java	(working copy)
@@ -84,6 +84,7 @@
       }
     this.connectionTimeout = connectionTimeout;
     acceptThread = new Thread(this, "ActiveModeDTP");
+    acceptThread.setDaemon(true);
     acceptThread.start();
   }
 
Index: gnu/java/net/protocol/ftp/FTPURLConnection.java
===================================================================
--- gnu/java/net/protocol/ftp/FTPURLConnection.java	(revision 113013)
+++ gnu/java/net/protocol/ftp/FTPURLConnection.java	(working copy)
@@ -1,5 +1,5 @@
 /* FTPURLConnection.java --
-   Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,10 +38,9 @@
 
 package gnu.java.net.protocol.ftp;
 
+import gnu.classpath.SystemProperties;
 import gnu.java.net.GetLocalHostAction;
-import gnu.java.security.action.GetPropertyAction;
 
-import java.io.FileNotFoundException;
 import java.io.FilterInputStream;
 import java.io.FilterOutputStream;
 import java.io.IOException;
@@ -51,7 +50,6 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.security.AccessController;
-import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -113,11 +111,9 @@
     else
       {
         username = "anonymous";
-        PrivilegedAction a = new GetPropertyAction("user.name");
-        String systemUsername =(String) AccessController.doPrivileged(a);
-        a = new GetLocalHostAction();
+        GetLocalHostAction a = new GetLocalHostAction();
         InetAddress localhost =(InetAddress) AccessController.doPrivileged(a);
-        password = systemUsername + "@" +
+        password = SystemProperties.getProperty("user.name") + "@" +
           ((localhost == null) ? "localhost" : localhost.getHostName());
       }
     connection = new FTPConnection(host, port);
@@ -167,24 +163,13 @@
         connect();
       }
     String path = url.getPath();
-    String filename = null;
-    int lsi = path.lastIndexOf('/');
-    if (lsi != -1)
+    if (connection.changeWorkingDirectory(path))
       {
-        filename = path.substring(lsi + 1);
-        path = path.substring(0, lsi);
-        if (!connection.changeWorkingDirectory(path))
-          {
-            throw new FileNotFoundException(path);
-          }
+        return this.new ClosingInputStream(connection.list(null));
       }
-    if (filename != null && filename.length() > 0)
-      {
-        return this.new ClosingInputStream(connection.retrieve(filename));
-      }
     else
       {
-        return this.new ClosingInputStream(connection.list(null));
+        return this.new ClosingInputStream(connection.retrieve(path));
       }
   }
   
@@ -198,20 +183,8 @@
       {
         connect();
       }
-    String dir = url.getPath();
-    String filename = url.getFile();
-    if (!connection.changeWorkingDirectory(dir))
-      {
-        throw new FileNotFoundException(dir);
-      }
-    if (filename != null)
-      {
-        return this.new ClosingOutputStream(connection.store(filename));
-      }
-    else
-      {
-        throw new FileNotFoundException(filename);
-      }
+    String path = url.getPath();
+    return this.new ClosingOutputStream(connection.store(path));
   }
 
   public String getRequestProperty(String key)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]