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

java.beans.DefaultPersistenceDelegate.instantiate(..) doesn't throw NPE

XMLWordPrintable

    • b110
    • generic
    • generic
    • Verified

      Specification for the following method says:

      http://download.oracle.com/javase/7/docs/api/java/beans/DefaultPersistenceDelegate.html#instantiate%28java.lang.Object,%20java.beans.Encoder%29

      Throws:
          NullPointerException - if out is null

      This assertion is not satisfied. Please see the following code sample:


      import java.beans.Encoder;
      import java.beans.Expression;

      public class DefaultPersistenceDelegate {

          public static void main(String[] args) {

              class MyPersistenceDelegate extends java.beans.DefaultPersistenceDelegate {
                  @Override public Expression instantiate(Object oldInstance, Encoder out) {
                      return super.instantiate(oldInstance, out);
                  }
              }
              
              new MyPersistenceDelegate().instantiate(new Object(), (Encoder)null);
          }

      }

      The output will be blank.

            malenkov Sergey Malenkov (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: