From 6c521892058b8e403893d697280c5ff1ae9c6e89 Mon Sep 17 00:00:00 2001 From: Chris Goldthorpe Date: Wed, 20 Jan 2010 17:34:04 +0000 Subject: Bug 300189 – Line:Column information missing for errors logged due SAX parse exception when reading TOC --- .../src/org/eclipse/help/internal/toc/TocFileProvider.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'org.eclipse.help') diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java index b4e13feca..c74e9540e 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 2010 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 @@ -21,6 +21,7 @@ import org.eclipse.help.AbstractTocProvider; import org.eclipse.help.ITocContribution; import org.eclipse.help.internal.HelpPlugin; import org.eclipse.help.internal.util.ResourceLocator; +import org.xml.sax.SAXParseException; /* * Provides toc data from toc XML files to the help system. @@ -47,10 +48,17 @@ public class TocFileProvider extends AbstractTocProvider { contributions.add(toc); } catch (Throwable t) { + String locationInfo = ""; //$NON-NLS-1$ + if (t instanceof SAXParseException) { + SAXParseException spe = (SAXParseException) t; + locationInfo = " at line " + spe.getLineNumber() //$NON-NLS-1$ + + ", column " + spe.getColumnNumber(); //$NON-NLS-1$ + } String pluginId = tocFiles[i].getPluginId(); String file = tocFiles[i].getFile(); String msg = "Error reading help table of contents file /\"" //$NON-NLS-1$ + ResourceLocator.getErrorPath(pluginId, file, locale) + + locationInfo + "\" (skipping file)"; //$NON-NLS-1$ HelpPlugin.logError(msg, t); } -- cgit v1.2.3