Uploaded image for project: 'PUBLIC - Liferay Portal Enterprise Edition'
  1. PUBLIC - Liferay Portal Enterprise Edition
  2. LPE-1785

Class loading issue with with Base64.stringToObject()

Details

    Description

      Base64.stringToObject(String s) can not used with a different class loader. Even if a different class loader is loaded before calling Base64.stringToObject(), the original class loader will sill be used.

      Specifically, ClassLoaderObjectInputStream needs to use Class.forName() instead of ClassLoader.loadClass. The reason for this is because loadClass actually loads a new instance of the class into the JVM rather than fetch an already loaded class. This happens when doing cross-classloader loading which results in class in-equivalency.

      To address this issue, a new method has been added to Base64:

      stringToObject(String s, ClassLoader classLoader)

      The new method will use the provided ClassLoader to convert the string to an object.

      Attachments

        Issue Links

          Activity

            People

              michael.saechang Michael Saechang
              brian.chan Brian Chan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Packages

                  Version Package
                  5.1 EE SP5 (5.1.8)
                  5.2 EE SP3 (5.2.7)