Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4084084

java.text.DecimalFormat.equals(null) throws NullPointerException

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.6
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Backports

        Description



        Name: dfC67450 Date: 10/06/97



        The java.text.DecimalFormat.equals(Object) method does not work correctly.
        This method should return false if called with null argument
        (see general contract for equals(): JLS 1.0 item 20.1.3, page 459).
        But it throws NullPointerException.


        Here is the test demonstrating the bug:

        -----------------Test.java------------------------
        import java.text.DecimalFormat;

        public class Test {
            public static void main (String args[]){
                DecimalFormat dfs = new DecimalFormat();
                dfs.equals(null);
            }
        }
        ---------Output from the test---------------------
        java.lang.NullPointerException
                at java.text.NumberFormat.equals(NumberFormat.java)
                at java.text.DecimalFormat.equals(DecimalFormat.java)
                at Test.main(Test.java:6)
        --------------------------------------------------

        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                joconnersunw John Oconner (Inactive)
                Reporter:
                dfazunensunw Dmitri Fazunenko (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: