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

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

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      Name: dfC67450 Date: 02/13/98



      The java.text.MessageFormat.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:

      -----------------TestMF.java------------------------
      import java.text.*;

      public class TestMF {
          public static void main (String args[]){
              MessageFormat mf = new MessageFormat("");
              System.out.println(mf.equals(null));
          }
      }
      ---------Output from the test---------------------
      java.lang.NullPointerException
              at java.text.MessageFormat.equals(MessageFormat.java)
              at TestMF.main(TestMF.java:6)
      -------------------------------------------------

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

            aliusunw Alan Liu (Inactive)
            dfazunensunw Dmitri Fazunenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: