Author: pauls
Date: Fri Feb 21 21:43:08 2020
New Revision: 1874341

URL: http://svn.apache.org/viewvc?rev=1874341&view=rev
Log:
Make sure to call the connector again on update to see if there still is a 
module.

Modified:
    
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/cache/BundleArchive.java

Modified: 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/cache/BundleArchive.java?rev=1874341&r1=1874340&r2=1874341&view=diff
==============================================================================
--- 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
 (original)
+++ 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
 Fri Feb 21 21:43:08 2020
@@ -104,7 +104,7 @@ public class BundleArchive
     **/
     private long m_refreshCount = -1;
 
-    private final ConnectModule m_module;
+    private final ModuleConnector m_connector;
 
     // Maps a Long revision number to a BundleRevision.
     private final SortedMap<Long, BundleArchiveRevision> m_revisions
@@ -148,16 +148,7 @@ public class BundleArchive
         m_lastModified = System.currentTimeMillis();
         m_refreshCount = 0;
 
-        m_module = Optional.ofNullable(connectFactory).flatMap(factory -> {
-            try
-            {
-                return connectFactory.connect(m_originalLocation);
-            }
-            catch (BundleException e)
-            {
-                throw new IllegalStateException(e);
-            }
-        }).orElse(null);
+        m_connector = connectFactory;
 
         // Save state.
         initialize();
@@ -230,16 +221,8 @@ public class BundleArchive
         m_revisions.remove(currentRevNum);
 
         String location = getRevisionLocation(currentRevNum);
-        m_module = Optional.ofNullable(connectFactory).flatMap(factory -> {
-            try
-            {
-                return connectFactory.connect(location);
-            }
-            catch (BundleException e)
-            {
-                throw new IllegalStateException(e);
-            }
-        }).orElse(null);
+
+        m_connector = connectFactory;
 
         // Add the revision object for the most recent revision.
         reviseInternal(true, currentRevNum, location, null);
@@ -823,15 +806,21 @@ public class BundleArchive
                 result = new JarRevision(m_logger, m_configMap,
                     m_zipFactory, revisionRootDir, location, false, is);
             }
-            else if (m_module != null)
-            {
-                result = new ConnectRevision(m_logger, m_configMap, 
m_zipFactory, revisionRootDir, location, m_module);
-            }
             else
             {
-                // Anything else is assumed to be a URL to a JAR file.
-                result = new JarRevision(m_logger, m_configMap,
-                    m_zipFactory, revisionRootDir, location, false, null);
+                ConnectModule module = m_connector != null ?
+                    m_connector.connect(location).orElse(null) : null;
+
+                if (module != null)
+                {
+                    result = new ConnectRevision(m_logger, m_configMap, 
m_zipFactory, revisionRootDir, location, module);
+                }
+                else
+                {
+                    // Anything else is assumed to be a URL to a JAR file.
+                    result = new JarRevision(m_logger, m_configMap,
+                        m_zipFactory, revisionRootDir, location, false, null);
+                }
             }
         }
         catch (Exception ex)


Reply via email to