Changeset 11312 in josm for trunk/src


Ignore:
Timestamp:
2016-11-26T00:18:56+01:00 (8 years ago)
Author:
Don-vip
Message:

findbugs - OS_OPEN_STREAM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java

    r11100 r11312  
    66import java.io.IOException;
    77import java.io.InputStream;
     8import java.io.OutputStream;
    89import java.math.BigInteger;
    910import java.net.ServerSocket;
     
    237238
    238239            ks.setKeyEntry(ENTRY_ALIAS, pair.getPrivate(), entryPassword, new Certificate[]{cert});
    239             ks.store(Files.newOutputStream(path, StandardOpenOption.CREATE), storePassword);
     240            try (OutputStream out = Files.newOutputStream(path, StandardOpenOption.CREATE)) {
     241                ks.store(out, storePassword);
     242            }
    240243        }
    241244        return path;
     
    381384            RemoteControl.getInet6Address() : RemoteControl.getInet4Address());
    382385
    383         if (Main.isTraceEnabled()) {
    384             if (server instanceof SSLServerSocket) {
    385                 SSLServerSocket sslServer = (SSLServerSocket) server;
    386                 Main.trace("SSL server - Enabled Cipher suites: "+Arrays.toString(sslServer.getEnabledCipherSuites()));
    387                 Main.trace("SSL server - Enabled Protocols: "+Arrays.toString(sslServer.getEnabledProtocols()));
    388                 Main.trace("SSL server - Enable Session Creation: "+sslServer.getEnableSessionCreation());
    389                 Main.trace("SSL server - Need Client Auth: "+sslServer.getNeedClientAuth());
    390                 Main.trace("SSL server - Want Client Auth: "+sslServer.getWantClientAuth());
    391                 Main.trace("SSL server - Use Client Mode: "+sslServer.getUseClientMode());
    392             }
     386        if (Main.isTraceEnabled() && server instanceof SSLServerSocket) {
     387            SSLServerSocket sslServer = (SSLServerSocket) server;
     388            Main.trace("SSL server - Enabled Cipher suites: "+Arrays.toString(sslServer.getEnabledCipherSuites()));
     389            Main.trace("SSL server - Enabled Protocols: "+Arrays.toString(sslServer.getEnabledProtocols()));
     390            Main.trace("SSL server - Enable Session Creation: "+sslServer.getEnableSessionCreation());
     391            Main.trace("SSL server - Need Client Auth: "+sslServer.getNeedClientAuth());
     392            Main.trace("SSL server - Want Client Auth: "+sslServer.getWantClientAuth());
     393            Main.trace("SSL server - Use Client Mode: "+sslServer.getUseClientMode());
    393394        }
    394395    }
Note: See TracChangeset for help on using the changeset viewer.