Uploaded image for project: 'JBoss Marshalling'
  1. JBoss Marshalling
  2. JBMAR-221

Default constructor of non-Serializable parent POJO is not called in deserialization process

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.0.6.Final
    • None
    • River
    • None

    Description

      Marshalling 1.4.10.SP3 & 1.4.10 are calling the constructor in the parent, which sets the values in the transient fields. 2.0.5.Final is not calling the constructor resulting in the booleans default to false.

      Marshalling 1.4.10.SP3 & 1.4.10

      mutable_one: true
      mutable_two: false
      mutable_three: true
      

      Marshalling 2.0.5.Final

      mutable_one: false
      mutable_two: false
      mutable_three: false
      
      public class MySerializable extends NonSerializableParent implements Serializable {
        private String name;
        public MySerializable(String name) {
          this.name = name;
        }
        public String toString() {
          StringBuilder sb = new StringBuilder();
          sb.append(String.format("name: %s\n", name));
          sb.append(String.format("mutable_one: %s\n", this.is_mutable_one()));
          sb.append(String.format("mutable_two: %s\n", this.is_mutable_two()));
          sb.append(String.format("mutable_three: %s\n", this.is_mutable_three()));
          return sb.toString();
        }   
      }
      public class NonSerializableParent {
          private transient boolean _mutable_one;
          private transient boolean _mutable_two;
          private transient boolean _mutable_three;    
          public NonSerializableParent() {
              this._mutable_one = true;
              this._mutable_two = false;
              this._mutable_three = true;
          }       
        public boolean is_mutable_one() {
          return _mutable_one;
        }
        public void set_mutable_one(boolean _mutable_one) {
          this._mutable_one = _mutable_one;
        }
        public boolean is_mutable_two() {
          return _mutable_two;
        }
        public void set_mutable_two(boolean _mutable_two) {
          this._mutable_two = _mutable_two;
        }
        public boolean is_mutable_three() {
          return _mutable_three;
        }
        public void set_mutable_three(boolean _mutable_three) {
          this._mutable_three = _mutable_three;
        }
      }
      

      Attachments

        Issue Links

          Activity

            People

              dlloyd@redhat.com David Lloyd
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: