You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2018/11/20 20:59:37 UTC

svn commit: r1847064 - /commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java

Author: ggregory
Date: Tue Nov 20 20:59:36 2018
New Revision: 1847064

URL: http://svn.apache.org/viewvc?rev=1847064&view=rev
Log:
Refacor null-check pattern into FileSystemException.requireNonNull() inspired by java.lang.Objects.requireNonNull().

Modified:
    commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java?rev=1847064&r1=1847063&r2=1847064&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileObject.java Tue Nov 20 20:59:36 2018
@@ -513,10 +513,8 @@ public class FtpFileObject extends Abstr
                 out = client.storeFileStream(relPath);
             }
 
-            if (out == null) {
-                throw new FileSystemException("vfs.provider.ftp/output-error.debug", this.getName(),
-                        client.getReplyString());
-            }
+            FileSystemException.requireNonNull(out, "vfs.provider.ftp/output-error.debug", this.getName(),
+                    client.getReplyString());
 
             return new FtpOutputStream(client, out);
         } catch (final Exception e) {
@@ -545,10 +543,8 @@ public class FtpFileObject extends Abstr
         final FtpClient client = getAbstractFileSystem().getClient();
         try {
             final InputStream instr = client.retrieveFileStream(relPath, filePointer);
-            if (instr == null) {
-                throw new FileSystemException("vfs.provider.ftp/input-error.debug", this.getName(),
-                        client.getReplyString());
-            }
+            FileSystemException.requireNonNull(instr, "vfs.provider.ftp/input-error.debug", this.getName(),
+                    client.getReplyString());
             return new FtpInputStream(client, instr);
         } catch (final IOException e) {
             getAbstractFileSystem().putClient(client);