Skip to content

Commit

Permalink
Fix ClassCastException in TextSearchVisitor.TextSearchJob (eclipse-pl…
Browse files Browse the repository at this point in the history
…atform#171)

* Fix ClassCastException in TextSearchVisitor.TextSearchJob

- TextSearchVisitor.TextSearchJob.processFile() has a catch
  for FileCharSequenceProvider.FileCharSequenceException and
  tries to rethrow the exception cause.  In the case, where the
  cause is an IOException, throw the original FileCharSequenceException
  which is RuntimeException
- discovered by eclipse-jdt/eclipse.jdt.ui#436

* Update org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java

Use Java 17

Co-authored-by: Mickael Istria <[email protected]>

---------

Co-authored-by: Mickael Istria <[email protected]>
  • Loading branch information
jjohnstn and mickaelistria authored Mar 30, 2023
1 parent 10d3dfa commit 6d1d9b5
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -223,7 +223,10 @@ public IStatus processFile(List<IFile> 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);
Expand Down

0 comments on commit 6d1d9b5

Please sign in to comment.