jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1392976 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/InitialContent.java
Date Tue, 02 Oct 2012 15:35:57 GMT
Author: mreutegg
Date: Tue Oct  2 15:35:57 2012
New Revision: 1392976

URL: http://svn.apache.org/viewvc?rev=1392976&view=rev
Log:
OAK-41: Initial repository setup
- add class loader workaround needed in OSGi environment

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/InitialContent.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/InitialContent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/InitialContent.java?rev=1392976&r1=1392975&r2=1392976&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/InitialContent.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/InitialContent.java
Tue Oct  2 15:35:57 2012
@@ -63,10 +63,18 @@ public class InitialContent extends Defa
         Oak oak = new Oak(mk);
         oak.with(new OpenLoginContextProvider());
         oak.with(new OpenAccessControlContextProvider());
+
+        // TODO: The context class loader hack below shouldn't be needed
+        // with a properly OSGi-compatible JAAS implementation
+        Thread thread = Thread.currentThread();
+        ClassLoader loader = thread.getContextClassLoader();
         try {
+            thread.setContextClassLoader(Oak.class.getClassLoader());
             return oak.createContentRepository().login(null, null).getLatestRoot();
         } catch (Exception e) {
             throw new IllegalStateException("Unable to create a Root", e);
+        } finally {
+            thread.setContextClassLoader(loader);
         }
     }
 }



Mime
View raw message