diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java index 97677d07e8b..c8a56f6f957 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2022 IBM Corporation and others. + * Copyright (c) 2000, 2023 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -223,7 +223,10 @@ public IStatus processFile(List sameFiles, IProgressMonitor monitor) { } occurences = locateMatches(file, charsequence, matcher, monitor); } catch (FileCharSequenceProvider.FileCharSequenceException e) { - throw (RuntimeException) e.getCause(); + if (e.getCause() instanceof RuntimeException runtimeEx) { + throw runtimeEx; + } + throw e; } } fCollector.flushMatches(file);