Hadoop Common
  1. Hadoop Common
  2. HADOOP-5856

FindBugs : fix "unsafe multithreaded use of DateFormat" warning in hdfs

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.21.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      This JIRA fixes the following warning:

      STCAL Call to method of static java.text.DateFormat in org.apache.hadoop.hdfs.server.datanode.DataBlockScanner$LogEntry.newEnry(Block, long)
      Bug type STCAL_INVOKE_ON_STATIC_DATE_FORMAT_INSTANCE (click for details)
      In class org.apache.hadoop.hdfs.server.datanode.DataBlockScanner$LogEntry
      In method org.apache.hadoop.hdfs.server.datanode.DataBlockScanner$LogEntry.newEnry(Block, long)
      Called method java.text.DateFormat.format(Date)
      Field org.apache.hadoop.hdfs.server.datanode.DataBlockScanner.dateFormat
      At DataBlockScanner.java:[line 385]

      1. 5856-0.patch
        2 kB
        Kan Zhang
      2. 5856-1.patch
        2 kB
        Kan Zhang
      3. 5856-2.patch
        1 kB
        Kan Zhang

        Activity

        Kan Zhang created issue -
        Kan Zhang made changes -
        Field Original Value New Value
        Attachment 5856-0.patch [ 12408298 ]
        Hide
        Suresh Srinivas added a comment -

        +1. Can you please fix the typo in the method name from newEnry to newEntry

        Show
        Suresh Srinivas added a comment - +1. Can you please fix the typo in the method name from newEnry to newEntry
        Kan Zhang made changes -
        Attachment 5856-1.patch [ 12408299 ]
        Hide
        Kan Zhang added a comment -

        > Can you please fix the typo in the method name from newEnry to newEntry
        done.

        Show
        Kan Zhang added a comment - > Can you please fix the typo in the method name from newEnry to newEntry done.
        Kan Zhang made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Tsz Wo Nicholas Sze added a comment -

        I suggesting removing newEnry(..), i.e.

        -      log.appendLine(LogEntry.newEnry(block, now));
        +      log.appendLine("date=\"" + dateFormat.format(new Date(now)) + "\"\t " +
        +          "time=\"" + now + "\"\t " +
        +          "genstamp=\"" + block.getGenerationStamp() + "\"\t " +
        +          "id=\"" + block.getBlockId() +"\"");
        
        Show
        Tsz Wo Nicholas Sze added a comment - I suggesting removing newEnry(..), i.e. - log.appendLine(LogEntry.newEnry(block, now)); + log.appendLine( "date=\" " + dateFormat.format( new Date(now)) + " \ "\t " + + "time=\" " + now + " \ "\t " + + "genstamp=\" " + block.getGenerationStamp() + " \ "\t " + + "id=\" " + block.getBlockId() +" \"");
        Kan Zhang made changes -
        Attachment 5856-2.patch [ 12408541 ]
        Hide
        Kan Zhang added a comment -

        good idea, new patch attached.

        Show
        Kan Zhang added a comment - good idea, new patch attached.
        Hide
        Tsz Wo Nicholas Sze added a comment -

        +1 5856-2.patch looks good.

        Show
        Tsz Wo Nicholas Sze added a comment - +1 5856-2.patch looks good.
        Tsz Wo Nicholas Sze made changes -
        Hadoop Flags [Reviewed]
        Kan Zhang made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Kan Zhang made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12408541/5856-2.patch
        against trunk revision 778811.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no tests are needed for this patch.

        +1 javadoc. The javadoc tool did not generate any warning messages.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 findbugs. The patch does not introduce any new Findbugs warnings.

        +1 Eclipse classpath. The patch retains Eclipse classpath integrity.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        -1 core tests. The patch failed core unit tests.

        -1 contrib tests. The patch failed contrib unit tests.

        Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/testReport/
        Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
        Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/artifact/trunk/build/test/checkstyle-errors.html
        Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12408541/5856-2.patch against trunk revision 778811. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no tests are needed for this patch. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs warnings. +1 Eclipse classpath. The patch retains Eclipse classpath integrity. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed core unit tests. -1 contrib tests. The patch failed contrib unit tests. Test results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/testReport/ Findbugs warnings: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Checkstyle results: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/artifact/trunk/build/test/checkstyle-errors.html Console output: http://hudson.zones.apache.org/hudson/job/Hadoop-Patch-vesta.apache.org/405/console This message is automatically generated.
        Hide
        Tsz Wo Nicholas Sze added a comment -

        The failed tests are not related. I have run TestDatanodeDeath a few times and it did not fail.

        I have committed this. Thanks, Kan!

        Show
        Tsz Wo Nicholas Sze added a comment - The failed tests are not related. I have run TestDatanodeDeath a few times and it did not fail. I have committed this. Thanks, Kan!
        Tsz Wo Nicholas Sze made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Fix Version/s 0.21.0 [ 12313563 ]
        Resolution Fixed [ 1 ]
        Owen O'Malley made changes -
        Component/s dfs [ 12310710 ]
        Tom White made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Kan Zhang
            Reporter:
            Kan Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development