Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5681

ByteArrayResource bytes attribute read/write twice

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 7.43.1.Final
    • core engine
    • None

    Description

      When using Java standard serialization mechanism, we can see that ByteArrayResource is now written twice

      in ByteArrayResource

      @Override
      public void writeExternal(ObjectOutput out) throws IOException {
       super.writeExternal( out );
       out.writeObject( bytes );
       out.writeObject(this.encoding);
      }

      And super class writeExternal:

      public void writeExternal(ObjectOutput out) throws IOException {
      //...
       out.writeObject( bytes );
      }

      It works as it also read twice in ByteArrayResource#readExternal and ByteArrayResource#readExternal.

      Anyway, moving the bytes attribute from child class to super class in bb5e421df broke our project serialization as we rely on java serialization for our KieBase resources. Seems ok as we'll address it by some tweaking on serialVersionUID, but fixing this issue (read/write once instead of twice) will also break deserialization for projects which rely on it from 7.34.0.Final.

      Don't know if it's ok to fix it in the next version. I can make a PR for this case.

       

       

      Attachments

        Issue Links

          Activity

            People

              mfusco@redhat.com Mario Fusco
              slem1 Sylvain Lemoine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: