Skip to content
Snippets Groups Projects
Verified Commit 71f01755 authored by BIGARET Sebastien's avatar BIGARET Sebastien
Browse files

Raise an exception when the connection to the (RMI) server fails

parent fbb0ab50
Branches
No related tags found
No related merge requests found
......@@ -263,12 +263,14 @@ public class RMICommunicationFacade
* Constructor to be called on the client/platform side:
* @param hostname
* @param portNumber
* @throws IOException if the connection to the server fails
*/
public RMICommunicationFacade(String name, String hostname, int portNumber, boolean useHTTP)
public RMICommunicationFacade(String name, String hostname, int portNumber, boolean useHTTP) throws IOException
{
super(name);
this.clientIP = null;
this.useHTTP = useHTTP;
this.useHTTP = useHTTP; // cf. rmi.useHTTP in run_configuration.xml ?
final boolean useSSL = Configuration.getBoolean("rmi.useSSL");
try
{
// The following directly enables HTTP-to-CGI.
......@@ -285,7 +287,7 @@ public class RMICommunicationFacade
RMISocketFactory.setSocketFactory(new sun.rmi.transport.proxy.RMIHttpToCGISocketFactory());
}
Registry registry;
if (Configuration.getBoolean("rmi.useSSL"))
if (useSSL)
registry = LocateRegistry.getRegistry(hostname, portNumber, new SslRMIClientSocketFactory());
else
registry = LocateRegistry.getRegistry(hostname, portNumber);
......@@ -296,7 +298,11 @@ public class RMICommunicationFacade
}
catch (Exception e)
{
throw new RuntimeException("[RMI] Unable to connect to " + hostname + ":" + portNumber, e);
final StringBuilder err = new StringBuilder();
err.append("Connection to RMI Registry ").append(hostname).append(":").append(portNumber).append(" failed");
err.append(useSSL ? " (ssl)" : "");
Log.log.log(Level.SEVERE, err.toString(), e);
throw new IOException(err.toString(), e);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment