使用try-with-resources
阿新 • • 發佈:2018-12-18
原始碼:
編譯後:
import java.io.IOException; import java.net.ServerSocket; public class RpcServer { public void publisher(Object paramObject, int paramInt) { ServerSocket localServerSocket; try { localServerSocket = new ServerSocket(paramInt); Object localObject = null; if (localServerSocket != null) if (localObject != null) try { localServerSocket.close(); } catch (Throwable localThrowable) { localObject.addSuppressed(localThrowable); } else localServerSocket.close(); } catch (IOException localIOException) { localIOException.printStackTrace(); } } }
參考資料: