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

DecimalFormat.digitList is transient but no readObject to initialize its value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.4
    • 1.1.3
    • core-libs
    • None
    • 1.1.4
    • x86
    • windows_95
    • Not verified



      Name: rlT66838 Date: 09/09/97


      1) Serialize an instance of DecimalFormat.
      2) DeSerialize the serialized instance.
      3) Call format on the deserialized instance.

      You will get the following exception because
      DecimalFormat.digitList is null:

      java.lang.NullPointerException
              at java.text.DecimalFormat.format(DecimalFormat.java:302)
              at java.text.NumberFormat.format(NumberFormat.java:182)


      DecimalFormat declares digitList to be
      transient and initializes it to new DigitList().
      The initialization is not executed
      when deserializing so it is necessary to
      implement a readObject method which does the
      following:

      private void readObject(ObjectInputStream in) throws IOException,
      {
          in.defaultReadObject();
          digitList = new DigitList();
      }


      company - Neuron Data , email - ###@###.###
      ======================================================================

            nlindenbsunw Norbert Lindenberg (Inactive)
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: