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

LazyInitProxyFactory uses wrong ClassLoader in OSGi environment

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.7
    • Fix Version/s: 1.5.8, 6.0.0
    • Component/s: wicket
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: