8284672: Collapse identical catch branches in java.desktop

Reviewed-by: prr, aivanov, serb
This commit is contained in:
Andrey Turbanov 2022-06-20 09:02:15 +00:00
parent 7acdcc1034
commit 695d8656c5
45 changed files with 130 additions and 297 deletions

@ -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);
}
}

@ -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;
}
}
}

@ -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);

@ -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
}
}

@ -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 {

@ -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);
}

@ -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();

@ -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.
}

@ -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;
}
}

@ -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;
}
}

@ -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

@ -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);

@ -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;
}
}

@ -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);

@ -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) {

@ -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);
}
}

@ -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;
}
}

@ -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);
}
}

@ -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) {
}
}

@ -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;
}
}
}

@ -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);
}

@ -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.

@ -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) {
}
}
}
}

@ -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) {
}
}
}

@ -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;

@ -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
}
}

@ -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);
}
}

@ -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) {
}
}
}

@ -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 {

@ -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) {

@ -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;
}

@ -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());
}

@ -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,

@ -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);

@ -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();

@ -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,

@ -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 {

@ -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) {}
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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);

@ -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;
}

@ -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;
}

@ -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") ||