hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Junping Du (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (YARN-2939) Fix new findbugs warnings in hadoop-yarn-common
Date Tue, 16 Dec 2014 15:59:13 GMT

    [ https://issues.apache.org/jira/browse/YARN-2939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14248401#comment-14248401
] 

Junping Du commented on YARN-2939:
----------------------------------

Thanks [~gtCarrera] to deliver a patch to fix this. The test failures are not related and
tracked in YARN-2782 and YARN-2783 which could be repeated with JAVA 8 environment. Some comments:
{code}
+  <!-- Ignore unrelated URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD warnings -->
+  <Match>
+    <Class name="org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl$TimelineClientConnectionRetry"
/>
+    <Field name="retried" />
+    <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
+  </Match>
+
+  <Match>
+    <Class name="org.apache.hadoop.yarn.nodelabels.CommonNodeLabelsManager$Label" />
+    <Field name="resource" />
+    <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
+  </Match>
{code}
We should replace directly access to public field with public method (getter and setter) on
private field.

{code}
+  <Match>
+    <Class name="org.apache.hadoop.yarn.nodelabels.NodeLabelsStore" />
+    <Field name="conf" />
+    <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
+  </Match>
+
+  <Match>
+    <Class name="org.apache.hadoop.yarn.util.ResourceCalculatorPlugin" />
+    <Field name="processPid" />
+    <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
+  </Match>
{code}
These two fields are not access publicly or in subclass, so we should replace its visibility
from protected to private.

{code}
-      sb.append(String.format("graph [ label=%s, fontsize=24, fontname=Helvetica];\n",
+      sb.append(String.format("graph [ label=%s, fontsize=24, fontname=Helvetica];%n",
           wrapSafeString(name)));
       sb.append("node [fontsize=12, fontname=Helvetica];\n");
       sb.append("edge [fontsize=9, fontcolor=blue, fontname=Arial];\n");
{code}
Why we need this change for this JIRA? If we want it to be portable to other platforms, we
should also do the similar thing for code below and should do it separately.


> Fix new findbugs warnings in hadoop-yarn-common
> -----------------------------------------------
>
>                 Key: YARN-2939
>                 URL: https://issues.apache.org/jira/browse/YARN-2939
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: Varun Saxena
>            Assignee: Li Lu
>              Labels: findbugs
>         Attachments: YARN-2939-120914.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message