8284567: Collapse identical catch branches in java.base

Reviewed-by: darcy, iris, wetmore
This commit is contained in:
Andrey Turbanov 2022-04-11 09:32:24 +00:00
parent 40ddb7558c
commit f4edb59a6e
17 changed files with 46 additions and 106 deletions

View file

@ -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
@ -44,9 +44,6 @@ import jdk.internal.access.JavaNetUriAccess;
import jdk.internal.access.SharedSecrets;
import sun.nio.cs.UTF_8;
import java.lang.Character; // for javadoc
import java.lang.NullPointerException; // for javadoc
/**
* Represents a Uniform Resource Identifier (URI) reference.
*
@ -3451,9 +3448,7 @@ public final class URI
try {
p = scanIPv4Address(start, n, false);
} catch (URISyntaxException x) {
return -1;
} catch (NumberFormatException nfe) {
} catch (URISyntaxException | NumberFormatException x) {
return -1;
}

View file

@ -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
@ -100,13 +100,8 @@ public abstract class AsynchronousChannelProvider {
Object tmp = Class.forName(cn, true,
ClassLoader.getSystemClassLoader()).newInstance();
return (AsynchronousChannelProvider)tmp;
} catch (ClassNotFoundException x) {
throw new ServiceConfigurationError(null, x);
} catch (IllegalAccessException x) {
throw new ServiceConfigurationError(null, x);
} catch (InstantiationException x) {
throw new ServiceConfigurationError(null, x);
} catch (SecurityException x) {
} catch (ClassNotFoundException | SecurityException |
InstantiationException | IllegalAccessException x) {
throw new ServiceConfigurationError(null, x);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, 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
@ -24,7 +24,6 @@
*/
package java.util;
import java.util.Map.Entry;
/**
* This class provides a skeletal implementation of the {@code Map}
@ -493,9 +492,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
return false;
}
}
} catch (ClassCastException unused) {
return false;
} catch (NullPointerException unused) {
} catch (ClassCastException | NullPointerException unused) {
return false;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 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
@ -831,9 +831,7 @@ public class Hashtable<K,V>
return false;
}
}
} catch (ClassCastException unused) {
return false;
} catch (NullPointerException unused) {
} catch (ClassCastException | NullPointerException unused) {
return false;
}