You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2005/10/18 19:34:28 UTC
svn commit: r326177 - in /jakarta/commons/proper/vfs/trunk: ./
src/java/org/apache/commons/vfs/
src/java/org/apache/commons/vfs/provider/ftp/
Author: imario
Date: Tue Oct 18 10:34:19 2005
New Revision: 326177
URL: http://svn.apache.org/viewcvs?rev=326177&view=rev
Log:
ftp: better error message if it isnt possible to aquire a input or output stream
Modified:
jakarta/commons/proper/vfs/trunk/RELEASE_NOTES.txt
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FTPClientWrapper.java
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClient.java
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
Modified: jakarta/commons/proper/vfs/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/RELEASE_NOTES.txt?rev=326177&r1=326176&r2=326177&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/commons/proper/vfs/trunk/RELEASE_NOTES.txt Tue Oct 18 10:34:19 2005
@@ -1,5 +1,8 @@
2005-11 comons-vfs 1.0 RC6
+ftp:
+better error message if it isnt possible to aquire a input or output stream
+
core:
removed check for isWriteable in deleteSelf as its possible to delete a read-only file
if you have write-execute access to the directory
Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties?rev=326177&r1=326176&r2=326177&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties Tue Oct 18 10:34:19 2005
@@ -195,6 +195,8 @@
vfs.provider.ftp/close-connection.error=Could not close connection to FTP server.
vfs.provider.ftp/change-work-directory.error=Could not change to work directory "{0}".
vfs.provider.ftp/invalid-directory-entry.debug=Invalid directory entry at line "{0}" (directory "{1}").
+vfs.provider.ftp/output-error.debug=Cant open output connection for file "{0}". Reason: "{1}".
+vfs.provider.ftp/input-error.debug=Cant open input connection for file "{0}". Reason: "{1}".
# URL Provider
vfs.provider.url/badly-formed-uri.error=Badly formed URI "{0}".
Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FTPClientWrapper.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FTPClientWrapper.java?rev=326177&r1=326176&r2=326177&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FTPClientWrapper.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FTPClientWrapper.java Tue Oct 18 10:34:19 2005
@@ -242,4 +242,9 @@
}
return true;
}
+
+ public String getReplyString() throws IOException
+ {
+ return getFtpClient().getReplyString();
+ }
}
Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClient.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClient.java?rev=326177&r1=326176&r2=326177&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClient.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpClient.java Tue Oct 18 10:34:19 2005
@@ -44,6 +44,7 @@
boolean completePendingCommand() throws IOException;
InputStream retrieveFileStream(String relPath) throws IOException;
+
InputStream retrieveFileStream(String relPath, long restartOffset) throws IOException;
OutputStream appendFileStream(String relPath) throws IOException;
@@ -51,4 +52,6 @@
OutputStream storeFileStream(String relPath) throws IOException;
public boolean abort() throws IOException;
+
+ public String getReplyString() throws IOException;
}
Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java?rev=326177&r1=326176&r2=326177&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java Tue Oct 18 10:34:19 2005
@@ -34,12 +34,12 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Calendar;
+import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
-import java.util.Collections;
/**
* An FTP file.
@@ -479,14 +479,26 @@
throws Exception
{
final FtpClient client = ftpFs.getClient();
+ OutputStream out = null;
if (bAppend)
{
- return new FtpOutputStream(client, client.appendFileStream(relPath));
+ out = client.appendFileStream(relPath);
}
else
{
- return new FtpOutputStream(client, client.storeFileStream(relPath));
+ out = client.storeFileStream(relPath);
+ }
+
+ if (out == null)
+ {
+ throw new FileSystemException("vfs.provider.ftp/output-error.debug", new Object[]
+ {
+ this.getName(),
+ client.getReplyString()
+ });
}
+
+ return new FtpOutputStream(client, out);
}
String getRelPath()
@@ -498,6 +510,14 @@
{
final FtpClient client = ftpFs.getClient();
final InputStream instr = client.retrieveFileStream(relPath, filePointer);
+ if (instr == null)
+ {
+ throw new FileSystemException("vfs.provider.ftp/input-error.debug", new Object[]
+ {
+ this.getName(),
+ client.getReplyString()
+ });
+ }
return new FtpInputStream(client, instr);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org