aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-07-19 19:11:05 -0400
committerJeff Johnston2018-07-20 10:35:25 -0400
commitd6937aadcf2b606bbab6bfde87e519816833348d (patch)
tree3bb892babbd26f26a7c310d9a2e4116e9a6e1696
parent5702e46f75c7a24ccbce93c6eaa319ee14256ec3 (diff)
downloadorg.eclipse.linuxtools-d6937aadcf2b606bbab6bfde87e519816833348d.tar.gz
org.eclipse.linuxtools-d6937aadcf2b606bbab6bfde87e519816833348d.tar.xz
org.eclipse.linuxtools-d6937aadcf2b606bbab6bfde87e519816833348d.zip
Bug 537207 - ClassCastException in GNUHyperlinkDetector.detectHyperlinks
- use IResource.getAdapter() to get an IFile for the specified documentLocation in case we are dealing with IFolder Change-Id: I76d7e2321ad01442e74e909757ea1c358d5bf578 Reviewed-on: https://git.eclipse.org/r/126349 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/GNUHyperlinkDetector.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/GNUHyperlinkDetector.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/GNUHyperlinkDetector.java
index 8b3602fc4b..b032078a9a 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/GNUHyperlinkDetector.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/internal/changelog/core/editors/GNUHyperlinkDetector.java
@@ -17,6 +17,7 @@ import org.eclipse.core.filebuffers.FileBuffers;
import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
@@ -111,7 +112,8 @@ public class GNUHyperlinkDetector extends AbstractHyperlinkDetector {
line = line.replaceAll("\\\\(.)", "$1");
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile fileLoc = (IFile) root.findMember(documentLocation.append(line));
+ IResource resource = root.findMember(documentLocation.append(line));
+ IFile fileLoc = resource.getAdapter(IFile.class);
if (fileLoc != null && fileLoc.exists()) {
return new IHyperlink[] { new FileHyperlink(pathRegion, fileLoc) };
}