Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-4210

Findbugs warnings are printed related to equals implementation of several classes

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.20.0
    • None
    • None
    • Incompatible change, Reviewed
    • Changed public class org.apache.hadoop.mapreduce.ID to be an abstract class. Removed from class org.apache.hadoop.mapreduce.ID the methods public static ID read(DataInput in) and public static ID forName(String str).

    Description

      During compilation - findbugs generates several warnings that indicates bugs in the implementation of equals method. One of the example of this report is:

      Bug type EQ_GETCLASS_AND_CLASS_CONSTANT (click for details)
      In class org.apache.hadoop.mapred.ID
      In method org.apache.hadoop.mapred.ID.equals(Object)
      At ID.java:[line 66]
      Value doesn't work for subtypes

      This class has an equals method that will be broken if it is inherited by subclasses. It compares a class literal with the class of the argument (e.g., in class Foo it might check if Foo.class == o.getClass()). It is better to check if this.getClass() == o.getClass().

      Attachments

        1. HADOOP4210.patch
          6 kB
          Suresh Srinivas
        2. HADOOP-4210.patch
          10 kB
          Suresh Srinivas
        3. HADOOP-4210.patch
          8 kB
          Suresh Srinivas

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            sureshms Suresh Srinivas
            sureshms Suresh Srinivas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment