You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2009/06/21 17:29:10 UTC

svn commit: r787036 - in /felix/branches: org.apache.felix.framework-1.8.1-RC/ org.apache.felix.framework-1.8.1-RC/doc/ org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/ org.apache.felix.framework-1.8.1-RC/src/main/java/org/...

Author: pauls
Date: Sun Jun 21 15:29:09 2009
New Revision: 787036

URL: http://svn.apache.org/viewvc?rev=787036&view=rev
Log:
Prepare 1.8.1

Modified:
    felix/branches/org.apache.felix.framework-1.8.1-RC/doc/changelog.txt
    felix/branches/org.apache.felix.framework-1.8.1-RC/pom.xml
    felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/Felix.java
    felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java
    felix/branches/org.apache.felix.main-1.8.1-RC/doc/changelog.txt
    felix/branches/org.apache.felix.main-1.8.1-RC/pom.xml

Modified: felix/branches/org.apache.felix.framework-1.8.1-RC/doc/changelog.txt
URL: http://svn.apache.org/viewvc/felix/branches/org.apache.felix.framework-1.8.1-RC/doc/changelog.txt?rev=787036&r1=787035&r2=787036&view=diff
==============================================================================
--- felix/branches/org.apache.felix.framework-1.8.1-RC/doc/changelog.txt (original)
+++ felix/branches/org.apache.felix.framework-1.8.1-RC/doc/changelog.txt Sun Jun 21 15:29:09 2009
@@ -1,3 +1,11 @@
+Changes from 1.8.0 to 1.8.1
+---------------------------
+** Bug
+    * [FELIX-1154] - Module class loader must be created in privileged block
+    * [FELIX-1190] - Set parent classloader of bundle classloader to be same as what is actually used for delegation
+    * [FELIX-1233] - Bundle class loader should delegate using Class.forName(String, boolean, ClassLoader) to support array types
+    * [FELIX-1237] - STOPPING & STOPPED events not fired when activator throws exception
+
 Changes form 1.6.1 to 1.8.0
 ---------------------------
 ** Bug

Modified: felix/branches/org.apache.felix.framework-1.8.1-RC/pom.xml
URL: http://svn.apache.org/viewvc/felix/branches/org.apache.felix.framework-1.8.1-RC/pom.xml?rev=787036&r1=787035&r2=787036&view=diff
==============================================================================
--- felix/branches/org.apache.felix.framework-1.8.1-RC/pom.xml (original)
+++ felix/branches/org.apache.felix.framework-1.8.1-RC/pom.xml Sun Jun 21 15:29:09 2009
@@ -27,7 +27,7 @@
   <packaging>bundle</packaging>
   <name>Apache Felix Framework</name>
   <artifactId>org.apache.felix.framework</artifactId>
-  <version>1.8.0</version>
+  <version>1.8.1-SNAPSHOT</version>
   <dependencies>
     <dependency>
       <groupId>${pom.groupId}</groupId>

Modified: felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/Felix.java?rev=787036&r1=787035&r2=787036&view=diff
==============================================================================
--- felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/Felix.java Sun Jun 21 15:29:09 2009
@@ -1384,6 +1384,8 @@
                     + " cannot be started, since it is either starting or stopping.");
             }
         }
+
+        BundleException rethrow = null;
         try
         {
             // The spec doesn't say whether it is possible to start an extension
@@ -1439,16 +1441,17 @@
                     resolveBundle(bundle);
                     // No break.
                 case Bundle.RESOLVED:
+                    // Set the bundle's context.
+                    bundle.setBundleContext(new BundleContextImpl(m_logger, this, bundle));
+                    // Change bundle state and notify any waiting threads.
                     setBundleStateAndNotify(bundle, Bundle.STARTING);
+                    // Fire STARTING event with valid bundle context.
                     fireBundleEvent(BundleEvent.STARTING, bundle);
                     break;
             }
 
             try
             {
-                // Set the bundle's context.
-                bundle.setBundleContext(new BundleContextImpl(m_logger, this, bundle));
-
                 // Set the bundle's activator.
                 bundle.setActivator(createBundleActivator(bundle));
 
@@ -1466,6 +1469,9 @@
             }
             catch (Throwable th)
             {
+                // Spec says we must fire STOPPING event.
+                fireBundleEvent(BundleEvent.STOPPING, bundle);
+
                 // If there was an error starting the bundle,
                 // then reset its state to RESOLVED.
                 setBundleStateAndNotify(bundle, Bundle.RESOLVED);
@@ -1503,7 +1509,7 @@
                 }
 
                 // Rethrow all other exceptions as a BundleException.
-                throw new BundleException("Activator start error in bundle " + bundle + ".", th);
+                rethrow = new BundleException("Activator start error in bundle " + bundle + ".", th);
             }
         }
         finally
@@ -1513,8 +1519,16 @@
         }
 
         // If there was no exception, then we should fire the STARTED event
-        // here without holding the lock.
-        fireBundleEvent(BundleEvent.STARTED, bundle);
+        // here without holding the lock, otherwise fire STOPPED and rethrow.
+        if (rethrow == null)
+        {
+            fireBundleEvent(BundleEvent.STARTED, bundle);
+        }
+        else
+        {
+            fireBundleEvent(BundleEvent.STOPPED, bundle);
+            throw rethrow;
+        }
     }
 
     void updateBundle(BundleImpl bundle, InputStream is)
@@ -4413,4 +4427,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java
URL: http://svn.apache.org/viewvc/felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java?rev=787036&r1=787035&r2=787036&view=diff
==============================================================================
--- felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java (original)
+++ felix/branches/org.apache.felix.framework-1.8.1-RC/src/main/java/org/apache/felix/framework/searchpolicy/ModuleImpl.java Sun Jun 21 15:29:09 2009
@@ -27,6 +27,8 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLStreamHandler;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.security.SecureClassLoader;
 import java.util.ArrayList;
@@ -478,6 +480,13 @@
 
     public Class getClassByDelegation(String name) throws ClassNotFoundException
     {
+        // We do not call getClassLoader().loadClass() for arrays because
+        // it does not correctly handle array types, which is necessary in
+        // cases like deserialization using a wrapper class loader.
+        if (name.charAt(0) == '[')
+        {
+            return Class.forName(name, false, getClassLoader());
+        }
         return getClassLoader().loadClass(name);
     }
 
@@ -1165,8 +1174,21 @@
     {
         if (m_classLoader == null)
         {
-// TODO: REFACTOR - SecureAction fix needed.
-              m_classLoader = new ModuleClassLoader();
+            if (System.getSecurityManager() != null)
+            {
+                m_classLoader = (ModuleClassLoader)
+                    AccessController.doPrivileged(new PrivilegedAction() {
+                        public Object run()
+                        {
+                            return new ModuleClassLoader();
+                        }
+                    });
+            }
+            else
+            {
+                m_classLoader = new ModuleClassLoader();
+            }
+// TODO: SECURITY - Would be nice if this could use SecureAction again.
 //            m_classLoader = m_secureAction.createModuleClassLoader(
 //                this, m_protectionDomain);
         }
@@ -1413,6 +1435,7 @@
 
         public ModuleClassLoader()
         {
+            super(ModuleImpl.this.getClass().getClassLoader());
             if (m_dexFileClassConstructor != null)
             {
                 m_jarContentToDexFile = new HashMap();

Modified: felix/branches/org.apache.felix.main-1.8.1-RC/doc/changelog.txt
URL: http://svn.apache.org/viewvc/felix/branches/org.apache.felix.main-1.8.1-RC/doc/changelog.txt?rev=787036&r1=787035&r2=787036&view=diff
==============================================================================
--- felix/branches/org.apache.felix.main-1.8.1-RC/doc/changelog.txt (original)
+++ felix/branches/org.apache.felix.main-1.8.1-RC/doc/changelog.txt Sun Jun 21 15:29:09 2009
@@ -1,3 +1,9 @@
+Changes form 1.8.0 to 1.8.1
+---------------------------
+
+** Improvement
+    * Update to latest framework version 1.8.1
+
 Changes form 1.6.1 to 1.8.0
 ---------------------------
 

Modified: felix/branches/org.apache.felix.main-1.8.1-RC/pom.xml
URL: http://svn.apache.org/viewvc/felix/branches/org.apache.felix.main-1.8.1-RC/pom.xml?rev=787036&r1=787035&r2=787036&view=diff
==============================================================================
--- felix/branches/org.apache.felix.main-1.8.1-RC/pom.xml (original)
+++ felix/branches/org.apache.felix.main-1.8.1-RC/pom.xml Sun Jun 21 15:29:09 2009
@@ -27,12 +27,12 @@
   <packaging>bundle</packaging>
   <name>Apache Felix Main</name>
   <artifactId>org.apache.felix.main</artifactId>
-  <version>1.8.0</version>
+  <version>1.8.1-SNAPSHOT</version>
   <dependencies>
     <dependency>
       <groupId>${pom.groupId}</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>1.8.0</version>
+      <version>1.8.1</version>
       <exclusions>
         <exclusion>
           <groupId>${pom.groupId}</groupId>
@@ -157,7 +157,7 @@
                 <artifactItem>
                   <groupId>${pom.groupId}</groupId>
                   <artifactId>org.apache.felix.framework</artifactId>
-                  <version>1.8.0</version>
+                  <version>1.8.1</version>
                 </artifactItem>
               </artifactItems>
             </configuration>