Skip to content

Commit

Permalink
Remove redundant keywords
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jul 21, 2024
1 parent 95ddecd commit d86cbd3
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void setFile(final String file) {
private String destDirUrl;
private String srcDirUrl;
private boolean srcDirIsBase;
private boolean failonerror = true;
private boolean failOnError = true;

private String filesList;

Expand Down Expand Up @@ -346,7 +346,7 @@ protected void handleUpToDateFile(final FileObject srcFile, final FileObject des
* @return true if the operation should fail if there was an error.
*/
public boolean isFailonerror() {
return failonerror;
return failOnError;
}

protected void logOrDie(final String message, final int level) {
Expand All @@ -360,28 +360,28 @@ protected void logOrDie(final String message, final int level) {
/**
* Sets the destination directory.
*
* @param destDir The destination directory.
* @param destDirUrl The destination directory.
*/
public void setDestDir(final String destDir) {
this.destDirUrl = destDir;
public void setDestDir(final String destDirUrl) {
this.destDirUrl = destDirUrl;
}

/**
* Sets the destination file.
*
* @param destFile The destination file name.
* @param destFileUrl The destination file name.
*/
public void setDestFile(final String destFile) {
this.destFileUrl = destFile;
public void setDestFile(final String destFileUrl) {
this.destFileUrl = destFileUrl;
}

/**
* Sets whether we should fail if there was an error or not.
*
* @param failonerror true if the operation should fail if there is an error.
* @param failOnError true if the operation should fail if there is an error.
*/
public void setFailonerror(final boolean failonerror) {
this.failonerror = failonerror;
public void setFailonerror(final boolean failOnError) {
this.failOnError = failOnError;
}

/**
Expand All @@ -407,10 +407,10 @@ public void setSrc(final String srcFile) {
/**
* Sets the source directory.
*
* @param srcDir The source directory.
* @param srcDirUrl The source directory.
*/
public void setSrcDir(final String srcDir) {
this.srcDirUrl = srcDir;
public void setSrcDir(final String srcDirUrl) {
this.srcDirUrl = srcDirUrl;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean canRenameTo(final FileObject newfile) {
return false;
}
try {
return this.hdfs.getFileStatus(new Path(newfile.getName().getPath())) == null;
return hdfs.getFileStatus(new Path(newfile.getName().getPath())) == null;
} catch (final FileNotFoundException e) {
return false;
} catch (final IOException e) {
Expand All @@ -88,9 +88,9 @@ public boolean canRenameTo(final FileObject newfile) {
@Override
protected void doAttach() throws Exception {
try {
this.stat = this.hdfs.getFileStatus(this.path);
stat = hdfs.getFileStatus(path);
} catch (final FileNotFoundException e) {
this.stat = null;
stat = null;
}
}

Expand All @@ -100,7 +100,7 @@ protected void doAttach() throws Exception {
*/
@Override
protected void doCreateFolder() throws Exception {
hdfs.mkdirs(this.path);
hdfs.mkdirs(path);
}

/**
Expand All @@ -109,25 +109,25 @@ protected void doCreateFolder() throws Exception {
*/
@Override
protected void doDelete() throws Exception {
hdfs.delete(this.path, true);
hdfs.delete(path, true);
}

/**
* @see org.apache.commons.vfs2.provider.AbstractFileObject#doGetAttributes()
*/
@Override
protected Map<String, Object> doGetAttributes() throws Exception {
if (null == this.stat) {
if (null == stat) {
return super.doGetAttributes();
}
final Map<String, Object> attrs = new HashMap<>();
attrs.put(HdfsFileAttributes.LAST_ACCESS_TIME.toString(), this.stat.getAccessTime());
attrs.put(HdfsFileAttributes.BLOCK_SIZE.toString(), this.stat.getBlockSize());
attrs.put(HdfsFileAttributes.GROUP.toString(), this.stat.getGroup());
attrs.put(HdfsFileAttributes.OWNER.toString(), this.stat.getOwner());
attrs.put(HdfsFileAttributes.PERMISSIONS.toString(), this.stat.getPermission().toString());
attrs.put(HdfsFileAttributes.LENGTH.toString(), this.stat.getLen());
attrs.put(HdfsFileAttributes.MODIFICATION_TIME.toString(), this.stat.getModificationTime());
attrs.put(HdfsFileAttributes.LAST_ACCESS_TIME.toString(), stat.getAccessTime());
attrs.put(HdfsFileAttributes.BLOCK_SIZE.toString(), stat.getBlockSize());
attrs.put(HdfsFileAttributes.GROUP.toString(), stat.getGroup());
attrs.put(HdfsFileAttributes.OWNER.toString(), stat.getOwner());
attrs.put(HdfsFileAttributes.PERMISSIONS.toString(), stat.getPermission().toString());
attrs.put(HdfsFileAttributes.LENGTH.toString(), stat.getLen());
attrs.put(HdfsFileAttributes.MODIFICATION_TIME.toString(), stat.getModificationTime());
return attrs;
}

Expand All @@ -144,7 +144,7 @@ protected long doGetContentSize() throws Exception {
*/
@Override
protected InputStream doGetInputStream(final int bufferSize) throws Exception {
return this.hdfs.open(this.path, bufferSize);
return hdfs.open(path, bufferSize);
}

/**
Expand All @@ -153,8 +153,8 @@ protected InputStream doGetInputStream(final int bufferSize) throws Exception {
@Override
protected long doGetLastModifiedTime() throws Exception {
doAttach();
if (null != this.stat) {
return this.stat.getModificationTime();
if (null != stat) {
return stat.getModificationTime();
}
return -1;
}
Expand All @@ -166,9 +166,9 @@ protected long doGetLastModifiedTime() throws Exception {
@Override
protected OutputStream doGetOutputStream(final boolean append) throws Exception {
if (append) {
throw new FileSystemException("vfs.provider/write-append-not-supported.error", this.path.getName());
throw new FileSystemException("vfs.provider/write-append-not-supported.error", path.getName());
}
return hdfs.create(this.path);
return hdfs.create(path);
}

/**
Expand All @@ -180,7 +180,7 @@ protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mo
if (mode.equals(RandomAccessMode.READWRITE)) {
throw new UnsupportedOperationException();
}
return new HdfsRandomAccessContent(this.path, this.hdfs);
return new HdfsRandomAccessContent(path, hdfs);
}

/**
Expand Down Expand Up @@ -231,11 +231,11 @@ protected boolean doIsWriteable() throws Exception {
*/
@Override
protected String[] doListChildren() throws Exception {
if (this.doGetType() != FileType.FOLDER) {
if (doGetType() != FileType.FOLDER) {
throw new FileNotFolderException(this);
}

final FileStatus[] fileStatuses = this.hdfs.listStatus(this.path);
final FileStatus[] fileStatuses = hdfs.listStatus(path);
return Stream.of(fileStatuses).filter(Objects::nonNull).map(status -> status.getPath().getName()).toArray(String[]::new);
}

Expand All @@ -244,14 +244,14 @@ protected String[] doListChildren() throws Exception {
*/
@Override
protected FileObject[] doListChildrenResolved() throws Exception {
if (this.doGetType() != FileType.FOLDER) {
if (doGetType() != FileType.FOLDER) {
return null;
}
final String[] children = doListChildren();
final FileObject[] fo = new FileObject[children.length];
for (int i = 0; i < children.length; i++) {
final Path p = new Path(this.path, children[i]);
fo[i] = this.fs.resolveFile(p.toUri().toString());
final Path p = new Path(path, children[i]);
fo[i] = fs.resolveFile(p.toUri().toString());
}
return fo;
}
Expand All @@ -270,7 +270,7 @@ protected void doRemoveAttribute(final String attrName) throws Exception {
*/
@Override
protected void doRename(final FileObject newfile) throws Exception {
hdfs.rename(this.path, new Path(newfile.getName().getPath()));
hdfs.rename(path, new Path(newfile.getName().getPath()));
}

/**
Expand All @@ -287,7 +287,7 @@ protected void doSetAttribute(final String attrName, final Object value) throws
@Override
protected boolean doSetLastModifiedTime(final long modtime) throws Exception {
try {
hdfs.setTimes(this.path, modtime, System.currentTimeMillis());
hdfs.setTimes(path, modtime, System.currentTimeMillis());
} catch (final IOException ioe) {
throw new FileSystemException(ioe);
}
Expand All @@ -302,7 +302,7 @@ protected boolean doSetLastModifiedTime(final long modtime) throws Exception {
public boolean exists() throws FileSystemException {
try {
doAttach();
return this.stat != null;
return stat != null;
} catch (final FileNotFoundException fne) {
return false;
} catch (final Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class HdfsFileProvider extends AbstractOriginatingFileProvider {
* Constructs a new HdfsFileProvider.
*/
public HdfsFileProvider() {
this.setFileNameParser(HttpFileNameParser.getInstance());
setFileNameParser(HttpFileNameParser.getInstance());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected FileObject createFile(final AbstractFileName name) throws Exception {
@Override
public FileObject resolveFile(final FileName name) throws FileSystemException {
synchronized (this) {
if (this.fs == null) {
if (fs == null) {
final String hdfsUri = name.getRootURI();
final HdfsFileSystemConfigBuilder builder = HdfsFileSystemConfigBuilder.getInstance();
final FileSystemOptions options = getFileSystemOptions();
Expand Down Expand Up @@ -161,7 +161,7 @@ public FileObject resolveFile(final FileName name) throws FileSystemException {
fileObject = new HdfsFileObject((AbstractFileName) name, this, fs, filePath);
fileObject = decorateFileObject(fileObject);
if (useCache) {
this.putFileToCache(fileObject);
putFileToCache(fileObject);
}
}
/*
Expand Down
Loading

0 comments on commit d86cbd3

Please sign in to comment.