Details
Description
in if statement,the lazyPersist is always true, thus the ternary operator is redundant,
lazyPersist == true in if statment, so lazyPersist ? 1 : getDefaultReplication(item.path) is redundant.
related code like below, which is in org.apache.hadoop.fs.shell.CommandWithDestination lineNumber : 504 :
FSDataOutputStream create(PathData item, boolean lazyPersist, boolean direct) throws IOException { try { if (lazyPersist) { // in if stament, lazyPersist is always true …… return create(item.path, FsPermission.getFileDefault().applyUMask( FsPermission.getUMask(getConf())), createFlags, getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, IO_FILE_BUFFER_SIZE_DEFAULT), lazyPersist ? 1 : getDefaultReplication(item.path), // *this is redundant* getDefaultBlockSize(), null, null); } else { return create(item.path, true); } } finally { // might have been created but stream was interrupted if (!direct) { deleteOnExit(item.path); } } }
Attachments
Attachments
Issue Links
- Is contained by
-
HADOOP-12940 Fix warnings from Spotbugs in hadoop-common
- Resolved