diff options
author | Andrew Niefer | 2010-03-10 18:37:02 +0000 |
---|---|---|
committer | Andrew Niefer | 2010-03-10 18:37:02 +0000 |
commit | 48b26a44bc0e83ca5e21a1eae934ffda869a4e4e (patch) | |
tree | 559d962c0758d602754478f633f3a409ee796826 /bundles/org.eclipse.equinox.simpleconfigurator.manipulator | |
parent | f4de9c6ba47cb2a9a00403f8fa3568c9bb9bf1c1 (diff) | |
download | rt.equinox.p2-48b26a44bc0e83ca5e21a1eae934ffda869a4e4e.tar.gz rt.equinox.p2-48b26a44bc0e83ca5e21a1eae934ffda869a4e4e.tar.xz rt.equinox.p2-48b26a44bc0e83ca5e21a1eae934ffda869a4e4e.zip |
bug 304816 - Exception when running with -configuration
Diffstat (limited to 'bundles/org.eclipse.equinox.simpleconfigurator.manipulator')
-rw-r--r-- | bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorImpl.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorImpl.java b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorImpl.java index 851c40330..a8d85ab79 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorImpl.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator.manipulator/src/org/eclipse/equinox/internal/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorImpl.java @@ -298,18 +298,39 @@ public class SimpleConfiguratorManipulatorImpl implements SimpleConfiguratorMani URI installArea = EquinoxUtils.getInstallLocationURI(context); URL configURL = null; + InputStream stream = null; + if (infoPath == null) { SimpleConfiguratorImpl simpleImpl = new SimpleConfiguratorImpl(context, null); configURL = simpleImpl.getConfigurationURL(); } else { - //if == SOURCE_INFO (not .equals) use the default source info, currently SOURCE_INFO_PATH - if (infoPath == SOURCE_INFO) + // == (not .equals) use the default source info, currently SOURCE_INFO_PATH + boolean defaultSource = (infoPath == SOURCE_INFO); + if (defaultSource) infoPath = SOURCE_INFO_PATH; + Location configLocation = EquinoxUtils.getConfigLocation(context); configURL = configLocation.getDataArea(infoPath); + try { + stream = configURL.openStream(); + } catch (FileNotFoundException e) { + if (defaultSource && configLocation.getParentLocation() != null) { + configURL = configLocation.getParentLocation().getDataArea(infoPath); + } else { + return new BundleInfo[0]; + } + } + } + if (stream == null) { + try { + stream = configURL.openStream(); + } catch (FileNotFoundException e) { + return new BundleInfo[0]; + } } - return loadConfiguration(configURL.openStream(), installArea); + //stream will be closed + return loadConfiguration(stream, installArea); } /* |