Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1502

ByteArrayResource bytes attribute read/write twice

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.10.0.GA
    • 7.9.0.GA
    • BRE
    • None

      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.

       

       

              mfusco@redhat.com Mario Fusco
              rhn-support-mputz Martin Weiler (Inactive)
              Daniel Rosa Daniel Rosa
              Daniel Rosa Daniel Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: