You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2020/03/20 15:30:15 UTC

[felix-atomos] 02/02: Handle the persistence issues when changing to Java 8

This is an automated email from the ASF dual-hosted git repository.

tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git

commit 83ad9a621c412ac3888cacf6b79a239a2ed122a0
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Fri Mar 20 10:18:59 2020 -0500

    Handle the persistence issues when changing to Java 8
    
    When running with Java 11 or higher with the module path
    the persistence for Atomos will contain at least 2 layers,
    the empty and the boot layer. This causes issues if you the
    launch the persistent configuration using Java 8 because
    Atomos will only allow a single layer to exist in
    that case.
    
    This handles that case by printing a message and
    continuing on as if there was no persistence
---
 .../org/apache/felix/atomos/impl/runtime/base/AtomosStorage.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosStorage.java b/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosStorage.java
index e59415b..a27cd82 100644
--- a/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosStorage.java
+++ b/atomos.runtime/src/main/java/org/apache/felix/atomos/impl/runtime/base/AtomosStorage.java
@@ -64,6 +64,12 @@ public class AtomosStorage
             }
             long nextLayerId = in.readLong();
             int numLayers = in.readInt();
+            if (numLayers > 1 && !atomosRuntime.getBootLayer().isAddLayerSupported())
+            {
+                System.out.println(
+                    "Atomos persistent layers are ignored because Atomos is not loaded as a module.");
+                return;
+            }
             for (int i = 0; i < numLayers; i++)
             {
                 readLayer(in);