Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-5866

[classlib][beans] java.beans.XMLDecoder(4) always use Thread.currentThread().getContextClassLoader()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.0M6
    • 5.0M6
    • Classlib
    • None
    • Patch Available

    Description

      I read java.beans.XMLDecoder code and find that XMLDecoder(4) as follows:

      public XMLDecoder(InputStream inputStream, Object owner, ExceptionListener listener, ClassLoader cl) {
      this(inputStream, owner, listener);
      defaultClassLoader = cl;
      }

      This constructor will first call XMLDecoder(3) which always use Thread.currentThread().getContextClassLoader() regardless of user's ClassLoader.
      I think the solution is to set the deafultClassLoader first before use SAXParser to parse xml.

      Attachments

        1. HARMONY-5866.diff
          2 kB
          Kevin Zhou
        2. HARMONY-5866v2.diff
          4 kB
          Kevin Zhou

        Activity

          People

            qiuxiaox Sean Qiu
            zhoukevin Kevin Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified