Bug 491556 - [Welcome] Provide theme-specific mechanism to influence path resolution
resolveVariable() previously returned null when resolving a product:
file that didn't exist, and the original value on an IOException.
Change-Id: Ic0039970a1c05fe22803c3c020f26319fa52e104
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
index 06bfddc..52b2f05 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/UniversalIntroConfigurer.java
@@ -181,33 +181,33 @@
if (value == null) {
return null;
}
- if (value.startsWith("intro:")) { //$NON-NLS-1$
- bundle = UniversalIntroPlugin.getDefault().getBundle();
- return resolveFile(bundle, value.substring(6));
- } else if (value.startsWith("product:")) { //$NON-NLS-1$
- return resolveFile(bundle, value.substring(8));
+ try {
+ if (value.startsWith("intro:")) { //$NON-NLS-1$
+ bundle = UniversalIntroPlugin.getDefault().getBundle();
+ return resolveFile(bundle, value.substring(6));
+ } else if (value.startsWith("product:")) { //$NON-NLS-1$
+ return resolveFile(bundle, value.substring(8));
+ }
+ } catch (IOException e) {
+ // just use the value as-is
}
return value;
}
- private String resolveFile(Bundle bundle, String path) {
+ private String resolveFile(Bundle bundle, String path) throws IOException {
String prefixedPath = getThemePrefixedPath(path);
- try {
- URL url = null;
- if (prefixedPath != null) {
- url = bundle.getEntry(prefixedPath);
- }
- if (url == null) {
- url = bundle.getEntry(path);
- }
- if (url != null) {
- URL localURL = FileLocator.toFileURL(url);
- return localURL.toString();
- }
- } catch (IOException e) {
+ URL url = null;
+ if (prefixedPath != null) {
+ url = bundle.getEntry(prefixedPath);
}
- // just use the value as-is
- return path;
+ if (url == null) {
+ url = bundle.getEntry(path);
+ }
+ if (url != null) {
+ URL localURL = FileLocator.toFileURL(url);
+ return localURL.toString();
+ }
+ return null;
}
/**