private static boolean secureSaveAuthentication(URL url, String postBody)
			throws IOException {
		SSLSocketFactory sslsocketfactory = SecureWebConnections
				.getFullTrustSSLFactory();

		int port = url.getPort() == -1 ? 443 : url.getPort();

		SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(
				url.getHost(), port);
		String[] protocols = { "TLSv1" };
		sslsocket.setEnabledProtocols(protocols);

		OutputStream outputstream = sslsocket.getOutputStream();
		// CAUSE: Reliance on default encoding
		OutputStreamWriter outputstreamwriter = new OutputStreamWriter(
				outputstream, "UTF-8");
		BufferedWriter bufferedwriter = new BufferedWriter(outputstreamwriter);

		// CAUSE: Reliance on default encoding
		BufferedReader stdIn = new BufferedReader(new InputStreamReader(
				sslsocket.getInputStream(), "UTF-8"));

		String request = String.format("POST %s HTTP/1.1\r\n", url.getPath())
				+ "User-Agent: OrtcJavaApi\r\n" + "Connection: keep-alive\r\n"
				+ "Content-Length: " + postBody.length() + "\r\n"
				+ "Content-Type: application/x-www-form-urlencoded\r\n"
				+ "\r\n" + postBody + "\r\n\r\n";

		bufferedwriter.write(request);
		bufferedwriter.flush();

		String reply = stdIn.readLine();
		boolean isAuthenticated = false;
		// CAUSE: Assignment expressions nested inside other expressions
		while (!isAuthenticated && reply != null) {
			isAuthenticated = reply.contains("HTTP/1.1 201");
			reply = stdIn.readLine();
		}

		outputstream.close();
		stdIn.close();
		sslsocket.close();

		return isAuthenticated;
	}
private static boolean secureSaveAuthentication ( URL url , String postBody ) throws IOException { SSLSocketFactory sslsocketfactory = SecureWebConnections . getFullTrustSSLFactory ( ) ; int port = url . getPort ( ) == - 1 ? 443 : url . getPort ( ) ; SSLSocket sslsocket = ( SSLSocket ) sslsocketfactory . createSocket ( url . getHost ( ) , port ) ; String [ ] protocols = { "TLSv1" } ; sslsocket . setEnabledProtocols ( protocols ) ; OutputStream outputstream = sslsocket . getOutputStream ( ) ; OutputStreamWriter outputstreamwriter = new OutputStreamWriter ( outputstream , "UTF-8" ) ; BufferedWriter bufferedwriter = new BufferedWriter ( outputstreamwriter ) ; BufferedReader stdIn = new BufferedReader ( new InputStreamReader ( sslsocket . getInputStream ( ) , "UTF-8" ) ) ; String request = String . format ( "POST %s HTTP/1.1\r\n" , url . getPath ( ) ) + "User-Agent: OrtcJavaApi\r\n" + "Connection: keep-alive\r\n" + "Content-Length: " + postBody . length ( ) + "\r\n" + "Content-Type: application/x-www-form-urlencoded\r\n" + "\r\n" + postBody + "\r\n\r\n" ; bufferedwriter . write ( request ) ; bufferedwriter . flush ( ) ; String reply = stdIn . readLine ( ) ; boolean isAuthenticated = false ; while ( ! isAuthenticated && reply != null ) { isAuthenticated = reply . contains ( "HTTP/1.1 201" ) ; reply = stdIn . readLine ( ) ; } outputstream . close ( ) ; stdIn . close ( ) ; sslsocket . close ( ) ; return isAuthenticated ; }
Exception