Return-Path: X-Original-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0FC9F90FD for ; Tue, 2 Oct 2012 15:36:44 +0000 (UTC) Received: (qmail 62889 invoked by uid 500); 2 Oct 2012 15:36:44 -0000 Delivered-To: apmail-jackrabbit-oak-commits-archive@jackrabbit.apache.org Received: (qmail 62876 invoked by uid 500); 2 Oct 2012 15:36:44 -0000 Mailing-List: contact oak-commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-dev@jackrabbit.apache.org Delivered-To: mailing list oak-commits@jackrabbit.apache.org Received: (qmail 62867 invoked by uid 99); 2 Oct 2012 15:36:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2012 15:36:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2012 15:36:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E64482388900; Tue, 2 Oct 2012 15:35:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: oak-commits@jackrabbit.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121002153557.E64482388900@eris.apache.org> 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); } } }