FELIX-4705 Added logger to BundleClassLoader and BundleClassLoaderJava5
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1640741 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index 2c4336d..9bb5ee1 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -707,10 +707,10 @@
try
{
Constructor ctor = BundleRevisionImpl.getSecureAction()
- .getConstructor(clazz, new Class[] { BundleWiringImpl.class, ClassLoader.class });
+ .getConstructor(clazz, new Class[] { BundleWiringImpl.class, ClassLoader.class, Logger.class });
m_classLoader = (BundleClassLoader)
BundleRevisionImpl.getSecureAction().invoke(ctor,
- new Object[] { this, determineParentClassLoader() });
+ new Object[] { this, determineParentClassLoader(), m_logger });
}
catch (Exception ex)
{
@@ -1891,9 +1891,9 @@
private final BundleWiringImpl m_wiring;
- public BundleClassLoaderJava5(BundleWiringImpl wiring, ClassLoader parent)
+ public BundleClassLoaderJava5(BundleWiringImpl wiring, ClassLoader parent, Logger logger)
{
- super(wiring, parent);
+ super(wiring, parent, logger);
m_wiring = wiring;
}
@@ -1944,8 +1944,9 @@
private static final int LIBPATH_IDX = 1;
private final Map<String, Thread> m_classLocks = new HashMap<String, Thread>();
private final BundleWiringImpl m_wiring;
+ private final Logger m_logger;
- public BundleClassLoader(BundleWiringImpl wiring, ClassLoader parent)
+ public BundleClassLoader(BundleWiringImpl wiring, ClassLoader parent, Logger logger)
{
super(parent);
if (m_dexFileClassLoadClass != null)
@@ -1957,6 +1958,7 @@
m_jarContentToDexFile = null;
}
m_wiring = wiring;
+ m_logger = logger;
}
protected boolean isParallel()
diff --git a/framework/src/test/java/org/apache/felix/framework/BundleWiringImplTest.java b/framework/src/test/java/org/apache/felix/framework/BundleWiringImplTest.java
new file mode 100644
index 0000000..e408255
--- /dev/null
+++ b/framework/src/test/java/org/apache/felix/framework/BundleWiringImplTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.framework;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.felix.framework.BundleWiringImpl.BundleClassLoader;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BundleWiringImplTest
+{
+
+ private BundleWiringImpl bundleWiring;
+
+ private BundleClassLoader bundleClassLoader;
+
+ @Before
+ public void setUp() throws Exception
+ {
+ Logger logger = new Logger();
+ Constructor ctor = BundleRevisionImpl.getSecureAction()
+ .getConstructor(BundleClassLoader.class, new Class[] { BundleWiringImpl.class, ClassLoader.class, Logger.class });
+ bundleClassLoader = (BundleClassLoader)
+ BundleRevisionImpl.getSecureAction().invoke(ctor,
+ new Object[] { bundleWiring, this.getClass().getClassLoader(), logger });
+ }
+
+ @Test
+ public void testBundleClassLoader()
+ {
+ assertNotNull(bundleClassLoader);
+ }
+
+}