diff options
author | Chris Goldthorpe | 2009-04-27 18:30:24 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2009-04-27 18:30:24 +0000 |
commit | 2f68b62d6b12521206e13d16c52cd7cc1e1b4ae0 (patch) | |
tree | 9cb50c235c98da16aabd4c41d8651154eb409b06 /org.eclipse.help | |
parent | 65c14ab678849c79d3be7179de04c29cb2336417 (diff) | |
download | eclipse.platform.ua-2f68b62d6b12521206e13d16c52cd7cc1e1b4ae0.tar.gz eclipse.platform.ua-2f68b62d6b12521206e13d16c52cd7cc1e1b4ae0.tar.xz eclipse.platform.ua-2f68b62d6b12521206e13d16c52cd7cc1e1b4ae0.zip |
Bug 140736 [Help] Need much more information provided in log file to help customer to do troubleshooting:v20090427_1800
Diffstat (limited to 'org.eclipse.help')
-rw-r--r-- | org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java index d59e0e590..7e303c260 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2009 IBM 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 @@ -19,12 +19,14 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.help.AbstractIndexProvider; import org.eclipse.help.IIndexContribution; import org.eclipse.help.internal.HelpPlugin; +import org.xml.sax.SAXParseException; /* * Provides index data from index XML files to the help system. */ public class IndexFileProvider extends AbstractIndexProvider { + private static final String ERROR_READING_HELP_KEYWORD_INDEX_FILE = "Error reading help keyword index file /\""; //$NON-NLS-1$ public static final String EXTENSION_POINT_ID_INDEX = HelpPlugin.PLUGIN_ID + ".index"; //$NON-NLS-1$ public static final String ELEMENT_NAME_INDEX = "index"; //$NON-NLS-1$ public static final String ATTRIBUTE_NAME_FILE = "file"; //$NON-NLS-1$ @@ -37,18 +39,37 @@ public class IndexFileProvider extends AbstractIndexProvider { IndexFile[] indexFiles = getIndexFiles(locale); IndexFileParser parser = new IndexFileParser(); for (int i=0;i<indexFiles.length;++i) { + IndexFile indexFile = indexFiles[i]; try { - IIndexContribution toc = parser.parse(indexFiles[i]); + IIndexContribution toc = parser.parse(indexFile); contributions.add(toc); - } + } catch (SAXParseException spe) { + StringBuffer buffer = new StringBuffer(ERROR_READING_HELP_KEYWORD_INDEX_FILE); + buffer.append(getIndexFilePath(indexFile)); + buffer.append("\" at line "); //$NON-NLS-1$ + buffer.append(spe.getLineNumber()); + buffer.append(". "); //$NON-NLS-1$ + buffer.append(spe.getMessage()); + + // Use the contained exception. + Exception x = spe; + if (spe.getException() != null) + x = spe.getException(); + HelpPlugin.logError(buffer.toString(), x); + + } catch (Throwable t) { - String msg = "Error reading help keyword index file /\"" + indexFiles[i].getPluginId() + '/' + indexFiles[i].getFile() + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$ + String msg = ERROR_READING_HELP_KEYWORD_INDEX_FILE + getIndexFilePath(indexFile) + "\" (skipping file)"; //$NON-NLS-1$ HelpPlugin.logError(msg, t); } } return (IIndexContribution[])contributions.toArray(new IIndexContribution[contributions.size()]); } + private String getIndexFilePath(IndexFile indexFile) { + return indexFile.getPluginId() + '/' + indexFile.getFile(); + } + /* * Returns all available IndexFiles for the given locale. */ |