diff options
author | Simeon Andreev | 2021-01-29 16:04:31 +0000 |
---|---|---|
committer | Simeon Andreev | 2021-02-02 07:31:49 +0000 |
commit | 111fc40f48c31ff5be08d21b9eb65214ff438c88 (patch) | |
tree | e06363f1a0905a990367de24e3d6e5feaceca96e | |
parent | cc401afe56eae7ed2297beb4e383fded9beb3113 (diff) | |
download | rt.equinox.framework-111fc40f48c31ff5be08d21b9eb65214ff438c88.tar.gz rt.equinox.framework-111fc40f48c31ff5be08d21b9eb65214ff438c88.tar.xz rt.equinox.framework-111fc40f48c31ff5be08d21b9eb65214ff438c88.zip |
Bug 570757 - Throw specific exception type if config area cannot be readY20210202-1200
This change uses a more specific runtime exception
(IllegalStateException), if EquinoxContainer fails to initialize its
storage due to any Exception. Also the exception message is changed to
be more specific.
Previously a RuntimeException would be thrown on IOException or
BundleException, during storage initialization. This is unfortunately
not enough to cover all cases of corrupted/broken config area, as e.g. a
buffer with invalid size will result in an IllegalArgumentException.
The new exception type and message can be used to more easily identify
OSGI container initialization problems.
Change-Id: I1e6d0910550f1527b0affada0de897acbb1b8026
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
2 files changed, 4 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java index 42945b1ba..4ff05b3e2 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/hooks/framework/StorageHookTests.java @@ -126,8 +126,8 @@ public class StorageHookTests extends AbstractFrameworkHookTests { try { restartFramework(); fail("Framework restart should have failed"); - } catch (IllegalStateException e) { - assertThrowable(e); + } catch (RuntimeException e) { + assertThrowable(e.getCause()); } assertCreateStorageHookCalled(); } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java index b77577cb6..0f7beb764 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxContainer.java @@ -106,8 +106,8 @@ public class EquinoxContainer implements ThreadFactory, Runnable { this.equinoxConfig.getHookRegistry().initialize(); try { this.storage = Storage.createStorage(this); - } catch (IOException | BundleException e) { - throw new RuntimeException("Error initializing storage.", e); //$NON-NLS-1$ + } catch (Exception e) { + throw new IllegalStateException("Error initializing storage for Equinox container.", e); //$NON-NLS-1$ } this.eventPublisher = new EquinoxEventPublisher(this); |