Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2010-02-24 21:30:17 +0000
committerChris Goldthorpe2010-02-24 21:30:17 +0000
commit1195df1a37cd9f1e49afbf9dd3299497a42d1d33 (patch)
tree536a0460d97cf93aa4ed66dcbc27b99667486640 /org.eclipse.help
parent2c37fe4c124c978244c48aae823c7ae9d0bdcfea (diff)
downloadeclipse.platform.ua-1195df1a37cd9f1e49afbf9dd3299497a42d1d33.tar.gz
eclipse.platform.ua-1195df1a37cd9f1e49afbf9dd3299497a42d1d33.tar.xz
eclipse.platform.ua-1195df1a37cd9f1e49afbf9dd3299497a42d1d33.zip
Widen range of try/catch for index contributors
Diffstat (limited to 'org.eclipse.help')
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java43
1 files changed, 20 insertions, 23 deletions
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
index bede1a790..06d641be2 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Intel Corporation and others.
+ * Copyright (c) 2005, 2010 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -86,33 +86,30 @@ public class IndexManager {
IIndexContribution[] contrib;
try {
contrib = providers[i].getIndexContributions(locale);
- }
- catch (Throwable t) {
+ // check for nulls and root element
+ for (int j = 0; j < contrib.length; ++j) {
+ if (contrib[j] == null) {
+ String msg = "Help keyword index provider \"" + providers[i].getClass().getName() + "\" returned a null contribution (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ HelpPlugin.logError(msg);
+ } else if (contrib[j].getIndex() == null) {
+ String msg = "Help keyword index provider \"" + providers[i].getClass().getName() + "\" returned a contribution with a null root element (expected a \"" + Index.NAME + "\" element; skipping)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ HelpPlugin.logError(msg);
+ } else {
+ IndexContribution contribution = new IndexContribution();
+ contribution.setId(contrib[j].getId());
+ contribution.setLocale(contrib[j].getLocale());
+ IIndex index = contrib[j].getIndex();
+ contribution.setIndex(index instanceof Index ? (Index) index
+ : (Index) UAElementFactory.newElement(index));
+ contributions.add(contribution);
+ }
+ }
+ } catch (Throwable t) {
// log, and skip the offending provider
String msg = "Error getting help keyword index data from provider: " + providers[i].getClass().getName() + " (skipping provider)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
continue;
}
-
- // check for nulls and root element
- for (int j=0;j<contrib.length;++j) {
- if (contrib[j] == null) {
- String msg = "Help keyword index provider \"" + providers[i].getClass().getName() + "\" returned a null contribution (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg);
- }
- else if (contrib[j].getIndex() == null) {
- String msg = "Help keyword index provider \"" + providers[i].getClass().getName() + "\" returned a contribution with a null root element (expected a \"" + Index.NAME + "\" element; skipping)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- HelpPlugin.logError(msg);
- }
- else {
- IndexContribution contribution = new IndexContribution();
- contribution.setId(contrib[j].getId());
- contribution.setLocale(contrib[j].getLocale());
- IIndex index = contrib[j].getIndex();
- contribution.setIndex(index instanceof Index ? (Index)index : (Index)UAElementFactory.newElement(index));
- contributions.add(contribution);
- }
- }
}
cached = (IndexContribution[])contributions.toArray(new IndexContribution[contributions.size()]);
return cached;

Back to the top