hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Varun Saxena (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-11373) Fix new findbugs warnings in hadoop-yarn-nodemanager
Date Tue, 09 Dec 2014 19:34:12 GMT

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

Varun Saxena commented on HADOOP-11373:
---------------------------------------

Following findbugs issues were fixed :

* *DM_DEFAULT_ENCODING* - Found reliance on system default encoding. To fix, specified charset
encoding as UTF-8
{code:title=ContainerExecutor.java:229|borderStyle=solid}
    pout = new PrintStream(out);
{code}
{code:title=DefaultContainerExecutor.java:295|borderStyle=solid}
    pout = new PrintStream(out);
{code}
{code:title=DefaultContainerExecutor.java:348|borderStyle=solid}
    pout = new PrintStream(out);
{code}
{code:title=DockerContainerExecutor.java:313|borderStyle=solid}
    pout = new PrintStream(out);
    if (LOG.isDebugEnabled()) {
      ps = new PrintStream(baos);
      sb.write(ps);
    }
{code}
{code:title=DockerContainerExecutor.java:329|borderStyle=solid}
    pout = new PrintStream(out);
{code}
{code:title=DockerContainerExecutor.java:443|borderStyle=solid}
    pout = new PrintStream(out);
{code}
{code:title=DockerContainerExecutor.java:501|borderStyle=solid}
    pout = new PrintStream(out);
{code}
{code:title=WindowsSecureContainerExecutor.java:489|borderStyle=solid}
    BufferedReader lines = new BufferedReader(
             new InputStreamReader(stream));
{code}
{code:title=CgroupsLCEResourcesHandler.java:247|borderStyle=solid}
    FileWriter f = null;
    try {
      f = new FileWriter(path + "/" + param, false);
      f.write(value);
      ...
    } catch (IOException e) {
      ....
    }
{code}
{code:title=CgroupsLCEResourcesHandler.java:379|borderStyle=solid}
     BufferedReader in = null; 
     try {
       in = new BufferedReader(new FileReader(new File(getMtabFileName())));
       ....
    } catch (IOException e) {
      ....
    }
{code}
{code:title=ProcessIdFileReader.java:58|borderStyle=solid}
    FileReader fileReader = null;
    BufferedReader bufReader = null;
 
    try {
      File file = new File(path.toString());
      if (file.exists()) {
       fileReader = new FileReader(file);
       bufReader = new BufferedReader(fileReader);
       ....
    } catch (IOException e) {
       ....
    }
{code}
{code:title=ContainerLogsPage.java:154|borderStyle=solid}
    InputStreamReader reader = new InputStreamReader(logByteStream);
{code}

* *RV_ABSOLUTE_VALUE_OF_RANDOM_INT* - Random long value passed to Maths#abs but Math.abs(Long.MIN_VALUE)
== Long.MIN_VALUE. To fix passed RandomUtils#nextLong instead of Random#nextLong
{code:title=DefaultContainerExecutor.java:543|borderStyle=solid}
    Random r = new Random();
    long randomPosition = Math.abs(r.nextLong()) % totalAvailable;
{code}
{code:title=DockerContainerExecutor.java:740|borderStyle=solid}
    Random r = new Random();
    long randomPosition = Math.abs(r.nextLong()) % totalAvailable;
{code}

- *RV_RETURN_VALUE_IGNORED_BAD_PRACTICE* - Return value of ExecutorService#submit ignored.
To fix, return value of Future<T> is collected and checked
{code:title=ContainersLauncher.java:118|borderStyle=solid}
    containerLauncher.submit(launch);
{code}
{code:title=SharedCacheUploadService.java:118|borderStyle=solid}
    uploaderPool.submit(uploader);
{code}

- *VA_FORMAT_STRING_USES_NEWLINE* - Format string was using \n. To fix, changed \n to %n
{code:title=WindowsSecureContainerExecutor.java:706|borderStyle=solid}
      LOG.warn(String.format(
             "An exception occured during the cleanup of localizer job %s:\n%s",  
              localizerPid, 
              org.apache.hadoop.util.StringUtils.stringifyException(e)));
{code}

- *NP_NULL_ON_SOME_PATH_EXCEPTION* - BufferedReader#close being called but the object maybe
null. To fix, introduced null check.
{code:title=CgroupsLCEResourcesHandler.java:401|borderStyle=solid}
    } catch (IOException e) {
       throw new IOException("Error while reading " + getMtabFileName(), e);
     } finally {
      // Close the streams
      try {
        in.close();
      } catch (IOException e2) {
        LOG.warn("Error closing the stream: " + getMtabFileName(), e2);
     }
{code}

- *RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE* - Unnecesary null check in exception block.
{code:title=LinuxContainerExecutor.java:304|borderStyle=solid}
    } catch (ExitCodeException e) {
      if (null == shExec) {
      return -1;
      }
      ....
   }
{code}

- *SF_SWITCH_NO_DEFAULT* - No default case in switch statement in ContainerImpl#finished

> Fix new findbugs warnings in hadoop-yarn-nodemanager
> ----------------------------------------------------
>
>                 Key: HADOOP-11373
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11373
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Varun Saxena
>            Assignee: Varun Saxena
>




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

Mime
View raw message