src/share/classes/java/util/logging/SocketHandler.java

Print this page

        

*** 116,135 **** * @throws IOException if we are unable to connect to the target * host and port. */ public SocketHandler() throws IOException { // We are going to use the logging defaults. ! sealed = false; configure(); - try { connect(); ! } catch (IOException ix) { System.err.println("SocketHandler: connect failed to " + host + ":" + port); ! throw ix; } - sealed = true; } /** * Construct a <tt>SocketHandler</tt> using a specified host and port. * --- 116,138 ---- * @throws IOException if we are unable to connect to the target * host and port. */ public SocketHandler() throws IOException { // We are going to use the logging defaults. ! try { ! doWithControlPermission(() -> { configure(); try { connect(); ! } catch (IOException ioe) { ! throw new UncheckedIOException(ioe); ! } ! }); ! } catch (UncheckedIOException uioe) { System.err.println("SocketHandler: connect failed to " + host + ":" + port); ! throw uioe.getCause(); } } /** * Construct a <tt>SocketHandler</tt> using a specified host and port. *
*** 144,156 **** * @throws IllegalArgumentException if the host or port are invalid. * @throws IOException if we are unable to connect to the target * host and port. */ public SocketHandler(String host, int port) throws IOException { ! sealed = false; ! configure(); ! sealed = true; this.port = port; this.host = host; connect(); } --- 147,157 ---- * @throws IllegalArgumentException if the host or port are invalid. * @throws IOException if we are unable to connect to the target * host and port. */ public SocketHandler(String host, int port) throws IOException { ! doWithControlPermission(this::configure); this.port = port; this.host = host; connect(); }