From 695d8656c5c6452b20d9d5a33ebb8f3d2f71c176 Mon Sep 17 00:00:00 2001
From: Andrey Turbanov <aturbanov@openjdk.org>
Date: Mon, 20 Jun 2022 09:02:15 +0000
Subject: [PATCH] 8284672: Collapse identical catch branches in java.desktop

Reviewed-by: prr, aivanov, serb
---
 .../classes/com/apple/laf/AquaSpinnerUI.java  |  6 ++---
 .../laf/AquaTabbedPaneCopyFromBasicUI.java    | 10 +++-----
 .../sun/beans/decoder/DocumentHandler.java    |  7 ++----
 .../com/sun/beans/finder/ClassFinder.java     | 10 +++-----
 .../imageio/plugins/jpeg/JPEGImageReader.java | 12 +++------
 .../plugins/tiff/TIFFImageMetadata.java       |  9 ++-----
 .../sun/java/swing/plaf/gtk/GTKPainter.java   | 10 +++-----
 .../com/sun/java/swing/plaf/gtk/Metacity.java | 10 ++------
 .../media/sound/AudioFileSoundbankReader.java | 13 +++-------
 .../sun/media/sound/DLSSoundbankReader.java   |  6 ++---
 .../sun/media/sound/DirectAudioDevice.java    |  9 +++----
 .../sun/media/sound/JavaSoundAudioClip.java   |  8 +++---
 .../sun/media/sound/SF2SoundbankReader.java   |  6 ++---
 .../share/classes/java/awt/AWTKeyStroke.java  |  6 ++---
 .../java/awt/KeyboardFocusManager.java        |  8 +++---
 .../classes/javax/swing/JEditorPane.java      | 25 +++++--------------
 .../swing/plaf/basic/BasicPopupMenuUI.java    |  7 ++----
 .../swing/plaf/basic/BasicSpinnerUI.java      |  6 ++---
 .../javax/swing/plaf/basic/BasicTextUI.java   |  7 ++----
 .../javax/swing/plaf/basic/LazyActionMap.java | 13 +++-------
 .../javax/swing/plaf/synth/SynthParser.java   | 16 +++---------
 .../javax/swing/text/CompositeView.java       | 10 +++-----
 .../swing/text/InternationalFormatter.java    | 11 ++++----
 .../javax/swing/text/JTextComponent.java      |  5 ++--
 .../javax/swing/text/html/FrameView.java      |  7 ++----
 .../javax/swing/text/html/HTMLDocument.java   |  6 ++---
 .../javax/swing/text/html/HTMLEditorKit.java  |  8 +++---
 .../javax/swing/text/html/IsindexView.java    |  6 ++---
 .../sun/awt/image/InputStreamImageSource.java |  8 ++----
 .../classes/sun/awt/shell/ShellFolder.java    |  6 ++---
 .../share/classes/sun/font/TrueTypeFont.java  | 11 +++-----
 .../share/classes/sun/font/Type1Font.java     | 11 +++-----
 .../share/classes/sun/print/PSPrinterJob.java |  7 ++----
 .../classes/sun/print/PSStreamPrintJob.java   | 25 ++++++-------------
 .../swing/text/TextComponentPrintable.java    |  6 ++---
 .../awt/X11/MotifDnDDragSourceProtocol.java   |  9 +++----
 .../unix/classes/sun/awt/X11/XToolkit.java    |  4 +--
 .../classes/sun/awt/X11/XTrayIconPeer.java    |  5 ++--
 .../opengl/GLXVolatileSurfaceManager.java     |  6 ++---
 .../java2d/x11/X11VolatileSurfaceManager.java |  6 ++---
 .../java2d/xr/XRVolatileSurfaceManager.java   |  6 ++---
 .../unix/classes/sun/print/UnixPrintJob.java  | 23 ++++++-----------
 .../java2d/d3d/D3DVolatileSurfaceManager.java |  8 ++----
 .../opengl/WGLVolatileSurfaceManager.java     |  6 ++---
 .../classes/sun/print/Win32PrintJob.java      | 23 ++++++-----------
 45 files changed, 130 insertions(+), 297 deletions(-)

diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java
index bafcbd1b51c..cf23b8ca215 100644
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaSpinnerUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -439,9 +439,7 @@ public class AquaSpinnerUI extends SpinnerUI {
                         spinner.setValue(value);
                         select(spinner);
                     }
-                } catch (final IllegalArgumentException iae) {
-                    UIManager.getLookAndFeel().provideErrorFeedback(spinner);
-                } catch (final ParseException pe) {
+                } catch (IllegalArgumentException | ParseException ex) {
                     UIManager.getLookAndFeel().provideErrorFeedback(spinner);
                 }
             }
diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java
index 6c92b5bbf8a..89ac68b3c58 100644
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3808,12 +3808,8 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
                     method.invoke(klass, new Object[] { this });
                 } catch (final NoSuchMethodException nsme) {
                     assert false : "LazyActionMap unable to load actions " + klass;
-                } catch (final IllegalAccessException iae) {
-                    assert false : "LazyActionMap unable to load actions " + iae;
-                } catch (final InvocationTargetException ite) {
-                    assert false : "LazyActionMap unable to load actions " + ite;
-                } catch (final IllegalArgumentException iae) {
-                    assert false : "LazyActionMap unable to load actions " + iae;
+                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+                    assert false : "LazyActionMap unable to load actions " + e;
                 }
             }
         }
diff --git a/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java b/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
index 2e4fbe5b217..f06a8b0bcc7 100644
--- a/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
+++ b/src/java.desktop/share/classes/com/sun/beans/decoder/DocumentHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -378,7 +378,7 @@ public final class DocumentHandler extends DefaultHandler {
                 try {
                     SAXParserFactory.newInstance().newSAXParser().parse(input, DocumentHandler.this);
                 }
-                catch (ParserConfigurationException exception) {
+                catch (ParserConfigurationException | IOException exception) {
                     handleException(exception);
                 }
                 catch (SAXException wrapper) {
@@ -388,9 +388,6 @@ public final class DocumentHandler extends DefaultHandler {
                     }
                     handleException(exception);
                 }
-                catch (IOException exception) {
-                    handleException(exception);
-                }
                 return null;
             }
         }, stack, this.acc);
diff --git a/src/java.desktop/share/classes/com/sun/beans/finder/ClassFinder.java b/src/java.desktop/share/classes/com/sun/beans/finder/ClassFinder.java
index 9d53235a8da..616d6a5f55c 100644
--- a/src/java.desktop/share/classes/com/sun/beans/finder/ClassFinder.java
+++ b/src/java.desktop/share/classes/com/sun/beans/finder/ClassFinder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,9 +67,7 @@ public final class ClassFinder {
                 return Class.forName(name, false, loader);
             }
 
-        } catch (ClassNotFoundException exception) {
-            // use current class loader instead
-        } catch (SecurityException exception) {
+        } catch (ClassNotFoundException | SecurityException exception) {
             // use current class loader instead
         }
         return Class.forName(name);
@@ -101,9 +99,7 @@ public final class ClassFinder {
         if (loader != null) {
             try {
                 return Class.forName(name, false, loader);
-            } catch (ClassNotFoundException exception) {
-                // use default class loader instead
-            } catch (SecurityException exception) {
+            } catch (ClassNotFoundException | SecurityException exception) {
                 // use default class loader instead
             }
         }
diff --git a/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index e1839777480..add90538ef1 100644
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1160,10 +1160,7 @@ public class JPEGImageReader extends ImageReader {
             cbLock.check();
             try {
                 readInternal(imageIndex, param, false);
-            } catch (RuntimeException e) {
-                resetLibraryState(structPointer);
-                throw e;
-            } catch (IOException e) {
+            } catch (RuntimeException | IOException e) {
                 resetLibraryState(structPointer);
                 throw e;
             }
@@ -1632,10 +1629,7 @@ public class JPEGImageReader extends ImageReader {
                 target = target.createWritableTranslatedChild(saveDestOffset.x,
                                                               saveDestOffset.y);
             }
-        } catch (RuntimeException e) {
-            resetLibraryState(structPointer);
-            throw e;
-        } catch (IOException e) {
+        } catch (RuntimeException | IOException e) {
             resetLibraryState(structPointer);
             throw e;
         } finally {
diff --git a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java
index a59a2cf74e7..82ae068d7e4 100644
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java
@@ -1473,13 +1473,8 @@ public class TIFFImageMetadata extends IIOMetadata {
                     Method getInstanceMethod =
                         setClass.getMethod("getInstance", (Class[])null);
                     o = getInstanceMethod.invoke(null, (Object[])null);
-                } catch (NoSuchMethodException e) {
-                    throw new RuntimeException(e);
-                } catch (IllegalAccessException e) {
-                    throw new RuntimeException(e);
-                } catch (InvocationTargetException e) {
-                    throw new RuntimeException(e);
-                } catch (ClassNotFoundException e) {
+                } catch (NoSuchMethodException | IllegalAccessException |
+                         InvocationTargetException | ClassNotFoundException e) {
                     throw new RuntimeException(e);
                 }
 
diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
index fb3e005b094..66c5de1d4c4 100644
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1357,9 +1357,7 @@ class GTKPainter extends SynthPainter {
                 ENGINE.startPainting(g, x, y, w, h, state, paintMethod);
                 try {
                     paintMethod.invoke(this, context, g, state, x, y, w, h);
-                } catch (IllegalAccessException iae) {
-                    assert false;
-                } catch (InvocationTargetException ite) {
+                } catch (IllegalAccessException | InvocationTargetException e) {
                     assert false;
                 }
                 ENGINE.finishPainting();
@@ -1378,9 +1376,7 @@ class GTKPainter extends SynthPainter {
                 try {
                     paintMethod.invoke(this, context,
                             g, state, x, y, w, h, direction);
-                } catch (IllegalAccessException iae) {
-                    assert false;
-                } catch (InvocationTargetException ite) {
+                } catch (IllegalAccessException | InvocationTargetException e) {
                     assert false;
                 }
                 ENGINE.finishPainting();
diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
index d2388fa6b04..dc983815441 100644
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,11 +118,7 @@ class Metacity implements SynthConstants {
             try {
                 INSTANCE = new Metacity(themeName);
             } catch (FileNotFoundException ex) {
-            } catch (IOException ex) {
-                logError(themeName, ex);
-            } catch (ParserConfigurationException ex) {
-                logError(themeName, ex);
-            } catch (SAXException ex) {
+            } catch (IOException | ParserConfigurationException | SAXException ex) {
                 logError(themeName, ex);
             }
             }
@@ -606,8 +602,6 @@ class Metacity implements SynthConstants {
                             }
                         }
                     }
-                } catch (MalformedURLException ex) {
-                    // OK to just ignore. We'll use a fallback theme.
                 } catch (IOException ex) {
                     // OK to just ignore. We'll use a fallback theme.
                 }
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java b/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
index 1330e48aae5..6431c06a906 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/AudioFileSoundbankReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,9 +51,7 @@ public final class AudioFileSoundbankReader extends SoundbankReader {
         try (AudioInputStream ais = AudioSystem.getAudioInputStream(url)) {
             Soundbank sbk = getSoundbank(ais);
             return sbk;
-        } catch (UnsupportedAudioFileException e) {
-            return null;
-        } catch (IOException e) {
+        } catch (UnsupportedAudioFileException | IOException e) {
             return null;
         }
     }
@@ -67,8 +65,7 @@ public final class AudioFileSoundbankReader extends SoundbankReader {
             Soundbank sbk = getSoundbank(ais);
             if (sbk != null)
                 return sbk;
-        } catch (UnsupportedAudioFileException e) {
-        } catch (IOException e) {
+        } catch (UnsupportedAudioFileException | IOException e) {
         }
         stream.reset();
         return null;
@@ -136,9 +133,7 @@ public final class AudioFileSoundbankReader extends SoundbankReader {
             ins.add(performer);
             sbk.addInstrument(ins);
             return sbk;
-        } catch (UnsupportedAudioFileException e1) {
-            return null;
-        } catch (IOException e) {
+        } catch (UnsupportedAudioFileException | IOException e) {
             return null;
         }
     }
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java b/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java
index e366b3ad73f..ea3c9de4ee6 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/DLSSoundbankReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,9 +47,7 @@ public final class DLSSoundbankReader extends SoundbankReader {
             throws InvalidMidiDataException, IOException {
         try {
             return new DLSSoundbank(url);
-        } catch (RIFFInvalidFormatException e) {
-            return null;
-        } catch(IOException ioe) {
+        } catch (IOException e) {
             return null;
         }
     }
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java b/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
index 2e01d46201c..554044f574a 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1036,12 +1036,9 @@ final class DirectAudioDevice extends AbstractMixer {
                     try {
                         // use DirectDL's open method to open it
                         open(format, (int) Toolkit.millis2bytes(format, CLIP_BUFFER_TIME)); // one second buffer
-                    } catch (LineUnavailableException lue) {
+                    } catch (LineUnavailableException | IllegalArgumentException e) {
                         audioData = null;
-                        throw lue;
-                    } catch (IllegalArgumentException iae) {
-                        audioData = null;
-                        throw iae;
+                        throw e;
                     }
 
                     // if we got this far, we can instanciate the thread
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java b/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
index c804a0e49c2..c48a3a729f1 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -202,10 +202,8 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
                         sequencer.open();
                         sequencer.setSequence(sequence);
 
-                    } catch (InvalidMidiDataException e1) {
-                        if (Printer.err) e1.printStackTrace();
-                    } catch (MidiUnavailableException e2) {
-                        if (Printer.err) e2.printStackTrace();
+                    } catch (InvalidMidiDataException | MidiUnavailableException e) {
+                        if (Printer.err) e.printStackTrace();
                     }
                 }
                 sequencer.addMetaEventListener(this);
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java b/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java
index 312c16904e4..bb9515d992b 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SF2SoundbankReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,9 +47,7 @@ public final class SF2SoundbankReader extends SoundbankReader {
             throws InvalidMidiDataException, IOException {
         try {
             return new SF2Soundbank(url);
-        } catch (RIFFInvalidFormatException e) {
-            return null;
-        } catch(IOException ioe) {
+        } catch (IOException e) {
             return null;
         }
     }
diff --git a/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java b/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java
index 49bd0764bb5..32c9fc3bca1 100644
--- a/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java
+++ b/src/java.desktop/share/classes/java/awt/AWTKeyStroke.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -545,9 +545,7 @@ public class AWTKeyStroke implements Serializable {
 
             try {
                 keyCode = KeyEvent.class.getField(key).getInt(KeyEvent.class);
-            } catch (NoSuchFieldException nsfe) {
-                throw new IllegalArgumentException(errmsg);
-            } catch (IllegalAccessException iae) {
+            } catch (NoSuchFieldException | IllegalAccessException e) {
                 throw new IllegalArgumentException(errmsg);
             }
             value = Integer.valueOf(keyCode);
diff --git a/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java b/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java
index 62a86ced4b4..820bdc25279 100644
--- a/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java
+++ b/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2597,10 +2597,8 @@ public abstract class KeyboardFocusManager
         Throwable retEx = null;
         try {
             comp.dispatchEvent(event);
-        } catch (RuntimeException re) {
-            retEx = re;
-        } catch (Error er) {
-            retEx = er;
+        } catch (RuntimeException | Error e) {
+            retEx = e;
         }
         if (retEx != null) {
             if (ex != null) {
diff --git a/src/java.desktop/share/classes/javax/swing/JEditorPane.java b/src/java.desktop/share/classes/javax/swing/JEditorPane.java
index f347621a687..75808851599 100644
--- a/src/java.desktop/share/classes/javax/swing/JEditorPane.java
+++ b/src/java.desktop/share/classes/javax/swing/JEditorPane.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -693,11 +693,7 @@ public class JEditorPane extends JTextComponent {
                                 setDocument(doc);
                             }
                         });
-                    } catch (InvocationTargetException ex) {
-                        UIManager.getLookAndFeel().provideErrorFeedback(
-                                                            JEditorPane.this);
-                        return old;
-                    } catch (InterruptedException ex) {
+                    } catch (InvocationTargetException | InterruptedException ex) {
                         UIManager.getLookAndFeel().provideErrorFeedback(
                                                             JEditorPane.this);
                         return old;
@@ -818,9 +814,7 @@ public class JEditorPane extends JTextComponent {
                         handleConnectionProperties(conn);
                     }
                 });
-            } catch (InterruptedException e) {
-                throw new RuntimeException(e);
-            } catch (InvocationTargetException e) {
+            } catch (InterruptedException | InvocationTargetException e) {
                 throw new RuntimeException(e);
             }
         }
@@ -1061,14 +1055,9 @@ public class JEditorPane extends JTextComponent {
                     putClientProperty("charset", charset);
                 }
             }
-        }
-        catch (IndexOutOfBoundsException e) {
+        } catch (IndexOutOfBoundsException | NullPointerException e) {
             // malformed parameter list, use charset we have
-        }
-        catch (NullPointerException e) {
-            // malformed parameter list, use charset we have
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             // malformed parameter list, use charset we have; but complain
             System.err.println("JEditorPane.getCharsetFromContentTypeParameters failed on: " + paramlist);
             e.printStackTrace();
@@ -1479,9 +1468,7 @@ public class JEditorPane extends JTextComponent {
             Reader r = new StringReader(t);
             EditorKit kit = getEditorKit();
             kit.read(r, doc, 0);
-        } catch (IOException ioe) {
-            UIManager.getLookAndFeel().provideErrorFeedback(JEditorPane.this);
-        } catch (BadLocationException ble) {
+        } catch (IOException | BadLocationException e) {
             UIManager.getLookAndFeel().provideErrorFeedback(JEditorPane.this);
         }
     }
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java
index 2adbd3b87b2..f9de13876bd 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java
@@ -956,12 +956,9 @@ public class BasicPopupMenuUI extends PopupMenuUI {
                     popup.putClientProperty("JPopupMenu.firePopupMenuCanceled", Boolean.TRUE);
                 }
                 MenuSelectionManager.defaultManager().clearSelectedPath();
-            } catch (RuntimeException ex) {
+            } catch (RuntimeException | Error e) {
                 realUngrabWindow();
-                throw ex;
-            } catch (Error err) {
-                realUngrabWindow();
-                throw err;
+                throw e;
             }
         }
 
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
index cc6c46318d7..fbe559bfc9a 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -709,9 +709,7 @@ public class BasicSpinnerUI extends SpinnerUI
                         spinner.setValue(value);
                         select(spinner);
                     }
-                } catch (IllegalArgumentException iae) {
-                    UIManager.getLookAndFeel().provideErrorFeedback(spinner);
-                } catch (ParseException pe) {
+                } catch (IllegalArgumentException | ParseException ex) {
                     UIManager.getLookAndFeel().provideErrorFeedback(spinner);
                 }
             }
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
index 6151651eaee..d496be8a731 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
@@ -2626,9 +2626,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
                     }
 
                     imported = true;
-                } catch (UnsupportedFlavorException ufe) {
-                } catch (BadLocationException ble) {
-                } catch (IOException ioe) {
+                } catch (UnsupportedFlavorException | IOException | BadLocationException ex) {
                 }
             }
             return imported;
@@ -2694,8 +2692,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
                             richText = sw.toString();
                         }
                     }
-                } catch (BadLocationException ble) {
-                } catch (IOException ioe) {
+                } catch (BadLocationException | IOException ex) {
                 }
             }
 
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java
index 3187cdd1a52..097f699958a 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/LazyActionMap.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,15 +150,10 @@ class LazyActionMap extends ActionMapUIResource {
             } catch (NoSuchMethodException nsme) {
                 assert false : "LazyActionMap unable to load actions " +
                         klass;
-            } catch (IllegalAccessException iae) {
+            } catch (IllegalAccessException | IllegalArgumentException |
+                     InvocationTargetException e) {
                 assert false : "LazyActionMap unable to load actions " +
-                        iae;
-            } catch (InvocationTargetException ite) {
-                assert false : "LazyActionMap unable to load actions " +
-                        ite;
-            } catch (IllegalArgumentException iae) {
-                assert false : "LazyActionMap unable to load actions " +
-                        iae;
+                        e;
             }
         }
     }
diff --git a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthParser.java b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthParser.java
index 4c212bc1ad8..cb1804e8c5d 100644
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthParser.java
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthParser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -240,16 +240,13 @@ class SynthParser extends DefaultHandler {
                 SAXParser saxParser = SAXParserFactory.newInstance().
                                                    newSAXParser();
                 saxParser.parse(new BufferedInputStream(inputStream), this);
-            } catch (ParserConfigurationException e) {
+            } catch (ParserConfigurationException | IOException e) {
                 throw new ParseException("Error parsing: " + e, 0);
             }
             catch (SAXException se) {
                 throw new ParseException("Error parsing: " + se + " " +
                                          se.getException(), 0);
             }
-            catch (IOException ioe) {
-                throw new ParseException("Error parsing: " + ioe, 0);
-            }
         } finally {
             reset();
         }
@@ -628,9 +625,7 @@ class SynthParser extends DefaultHandler {
                     try {
                         color = new ColorUIResource((Color)Color.class.
                               getField(value.toUpperCase()).get(Color.class));
-                    } catch (NoSuchFieldException nsfe) {
-                        throw new SAXException("Invalid color name: " + value);
-                    } catch (IllegalAccessException iae) {
+                    } catch (NoSuchFieldException | IllegalAccessException e) {
                         throw new SAXException("Invalid color name: " + value);
                     }
                 }
@@ -661,10 +656,7 @@ class SynthParser extends DefaultHandler {
                         _colorTypes.add((ColorType)checkCast(typeClass.
                               getField(typeName.substring(classIndex)).
                               get(typeClass), ColorType.class));
-                    } catch (NoSuchFieldException nsfe) {
-                        throw new SAXException("Unable to find color type: " +
-                                               typeName);
-                    } catch (IllegalAccessException iae) {
+                    } catch (NoSuchFieldException | IllegalAccessException e) {
                         throw new SAXException("Unable to find color type: " +
                                                typeName);
                     }
diff --git a/src/java.desktop/share/classes/javax/swing/text/CompositeView.java b/src/java.desktop/share/classes/javax/swing/text/CompositeView.java
index 5220395d35a..6d15b50e925 100644
--- a/src/java.desktop/share/classes/javax/swing/text/CompositeView.java
+++ b/src/java.desktop/share/classes/javax/swing/text/CompositeView.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,6 @@ package javax.swing.text;
 
 import java.util.*;
 import java.awt.*;
-import javax.swing.event.*;
-import javax.swing.SwingConstants;
 
 /**
  * <code>CompositeView</code> is an abstract <code>View</code>
@@ -398,8 +396,7 @@ public abstract class CompositeView extends View {
             try {
                 retValue = getNextVisualPositionFrom(-1, Position.Bias.Forward,
                                                      a, EAST, bias);
-            } catch (BadLocationException ble) { }
-            catch (IllegalArgumentException iae) { }
+            } catch (BadLocationException | IllegalArgumentException e) { }
             if(retValue == -1) {
                 retValue = getStartOffset();
                 bias[0] = Position.Bias.Forward;
@@ -411,8 +408,7 @@ public abstract class CompositeView extends View {
             try {
                 retValue = getNextVisualPositionFrom(-1, Position.Bias.Forward,
                                                      a, WEST, bias);
-            } catch (BadLocationException ble) { }
-            catch (IllegalArgumentException iae) { }
+            } catch (BadLocationException | IllegalArgumentException e) { }
 
             if(retValue == -1) {
                 // NOTE: this could actually use end offset with backward.
diff --git a/src/java.desktop/share/classes/javax/swing/text/InternationalFormatter.java b/src/java.desktop/share/classes/javax/swing/text/InternationalFormatter.java
index 8a4157d2c4a..7cd2c2deb36 100644
--- a/src/java.desktop/share/classes/javax/swing/text/InternationalFormatter.java
+++ b/src/java.desktop/share/classes/javax/swing/text/InternationalFormatter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -528,9 +528,8 @@ public class InternationalFormatter extends DefaultFormatter {
 
                         updateMask(iterator);
                     }
-                    catch (ParseException pe) {}
-                    catch (IllegalArgumentException iae) {}
-                    catch (NullPointerException npe) {}
+                    catch (ParseException | NullPointerException | IllegalArgumentException e) {
+                    }
                 }
             }
         }
@@ -1048,8 +1047,8 @@ public class InternationalFormatter extends DefaultFormatter {
                                     validEdit = true;
                                 }
                             }
-                            catch (ParseException pe) { }
-                            catch (BadLocationException ble) { }
+                            catch (ParseException | BadLocationException e) {
+                            }
                         }
                     }
                 }
diff --git a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java
index d618dc6a2a1..26953311412 100644
--- a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java
+++ b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -4071,8 +4071,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
 
                         ((JTextComponent)comp).replaceSelection(data);
                         return true;
-                    } catch (UnsupportedFlavorException ufe) {
-                    } catch (IOException ioe) {
+                    } catch (UnsupportedFlavorException | IOException e) {
                     }
                 }
             }
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java b/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java
index 1baf157dab4..5ecbaefa709 100644
--- a/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java
+++ b/src/java.desktop/share/classes/javax/swing/text/html/FrameView.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 package javax.swing.text.html;
 
 import java.awt.*;
-import java.util.*;
 import java.net.*;
 import java.io.*;
 import javax.swing.*;
@@ -101,10 +100,8 @@ class FrameView extends ComponentView implements HyperlinkListener {
                 setMargin();
                 createScrollPane();
                 setBorder();
-            } catch (MalformedURLException e) {
+            } catch (IOException e) {
                 e.printStackTrace();
-            } catch (IOException e1) {
-                e1.printStackTrace();
             }
         }
         createdComponent = true;
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
index f4bbb772e78..a09843d0530 100644
--- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -797,9 +797,7 @@ public class HTMLDocument extends DefaultStyledDocument {
             html += ">";
             installParserIfNecessary();
             setOuterHTML(element, html);
-        } catch (BadLocationException e1) {
-            // Should handle this better
-        } catch (IOException ioe) {
+        } catch (BadLocationException | IOException e) {
             // Should handle this better
         }
     }
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java
index a5c1067f03f..8e0f7c51d68 100644
--- a/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java
+++ b/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1881,10 +1881,8 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
                 getHTMLEditorKit(editor).insertHTML(doc, offset, html,
                                                     popDepth, pushDepth,
                                                     addTag);
-            } catch (IOException ioe) {
-                throw new RuntimeException("Unable to insert: " + ioe);
-            } catch (BadLocationException ble) {
-                throw new RuntimeException("Unable to insert: " + ble);
+            } catch (IOException | BadLocationException e) {
+                throw new RuntimeException("Unable to insert: " + e);
             }
         }
 
diff --git a/src/java.desktop/share/classes/javax/swing/text/html/IsindexView.java b/src/java.desktop/share/classes/javax/swing/text/html/IsindexView.java
index 9e8d405e2a9..4b2fb1e1c73 100644
--- a/src/java.desktop/share/classes/javax/swing/text/html/IsindexView.java
+++ b/src/java.desktop/share/classes/javax/swing/text/html/IsindexView.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@ package javax.swing.text.html;
 import java.awt.*;
 import java.awt.event.*;
 import java.net.URLEncoder;
-import java.net.MalformedURLException;
 import java.io.IOException;
 import java.net.URL;
 import javax.swing.text.*;
@@ -108,8 +107,7 @@ class IsindexView extends ComponentView implements ActionListener {
             URL url = new URL(action+"?"+data);
             JEditorPane pane = (JEditorPane)getContainer();
             pane.setPage(url);
-        } catch (MalformedURLException e1) {
-        } catch (IOException e2) {
+        } catch (IOException e) {
         }
     }
 }
diff --git a/src/java.desktop/share/classes/sun/awt/image/InputStreamImageSource.java b/src/java.desktop/share/classes/sun/awt/image/InputStreamImageSource.java
index 8773cf538e3..1873b4b3707 100644
--- a/src/java.desktop/share/classes/sun/awt/image/InputStreamImageSource.java
+++ b/src/java.desktop/share/classes/sun/awt/image/InputStreamImageSource.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@ import java.awt.image.*;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.BufferedInputStream;
-import java.util.Hashtable;
 
 public abstract class InputStreamImageSource implements ImageProducer,
                                                         ImageFetchable
@@ -268,10 +267,7 @@ public abstract class InputStreamImageSource implements ImageProducer,
             setDecoder(imgd);
             try {
                 imgd.produceImage();
-            } catch (IOException e) {
-                e.printStackTrace();
-                // the finally clause will send an error.
-            } catch (ImageFormatException e) {
+            } catch (IOException | ImageFormatException e) {
                 e.printStackTrace();
                 // the finally clause will send an error.
             } finally {
diff --git a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
index 1f95995a222..d9294369249 100644
--- a/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
+++ b/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -232,9 +232,7 @@ public abstract class ShellFolder extends File {
                 managerClass = null;
             }
         // swallow the exceptions below and use default shell folder
-        } catch(ClassNotFoundException e) {
-        } catch(NullPointerException e) {
-        } catch(SecurityException e) {
+        } catch (ClassNotFoundException | SecurityException | NullPointerException e) {
         }
 
         if (managerClass == null) {
diff --git a/src/java.desktop/share/classes/sun/font/TrueTypeFont.java b/src/java.desktop/share/classes/sun/font/TrueTypeFont.java
index 856297643cf..dc12936fe39 100644
--- a/src/java.desktop/share/classes/sun/font/TrueTypeFont.java
+++ b/src/java.desktop/share/classes/sun/font/TrueTypeFont.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,6 @@ package sun.font;
 
 import java.awt.Font;
 import java.awt.FontFormatException;
-import java.awt.GraphicsEnvironment;
 import java.awt.geom.Point2D;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -413,8 +412,6 @@ public class TrueTypeFont extends FileFont {
                 disposerRecord.channel.read(buffer);
                 buffer.flip();
             }
-        } catch (FontFormatException e) {
-            return null;
         } catch (ClosedChannelException e) {
             /* NIO I/O is interruptible, recurse to retry operation.
              * Clear interrupts before recursing in case NIO didn't.
@@ -422,7 +419,7 @@ public class TrueTypeFont extends FileFont {
             Thread.interrupted();
             close();
             readBlock(buffer, offset, length);
-        } catch (IOException e) {
+        } catch (FontFormatException | IOException e) {
             return null;
         }
         return buffer;
@@ -825,9 +822,7 @@ public class TrueTypeFont extends FileFont {
                 Thread.interrupted();
                 close();
                 return getTableBuffer(tag);
-            } catch (IOException e) {
-                return null;
-            } catch (FontFormatException e) {
+            } catch (IOException | FontFormatException e) {
                 return null;
             }
 
diff --git a/src/java.desktop/share/classes/sun/font/Type1Font.java b/src/java.desktop/share/classes/sun/font/Type1Font.java
index 1c9cf9f8e88..3af17e793ca 100644
--- a/src/java.desktop/share/classes/sun/font/Type1Font.java
+++ b/src/java.desktop/share/classes/sun/font/Type1Font.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -208,15 +208,13 @@ public class Type1Font extends FileFont {
                 bbuf.position(0);
                 bufferRef = new WeakReference<>(bbuf);
                 fc.close();
-            } catch (NullPointerException e) {
-                throw new FontFormatException(e.toString());
             } catch (ClosedChannelException e) {
                 /* NIO I/O is interruptible, recurse to retry operation.
                  * Clear interrupts before recursing in case NIO didn't.
                  */
                 Thread.interrupted();
                 return getBuffer();
-            } catch (IOException e) {
+            } catch (NullPointerException | IOException e) {
                 throw new FontFormatException(e.toString());
             }
         }
@@ -245,7 +243,6 @@ public class Type1Font extends FileFont {
             });
             fc = raf.getChannel();
             while (buffer.remaining() > 0 && fc.read(buffer) != -1) {}
-        } catch (NullPointerException npe) {
         } catch (ClosedChannelException e) {
             try {
                 if (raf != null) {
@@ -259,7 +256,7 @@ public class Type1Font extends FileFont {
              */
             Thread.interrupted();
             readFile(buffer);
-        } catch (IOException e) {
+        } catch (NullPointerException | IOException e) {
         } finally  {
             if (raf != null) {
                 try {
@@ -345,8 +342,6 @@ public class Type1Font extends FileFont {
                 } else {
                     throw new FontFormatException("bad pfb file");
                 }
-            } catch (BufferUnderflowException bue) {
-                throw new FontFormatException(bue.toString());
             } catch (Exception e) {
                 throw new FontFormatException(e.toString());
             }
diff --git a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
index 01a24adfda4..4b3564aad54 100644
--- a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
+++ b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,6 @@ import javax.print.attribute.standard.DialogTypeSelection;
 import javax.print.attribute.standard.JobName;
 import javax.print.attribute.standard.Sides;
 
-import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.File;
@@ -1309,9 +1308,7 @@ public class PSPrinterJob extends RasterPrinterJob {
                                       bb, true);
                         bb.flip();
                         len = bb.limit();
-                    } catch(IllegalStateException xx){
-                        continue;
-                    } catch(CoderMalfunctionError xx){
+                    } catch (IllegalStateException | CoderMalfunctionError xx){
                         continue;
                     }
                     /* The width to fit to may either be specified,
diff --git a/src/java.desktop/share/classes/sun/print/PSStreamPrintJob.java b/src/java.desktop/share/classes/sun/print/PSStreamPrintJob.java
index 4fcc644829c..601fb69226d 100644
--- a/src/java.desktop/share/classes/sun/print/PSStreamPrintJob.java
+++ b/src/java.desktop/share/classes/sun/print/PSStreamPrintJob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@ import java.util.Vector;
 import javax.print.CancelablePrintJob;
 import javax.print.Doc;
 import javax.print.DocFlavor;
-import javax.print.DocPrintJob;
 import javax.print.PrintService;
 import javax.print.PrintException;
 import javax.print.event.PrintJobEvent;
@@ -42,7 +41,6 @@ import javax.print.event.PrintJobListener;
 import javax.print.event.PrintJobAttributeListener;
 
 import javax.print.attribute.Attribute;
-import javax.print.attribute.AttributeSet;
 import javax.print.attribute.AttributeSetUtilities;
 import javax.print.attribute.DocAttributeSet;
 import javax.print.attribute.HashPrintJobAttributeSet;
@@ -304,12 +302,9 @@ public class PSStreamPrintJob implements CancelablePrintJob {
                 instream = doc.getStreamForBytes();
                 printableJob(new ImagePrinter(instream), reqAttrSet);
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (flavor.equals(DocFlavor.URL.GIF) ||
                    flavor.equals(DocFlavor.URL.JPEG) ||
@@ -325,23 +320,17 @@ public class PSStreamPrintJob implements CancelablePrintJob {
             try {
                 pageableJob((Pageable)doc.getPrintData(), reqAttrSet);
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (repClassName.equals("java.awt.print.Printable")) {
             try {
                 printableJob((Printable)doc.getPrintData(), reqAttrSet);
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else {
             notifyEvent(PrintJobEvent.JOB_FAILED);
diff --git a/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java b/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java
index 6e60cd803b3..45f16737673 100644
--- a/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java
+++ b/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ import java.awt.font.FontRenderContext;
 import java.awt.print.PageFormat;
 import java.awt.print.Printable;
 import java.awt.print.PrinterException;
+import java.lang.reflect.InvocationTargetException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -610,8 +611,7 @@ public class TextComponentPrintable implements CountingPrintable {
                         public void run() {
                         }
                     });
-            } catch (InterruptedException ignore) {
-            } catch (java.lang.reflect.InvocationTargetException ignore) {
+            } catch (InterruptedException | InvocationTargetException ignore) {
             }
             Document document = textComponentToPrint.getDocument();
             ((AbstractDocument) document).readLock();
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java
index 72aeb67a3f9..d2c02f829f8 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,12 +77,9 @@ class MotifDnDDragSourceProtocol extends XDragSourceProtocol
             int index = MotifDnDConstants.getIndexForTargetList(formats);
 
             MotifDnDConstants.writeDragInitiatorInfoStruct(window, index);
-        } catch (XException xe) {
+        } catch (XException | InvalidDnDOperationException e) {
             cleanup();
-            throw xe;
-        } catch (InvalidDnDOperationException idoe) {
-            cleanup();
-            throw idoe;
+            throw e;
         }
 
         if (!MotifDnDConstants.MotifDnDSelection.setOwner(contents, formatMap,
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
index 04ebb1354d1..7a395745365 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
@@ -1376,9 +1376,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
                         awt_multiclick_time = AWT_MULTICLICK_DEFAULT_TIME;
                     }
                 }
-            } catch (NumberFormatException nf) {
-                awt_multiclick_time = AWT_MULTICLICK_DEFAULT_TIME;
-            } catch (NullPointerException npe) {
+            } catch (NumberFormatException | NullPointerException e) {
                 awt_multiclick_time = AWT_MULTICLICK_DEFAULT_TIME;
             }
         } finally {
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java b/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java
index 55b080f34aa..6ba0364057a 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XTrayIconPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -285,8 +285,7 @@ public class XTrayIconPeer implements TrayIconPeer,
                             disposeOnEDT();
                         }
                     });
-            } catch (InterruptedException ie) {
-            } catch (InvocationTargetException ite) {}
+            } catch (InterruptedException | InvocationTargetException e) {}
         }
     }
 
diff --git a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java
index 3157dfb58b9..3657b46373b 100644
--- a/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java
+++ b/src/java.desktop/unix/classes/sun/java2d/opengl/GLXVolatileSurfaceManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,9 +121,7 @@ public class GLXVolatileSurfaceManager extends VolatileSurfaceManager {
                                                       cm, vImg, type);
                 }
             }
-        } catch (NullPointerException ex) {
-            sData = null;
-        } catch (OutOfMemoryError er) {
+        } catch (NullPointerException | OutOfMemoryError e) {
             sData = null;
         }
 
diff --git a/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java
index 2b06d471de8..27b79c00a4a 100644
--- a/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java
+++ b/src/java.desktop/unix/classes/sun/java2d/x11/X11VolatileSurfaceManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,9 +96,7 @@ public class X11VolatileSurfaceManager extends VolatileSurfaceManager {
                                               cm, vImg, drawable,
                                               Transparency.OPAQUE,
                                               false);
-        } catch (NullPointerException ex) {
-            sData = null;
-        } catch (OutOfMemoryError er) {
+        } catch (NullPointerException | OutOfMemoryError e) {
             sData = null;
         }
 
diff --git a/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java b/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java
index 12a3034cf20..0a09c6e35e2 100644
--- a/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java
+++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRVolatileSurfaceManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,9 +63,7 @@ public class XRVolatileSurfaceManager extends VolatileSurfaceManager {
                                              vImg.getHeight(),
                                              cm, vImg, drawable,
                                              vImg.getTransparency(), false);
-        } catch (NullPointerException ex) {
-            sData = null;
-        } catch (OutOfMemoryError er) {
+        } catch (NullPointerException | OutOfMemoryError e) {
             sData = null;
         }
 
diff --git a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
index eefef8a5353..3f5a67aae10 100644
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -420,12 +420,9 @@ public class UnixPrintJob implements CancelablePrintJob {
                     }
                     return;
                 }
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (flavor.equals(DocFlavor.URL.GIF) ||
                    flavor.equals(DocFlavor.URL.JPEG) ||
@@ -504,12 +501,9 @@ public class UnixPrintJob implements CancelablePrintJob {
                     ((UnixPrintService)service).wakeNotifier();
                 }
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (repClassName.equals("java.awt.print.Printable")) {
             try {
@@ -520,12 +514,9 @@ public class UnixPrintJob implements CancelablePrintJob {
                     ((UnixPrintService)service).wakeNotifier();
                 }
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else {
             notifyEvent(PrintJobEvent.JOB_FAILED);
diff --git a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java
index c152c44363a..b0fe3878cc3 100644
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java
+++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DVolatileSurfaceManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,11 +113,7 @@ public class D3DVolatileSurfaceManager
                                                   cm, vImg,
                                                   type);
             }
-        } catch (NullPointerException ex) {
-            sData = null;
-        } catch (OutOfMemoryError er) {
-            sData = null;
-        } catch (InvalidPipeException ipe) {
+        } catch (NullPointerException | OutOfMemoryError | InvalidPipeException e) {
             sData = null;
         }
 
diff --git a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java
index 0bcd3e95dea..750bb94df08 100644
--- a/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java
+++ b/src/java.desktop/windows/classes/sun/java2d/opengl/WGLVolatileSurfaceManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,9 +118,7 @@ public class WGLVolatileSurfaceManager extends VolatileSurfaceManager {
                                                       cm, vImg, type);
                 }
             }
-        } catch (NullPointerException ex) {
-            sData = null;
-        } catch (OutOfMemoryError er) {
+        } catch (NullPointerException | OutOfMemoryError e) {
             sData = null;
         }
 
diff --git a/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java b/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java
index c494aa637ae..44759358f25 100644
--- a/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java
+++ b/src/java.desktop/windows/classes/sun/print/Win32PrintJob.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -363,12 +363,9 @@ public class Win32PrintJob implements CancelablePrintJob {
                 printableJob(new ImagePrinter(instream));
                 service.wakeNotifier();
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (flavor.equals(DocFlavor.URL.GIF) ||
                    flavor.equals(DocFlavor.URL.JPEG) ||
@@ -386,24 +383,18 @@ public class Win32PrintJob implements CancelablePrintJob {
                 pageableJob((Pageable)doc.getPrintData());
                 service.wakeNotifier();
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (repClassName.equals("java.awt.print.Printable")) {
             try {
                 printableJob((Printable)doc.getPrintData());
                 service.wakeNotifier();
                 return;
-            } catch (ClassCastException cce) {
+            } catch (ClassCastException | IOException e) {
                 notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(cce);
-            } catch (IOException ioe) {
-                notifyEvent(PrintJobEvent.JOB_FAILED);
-                throw new PrintException(ioe);
+                throw new PrintException(e);
             }
         } else if (repClassName.equals("[B") ||
                    repClassName.equals("java.io.InputStream") ||