Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2009-07-28 23:18:35 +0000
committerChris Goldthorpe2009-07-28 23:18:35 +0000
commitf390704cc342c6f8a6f2e7eaf2bee8f4e6c10024 (patch)
tree42bd5812d197ef8a4e4727cf15f719aec7dd73b9 /org.eclipse.help
parent43464db055e7f85524fd3890b6987c884cb10c30 (diff)
downloadeclipse.platform.ua-f390704cc342c6f8a6f2e7eaf2bee8f4e6c10024.tar.gz
eclipse.platform.ua-f390704cc342c6f8a6f2e7eaf2bee8f4e6c10024.tar.xz
eclipse.platform.ua-f390704cc342c6f8a6f2e7eaf2bee8f4e6c10024.zip
Bug 284936 – [Help] Report which fragment contains a toc.xml file which does not parse.
Diffstat (limited to 'org.eclipse.help')
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java10
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/index/IndexFileProvider.java5
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/toc/TocFileProvider.java11
-rw-r--r--org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java21
4 files changed, 39 insertions, 8 deletions
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
index ce99cff94..e4378f6a9 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/context/ContextFileProvider.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
@@ -227,7 +227,7 @@ public class ContextFileProvider extends AbstractContextProvider {
return contexts;
}
else {
- String msg = "Required root element \"contexts\" missing from context-sensitive help file \"/" + descriptor.getBundleId() + '/' + descriptor.getFile() + "\" (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
+ String msg = "Required root element \"contexts\" missing from context-sensitive help file \"/" + getErrorPath(descriptor, locale) + "\" (skipping)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg);
}
}
@@ -236,12 +236,16 @@ public class ContextFileProvider extends AbstractContextProvider {
}
}
catch (Throwable t) {
- String msg = "Error reading context-sensitive help file /\"" + descriptor.getBundleId() + '/' + descriptor.getFile() + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
+ String msg = "Error reading context-sensitive help file /\"" + getErrorPath(descriptor, locale) + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
HelpPlugin.logError(msg, t);
}
return null;
}
+ private String getErrorPath(ContextFile descriptor, String locale) {
+ return ResourceLocator.getErrorPath(descriptor.getBundleId(), descriptor.getFile(), locale);
+ }
+
private Map getRequiredAttributes() {
if (requiredAttributes == null) {
requiredAttributes = new HashMap();
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 7e303c260..5ede14643 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
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.help.AbstractIndexProvider;
import org.eclipse.help.IIndexContribution;
import org.eclipse.help.internal.HelpPlugin;
+import org.eclipse.help.internal.util.ResourceLocator;
import org.xml.sax.SAXParseException;
/*
@@ -67,7 +68,9 @@ public class IndexFileProvider extends AbstractIndexProvider {
}
private String getIndexFilePath(IndexFile indexFile) {
- return indexFile.getPluginId() + '/' + indexFile.getFile();
+ String pluginId = indexFile.getPluginId();
+ String file = indexFile.getFile();
+ return ResourceLocator.getErrorPath(pluginId, file, indexFile.getLocale());
}
/*
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 165a35053..b05c6760d 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, 2008 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
@@ -20,6 +20,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.help.AbstractTocProvider;
import org.eclipse.help.ITocContribution;
import org.eclipse.help.internal.HelpPlugin;
+import org.eclipse.help.internal.util.ResourceLocator;
/*
* Provides toc data from toc XML files to the help system.
@@ -46,8 +47,12 @@ public class TocFileProvider extends AbstractTocProvider {
contributions.add(toc);
}
catch (Throwable t) {
- String msg = "Error reading help table of contents file /\"" + tocFiles[i].getPluginId() + '/' + tocFiles[i].getFile() + "\" (skipping file)"; //$NON-NLS-1$ //$NON-NLS-2$
- HelpPlugin.logError(msg, t);
+ 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)
+ + "\" (skipping file)"; //$NON-NLS-1$
+ HelpPlugin.logError(msg, t);
}
}
return (ITocContribution[])contributions.toArray(new ITocContribution[contributions.size()]);
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java b/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
index 52506d776..1dbc7fd13 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/util/ResourceLocator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -467,4 +467,23 @@ public class ResourceLocator {
}
}
}
+
+ /**
+ * Create a path for use in error messages that will identify the plugin and
+ * file name as well as a resolved path (if available) which will give
+ * information about which fragment the file was located in
+ * @return pluginId/file followed by a resolved path if the file exists
+ */
+ public static String getErrorPath(String pluginId, String file, String locale) {
+ String resolvedPath = pluginId + '/' + file;
+ try {
+ ArrayList pathPrefix = ResourceLocator.getPathPrefix(locale);
+ Bundle bundle = Platform.getBundle(pluginId);
+ URL rawURL = ResourceLocator.find(bundle, new Path(file), pathPrefix);
+ URL resolvedURL = FileLocator.resolve(rawURL);
+ resolvedPath += ", URL = " + resolvedURL.toExternalForm(); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+ return resolvedPath;
+ }
}

Back to the top