mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8274757: Cleanup unnecessary calls to Throwable.initCause() in java.management module
Reviewed-by: dfuchs, sspitsyn
This commit is contained in:
parent
c06df25a4f
commit
1c45c8a082
10 changed files with 18 additions and 50 deletions
|
@ -1648,8 +1648,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
|
|||
*/
|
||||
private static IOException newIOException(String message,
|
||||
Throwable cause) {
|
||||
final IOException x = new IOException(message);
|
||||
return EnvHelp.initCause(x,cause);
|
||||
return new IOException(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -367,7 +367,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
|||
} catch (NamingException e) {
|
||||
final String msg = "Failed to retrieve RMIServer stub: " + e;
|
||||
if (tracing) logger.trace("connect",idstr + " " + msg);
|
||||
throw EnvHelp.initCause(new IOException(msg),e);
|
||||
throw new IOException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,9 +543,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
|
|||
throw (IOException) closeException;
|
||||
if (closeException instanceof RuntimeException)
|
||||
throw (RuntimeException) closeException;
|
||||
final IOException x =
|
||||
new IOException("Failed to close: " + closeException);
|
||||
throw EnvHelp.initCause(x,closeException);
|
||||
throw new IOException("Failed to close: " + closeException, closeException);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2021, 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,8 +420,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
|
|||
try {
|
||||
mbsf = new MBeanServerFileAccessController(accessFile);
|
||||
} catch (IOException e) {
|
||||
throw EnvHelp.initCause(
|
||||
new IllegalArgumentException(e.getMessage()), e);
|
||||
throw new IllegalArgumentException(e.getMessage(), e);
|
||||
}
|
||||
// Set the MBeanServerForwarder
|
||||
//
|
||||
|
@ -434,9 +433,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
|
|||
defaultClassLoader = EnvHelp.resolveServerClassLoader(
|
||||
attributes, getMBeanServer());
|
||||
} catch (InstanceNotFoundException infc) {
|
||||
IllegalArgumentException x = new
|
||||
IllegalArgumentException("ClassLoader not found: "+infc);
|
||||
throw EnvHelp.initCause(x,infc);
|
||||
throw new IllegalArgumentException("ClassLoader not found: " + infc, infc);
|
||||
}
|
||||
|
||||
if (tracing) logger.trace("start", "setting RMIServer object");
|
||||
|
@ -831,8 +828,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
|
|||
*/
|
||||
private static IOException newIOException(String message,
|
||||
Throwable cause) {
|
||||
final IOException x = new IOException(message);
|
||||
return EnvHelp.initCause(x,cause);
|
||||
return new IOException(message, cause);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue