From 7dd7436c3a52dddf8e7c1f05ce8fcd2251f966b7 Mon Sep 17 00:00:00 2001 From: Amartya Parijat Date: Mon, 4 Dec 2023 14:50:26 +0100 Subject: [PATCH] Wrapped the OperationCanceledException in InterruptedException --- .../ui/refactoring/reorg/RenameTypeWizardInputPage.java | 4 +++- .../jdt/ui/wizards/JavaCapabilityConfigurationPage.java | 4 +++- .../org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPage.java | 4 +++- .../eclipse/jdt/ui/wizards/NewJavaProjectWizardPageTwo.java | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameTypeWizardInputPage.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameTypeWizardInputPage.java index d233cca182a..edb88d7c7d0 100644 --- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameTypeWizardInputPage.java +++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameTypeWizardInputPage.java @@ -166,7 +166,9 @@ public IWizardPage getNextPage() { try { renameTypeProcessor.initializeReferences(pm); } catch (OperationCanceledException e1) { - throw new InterruptedException(); + InterruptedException interruptedException = new InterruptedException(e1.getLocalizedMessage()); + interruptedException.initCause(e1); + throw interruptedException; } catch (CoreException e2) { ExceptionHandler.handle(e2, RefactoringMessages.RenameTypeWizard_defaultPageTitle, RefactoringMessages.RenameTypeWizard_unexpected_exception); diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapabilityConfigurationPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapabilityConfigurationPage.java index 31c14b1540d..78804f85789 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapabilityConfigurationPage.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapabilityConfigurationPage.java @@ -282,7 +282,9 @@ public void configureJavaProject(String newProjectCompliance, IProgressMonitor m BuildPathsBlock.addJavaNature(project, new SubProgressMonitor(monitor, 1)); getBuildPathsBlock().configureJavaProject(newProjectCompliance, new SubProgressMonitor(monitor, 5)); } catch (OperationCanceledException e) { - throw new InterruptedException(); + InterruptedException interruptedException = new InterruptedException(e.getLocalizedMessage()); + interruptedException.initCause(e); + throw interruptedException; } finally { monitor.done(); } diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPage.java index a103eedac88..7d3e6fcb827 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPage.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPage.java @@ -323,7 +323,9 @@ public IRunnableWithProgress getRunnable() { } catch (CoreException e1) { throw new InvocationTargetException(e1); } catch (OperationCanceledException e2) { - throw new InterruptedException(); + InterruptedException interruptedException = new InterruptedException(e2.getLocalizedMessage()); + interruptedException.initCause(e2); + throw interruptedException; } finally { monitor.done(); } diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageTwo.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageTwo.java index 8b030b13619..0fbb97609cc 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageTwo.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageTwo.java @@ -164,7 +164,9 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte } catch (CoreException e) { throw new InvocationTargetException(e); } catch (OperationCanceledException e) { - throw new InterruptedException(); + InterruptedException interruptedException = new InterruptedException(e.getLocalizedMessage()); + interruptedException.initCause(e); + throw interruptedException; } finally { monitor.done(); }