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) 2020, Red Hat Inc.
* Copyright (c) 2020, 2022, Red Hat Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -170,9 +170,7 @@ public interface CgroupSubsystemController {
.findFirst();
return result.isPresent() ? Long.parseLong(result.get()) : defaultRetval;
} catch (UncheckedIOException e) {
return defaultRetval;
} catch (IOException e) {
} catch (UncheckedIOException | IOException e) {
return defaultRetval;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Red Hat Inc.
* Copyright (c) 2020, 2022, Red Hat Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,9 +82,7 @@ public class CgroupSubsystemFactory {
Optional<CgroupTypeResult> optResult = null;
try {
optResult = determineType("/proc/self/mountinfo", "/proc/cgroups", "/proc/self/cgroup");
} catch (IOException e) {
return null;
} catch (UncheckedIOException e) {
} catch (IOException | UncheckedIOException e) {
return null;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Red Hat Inc.
* Copyright (c) 2020, 2022, Red Hat Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -332,9 +332,7 @@ public class CgroupV2Subsystem implements CgroupSubsystem {
return CgroupUtil.readFilePrivileged(Paths.get(unified.path(), "io.stat"))
.map(mapFunc)
.collect(Collectors.summingLong(e -> e));
} catch (UncheckedIOException e) {
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
} catch (IOException e) {
} catch (UncheckedIOException | IOException e) {
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2018, 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
@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import static sun.nio.ch.EPoll.EPOLLIN;
import static sun.nio.ch.EPoll.EPOLLONESHOT;
import static sun.nio.ch.EPoll.EPOLL_CTL_ADD;
import static sun.nio.ch.EPoll.EPOLL_CTL_DEL;
import static sun.nio.ch.EPoll.EPOLL_CTL_MOD;
@ -304,10 +303,9 @@ final class EPollPort
// process event
try {
ev.channel().onEvent(ev.events(), isPooledThread);
} catch (Error x) {
replaceMe = true; throw x;
} catch (RuntimeException x) {
replaceMe = true; throw x;
} catch (Error | RuntimeException x) {
replaceMe = true;
throw x;
}
}
} finally {