You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/08/26 18:24:24 UTC

[GitHub] [commons-vfs] garpinc opened a new pull request #114: VFS-570 Add HDFS write support

garpinc opened a new pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on a change in pull request #114: VFS-570 Add HDFS write support

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114#discussion_r477545412



##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on a change in pull request #114: VFS-570 Add HDFS write support

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114#discussion_r477545412



##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on a change in pull request #114: VFS-570 Add HDFS write support

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114#discussion_r477545412



##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory merged pull request #114: VFS-570 Add HDFS write support

Posted by GitBox <gi...@apache.org>.
garydgregory merged pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garpinc commented on pull request #114: VFS-570 Add HDFS write support

Posted by GitBox <gi...@apache.org>.
garpinc commented on pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114#issuecomment-682499752


   Hi @garydgregory can u take a look at this pr. Thx


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-vfs] garydgregory commented on a change in pull request #114: VFS-570 Add HDFS write support

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #114:
URL: https://github.com/apache/commons-vfs/pull/114#discussion_r477545412



##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);

Review comment:
       Throwing `RuntimeException` is an anti-pattern. Use `IllegalArgumentException` or `IllegalStateException`.

##########
File path: commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileObject.java
##########
@@ -67,7 +70,27 @@ protected HdfsFileObject(final AbstractFileName name, final HdfsFileSystem fs, f
      */
     @Override
     public boolean canRenameTo(final FileObject newfile) {
-        throw new UnsupportedOperationException();
+        if (!super.canRenameTo(newfile)) {
+            return false;
+        }
+
+        FileStatus newfileStat = null;
+        try {
+            newfileStat = this.hdfs.getFileStatus(new Path(newfile.getName().getPath()));
+        } catch (final FileNotFoundException e) {
+            // do nothing
+        } catch (IllegalArgumentException e) {
+            throw new RuntimeException(e);

Review comment:
       Why do this? Why not let it percolate up?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org