[
https://issues.apache.org/jira/browse/HADOOP-14400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16003924#comment-16003924
]
Akira Ajisaka commented on HADOOP-14400:
----------------------------------------
Thanks [~cheersyang] for providing the patch! Some comments:
1.
{code:title=InputStriper.java}
+ final double va = a.getValue();
+ final double vb = b.getValue();
+ return Double.compare(va, vb) > 0 ?
+ -1 : Double.compare(va, vb) < 0 ? 1 : 0;
{code}
This comparator is only used for sorting, so we can simply return
{{Double.compare(a.getvalue(), b.getValue())}}. Furthermore, the sort can be
simplified by lambda as follows:
{code}
sort.sort(sort, Comparator.comparingDouble(Entry::getValue));
{code}
2.
{code:title=TestSLSWebApp.java}
Map<String, Object> simulateInfoMap = new HashedMap();
{code}
java.util.HashMap is sufficient for me. Is there any reason to use this
implementation?
3.
{code:title=MapReduceJobPropertiesParser.java}
Boolean.parseBoolean(value);
return defaultValue;
{code}
{{Boolean.parseBoolean(value)}} looks unnecessary.
> Fix warnings from spotbugs in hadoop-tools
> ------------------------------------------
>
> Key: HADOOP-14400
> URL: https://issues.apache.org/jira/browse/HADOOP-14400
> Project: Hadoop Common
> Issue Type: Bug
> Components: tools
> Reporter: Weiwei Yang
> Assignee: Weiwei Yang
> Labels: findbugs
> Attachments: HADOOP-14400.001.patch
>
>
> Fix 4 warnings in hadoop-tools project since moved to spotbugs.
> # Return value of new
> org.apache.hadoop.tools.rumen.datatypes.DefaultDataType(String) ignored, but
> method has no side effect At MapReduceJobPropertiesParser.java
> # org.apache.hadoop.mapred.gridmix.InputStriper$1.compare(Map$Entry,
> Map$Entry) incorrectly handles double value
> # Useless object stored in variable keysToUpdateAsFolder of method
> org.apache.hadoop.fs.azure.NativeAzureFileSystem.mkdirs(Path, FsPermission,
> boolean) At NativeAzureFileSystem.java
> # org.apache.hadoop.yarn.sls.SLSRunner.simulateInfoMap is a mutable
> collection At SLSRunner.java
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]