incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1151498 - /sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletRegistryService.java
Date Wed, 27 Jul 2011 15:26:08 GMT
Author: cziegeler
Date: Wed Jul 27 15:26:08 2011
New Revision: 1151498

URL: http://svn.apache.org/viewvc?rev=1151498&view=rev
Log:
Set thread context classloader when using jaxb

Modified:
    sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletRegistryService.java

Modified: sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletRegistryService.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletRegistryService.java?rev=1151498&r1=1151497&r2=1151498&view=diff
==============================================================================
--- sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletRegistryService.java
(original)
+++ sling/whiteboard/portal/container/src/main/java/org/apache/sling/portal/container/internal/services/DefaultPortletRegistryService.java
Wed Jul 27 15:26:08 2011
@@ -26,6 +26,7 @@ import java.util.Map;
 import javax.portlet.Portlet;
 import javax.portlet.PortletException;
 import javax.servlet.ServletContext;
+import javax.xml.bind.JAXBContext;
 
 import org.apache.pluto.container.ContainerInfo;
 import org.apache.pluto.container.PortletAppDescriptorService;
@@ -289,7 +290,9 @@ public class DefaultPortletRegistryServi
     private PortletApplicationDefinition createDefinition(ServletContext servletContext,
String name, String contextPath)
     throws PortletContainerException {
         PortletApplicationDefinition portletApp = null;
+        final ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader();
         try {
+            Thread.currentThread().setContextClassLoader(JAXBContext.class.getClassLoader());
             InputStream paIn = servletContext.getResourceAsStream(PORTLET_XML);
             InputStream webIn = servletContext.getResourceAsStream(WEB_XML);
             if (paIn == null) {
@@ -304,6 +307,8 @@ public class DefaultPortletRegistryServi
             portletDDService.mergeWebDescriptor(portletApp, webIn);
         } catch (Exception ex) {
             throw new PortletContainerException("Unable to load portlet descriptor for context
" + contextPath, ex);
+        } finally {
+            Thread.currentThread().setContextClassLoader(oldTCCL);
         }
         return portletApp;
     }



Mime
View raw message