From 02cd079aa763d619b5aac5a2ec496454162d11ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Fri, 8 Mar 2024 10:07:04 +0100 Subject: [PATCH] ExceptionOccurrencesFinder: fix IndexOutOfBoundsException #1241 when @throws in javadoc doesn't have anything after it. https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1241 --- .../core/manipulation/search/ExceptionOccurrencesFinder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/search/ExceptionOccurrencesFinder.java b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/search/ExceptionOccurrencesFinder.java index c190689c8d7..d2057ed9748 100644 --- a/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/search/ExceptionOccurrencesFinder.java +++ b/org.eclipse.jdt.core.manipulation/core extension/org/eclipse/jdt/internal/core/manipulation/search/ExceptionOccurrencesFinder.java @@ -285,7 +285,7 @@ public boolean visit(MethodDeclaration node) { for (TagElement tag : tags) { String tagName= tag.getTagName(); if (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName)) { - ASTNode name= (ASTNode) tag.fragments().get(0); + ASTNode name= tag.fragments().isEmpty() ? null : (ASTNode) tag.fragments().get(0); if (name instanceof Name) { if (name != fSelectedNode && Bindings.equals(fException, ((Name) name).resolveBinding())) { fResult.add(new OccurrenceLocation(name.getStartPosition(), name.getLength(), 0, fDescription));