Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4663

LazyInitProxyFactory uses wrong ClassLoader in OSGi environment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.7
    • 1.5.8, 6.0.0
    • wicket
    • None

    Description

      The method LazyInitProxyFactory#createProxy use Thread.currentThread().getContextClassLoader() to create a new proxy instance. It seems that this is not correct in an OSGi environment.

      Preferred is to use the ClassLoader provided by the AbstractClassResolver class (getClassResolver is not part of IClassResolver).

      Then it will be something like:

      ClassLoader classLoader;
      if (Application.exists())

      { AbstractClassResolver classResolver = (AbstractClassResolver) Application.get() .getApplicationSettings() .getClassResolver(); classLoader = classResolver.getClassLoader(); }

      else

      { classLoader = Thread.currentThread().getContextClassLoader(); }

      try
      {
      return Proxy.newProxyInstance(classLoader, new Class[]

      { type, Serializable.class, ILazyInitProxy.class, IWriteReplace.class }

      , handler);
      }

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            stefanovich Stefan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: