提交 739c0427 authored 作者: 姜武杰's avatar 姜武杰

增加日志看是否可以正常进入方法

上级 012ec802
package com.openapi.sdk.util; package com.openapi.sdk.util;
import lombok.extern.slf4j.Slf4j;
import javax.net.ssl.*; import javax.net.ssl.*;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -10,11 +12,13 @@ import java.security.SecureRandom; ...@@ -10,11 +12,13 @@ import java.security.SecureRandom;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
@Slf4j
public class HttpsUtils { public class HttpsUtils {
public HttpsUtils() { public HttpsUtils() {
} }
public static String doPost(String url, int connentTimeout, int readTimeout) throws Exception { public static String doPost(String url, int connentTimeout, int readTimeout) throws Exception {
log.info("========>进入自定义HttpsUtils.doPost1方法");
HttpURLConnection conn = null; HttpURLConnection conn = null;
InputStreamReader isReader = null; InputStreamReader isReader = null;
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
...@@ -54,6 +58,14 @@ public class HttpsUtils { ...@@ -54,6 +58,14 @@ public class HttpsUtils {
System.err.println("关闭数据流出错了!\n" + var16.getMessage() + "\n"); System.err.println("关闭数据流出错了!\n" + var16.getMessage() + "\n");
throw var16; throw var16;
} }
try {
if (conn != null) {
conn.disconnect();
}
} catch (Exception var19) {
System.err.println("关闭连接出错了!\n" + var19.getMessage() + "\n");
throw var19;
}
} }
...@@ -61,6 +73,7 @@ public class HttpsUtils { ...@@ -61,6 +73,7 @@ public class HttpsUtils {
} }
public static String doPost(String url, String param, int readTimeout, int connectTimeout) throws Exception { public static String doPost(String url, String param, int readTimeout, int connectTimeout) throws Exception {
log.info("========>进入自定义HttpsUtils.doPost2方法");
InputStreamReader isReader = null; InputStreamReader isReader = null;
HttpURLConnection conn = null; HttpURLConnection conn = null;
DataOutputStream dos = null; DataOutputStream dos = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论