Author: pauls
Date: Tue Jan 28 17:20:56 2020
New Revision: 1873264

URL: http://svn.apache.org/viewvc?rev=1873264&view=rev
Log:
Fix jpms ee

Modified:
    
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/Felix.java
    
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
    
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/util/Util.java

Modified: 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/Felix.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/Felix.java?rev=1873264&r1=1873263&r2=1873264&view=diff
==============================================================================
--- 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/Felix.java 
(original)
+++ 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/Felix.java 
Tue Jan 28 17:20:56 2020
@@ -5156,6 +5156,7 @@ public class Felix extends BundleImpl im
                 }
                 catch (Throwable throwable)
                 {
+                    throwable.printStackTrace();
                     iter.remove();
                     fireFrameworkEvent(FrameworkEvent.ERROR, 
context.getBundle(),
                             new BundleException("Unable to start Bundle", 
throwable));

Modified: 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java?rev=1873264&r1=1873263&r2=1873264&view=diff
==============================================================================
--- 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
 (original)
+++ 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/capabilityset/CapabilitySet.java
 Tue Jan 28 17:20:56 2020
@@ -577,7 +577,7 @@ public class CapabilitySet
     {
         // If the LHS expects a string, then we can just return
         // the RHS since it is a string.
-        if (lhs.getClass() == rhsString.getClass())
+        if (lhs instanceof String)
         {
             return rhsString;
         }

Modified: 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/util/Util.java
URL: 
http://svn.apache.org/viewvc/felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/util/Util.java?rev=1873264&r1=1873263&r2=1873264&view=diff
==============================================================================
--- 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/util/Util.java
 (original)
+++ 
felix/sandbox/pauls/connect/src/main/java/org/apache/felix/framework/util/Util.java
 Tue Jan 28 17:20:56 2020
@@ -60,37 +60,42 @@ public class Util
 {
     /**
      * The default name used for the default configuration properties file.
-    **/
-    private static final String DEFAULT_PROPERTIES_FILE = "default.properties";
+     **/
+    private static final String DEFAULT_PROPERTIES_FILE = 
"/default.properties";
 
-    public static Properties loadDefaultProperties(Logger logger)
+    private static final Properties DEFAULTS;
+
+    private static final IOException DEFAULT_EX;
+
+    static
+    {
+        Properties defaults = null;
+        IOException defaultEX = null;
+        try
+        {
+            defaults = loadDefaultProperties();
+        } catch (IOException ex) {
+            defaultEX = ex;
+        }
+        DEFAULTS = defaults;
+        DEFAULT_EX = defaultEX;
+    }
+
+    public static Properties loadDefaultProperties(Logger logger) {
+        if (DEFAULTS.isEmpty()) {
+            logger.log(Logger.LOG_ERROR, "Unable to load any configuration 
properties.", DEFAULT_EX);
+        }
+        return DEFAULTS;
+    }
+
+    private static Properties loadDefaultProperties() throws IOException
     {
         Properties defaultProperties = new Properties();
-        URL propURL = 
Util.class.getClassLoader().getResource(DEFAULT_PROPERTIES_FILE);
+        URL propURL = Util.class.getResource(DEFAULT_PROPERTIES_FILE);
         if (propURL != null)
         {
-            InputStream is = null;
-            try
-            {
-                // Load properties from URL.
-                is = propURL.openConnection().getInputStream();
+            try (InputStream is = propURL.openConnection().getInputStream()) {
                 defaultProperties.load(is);
-                is.close();
-            }
-            catch (Exception ex)
-            {
-                // Try to close input stream if we have one.
-                try
-                {
-                    if (is != null) is.close();
-                }
-                catch (IOException ex2)
-                {
-                    // Nothing we can do.
-                }
-
-                logger.log(
-                    Logger.LOG_ERROR, "Unable to load any configuration 
properties.", ex);
             }
         }
         return defaultProperties;
@@ -138,6 +143,8 @@ public class Util
                 properties.put("ee-jpms", ee.toString());
 
                 properties.put("eecap-jpms", eecap.toString());
+
+                properties.put("felix.detect.jpms", "jpms");
             }
 
             properties.put("felix.detect.java.specification.version", 
version.getMajor() < 9 ? ("1." + (version.getMinor() > 6 ? version.getMinor() : 
6)) : Integer.toString(version.getMajor()));
@@ -206,7 +213,6 @@ public class Util
                 }
             }
 
-            properties.put("felix.detect.jpms", "jpms");
             String modulesString = "";
             for (String module : modules) {
                 modulesString += "${" + module + "}";
@@ -215,8 +221,10 @@ public class Util
         }
         catch (Exception ex)
         {
+            ex.printStackTrace();
             // Not much we can do - probably not on java9
         }
+
         return exports;
     }
 


Reply via email to