修复问题

This commit is contained in:
junj2.liang 2022-09-02 10:36:19 +08:00
parent 18843fc99b
commit 598dffcc5d
4 changed files with 24 additions and 11 deletions

View File

@ -10,6 +10,7 @@ import com.sunyard.util.SYMUtil;
import org.apache.logging.log4j.Logger;
import racal.sunyard.main.SydApi4j;
import javax.annotation.CheckForNull;
import java.util.Arrays;
import java.util.List;
@ -131,7 +132,7 @@ public class SydApi4Database implements SydApi {
if (null == this.hsms || this.hsms.length < 1) {
throw new SydApiException(-1);
}
@CheckForNull
SydApiException le = null;
updateLastUseTime();
@ -190,6 +191,7 @@ public class SydApi4Database implements SydApi {
log.debug("Util.hexString2Bytes方法返回值{}", Arrays.toString(procData));
}
@CheckForNull
SydApiException le = null;
updateLastUseTime();
for (SydApi4j api : this.hsms) {
@ -252,6 +254,7 @@ public class SydApi4Database implements SydApi {
updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex);
@CheckForNull
SydApiException le = null;
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -332,7 +335,7 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
}
@CheckForNull
SydApiException le = null;
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -391,7 +394,7 @@ public class SydApi4Database implements SydApi {
}
updateLastUseTime();
String keyIndex = String.format("%08d", iKeyIndex);
@CheckForNull
SydApiException le = null;
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -443,6 +446,9 @@ public class SydApi4Database implements SydApi {
}
} catch (SydApiException e) {
if (null==e){
}
le = e;
if (e.getRetCode() < 0) {
log.error("HA 重试");
@ -453,6 +459,7 @@ public class SydApi4Database implements SydApi {
}
}
}
throw le;
}
@ -471,6 +478,7 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
}
@CheckForNull
SydApiException le = null;
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -538,6 +546,7 @@ public class SydApi4Database implements SydApi {
for (int i = 0; i < iKeyIndex.length; i++) {
keys[i] = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex[i]));
}
@CheckForNull
SydApiException le = null;
for (SydApi4j api : this.hsms) {
if (null == api) {
@ -608,7 +617,7 @@ public class SydApi4Database implements SydApi {
if (Consts.PkgNumAll != iPkgNum && Consts.PkgNumHead != iPkgNum) {
iv = pcProcData.getBytes();
}
@CheckForNull
SydApiException le = null;
updateLastUseTime();
for (SydApi4j api : this.hsms) {
@ -707,6 +716,7 @@ public class SydApi4Database implements SydApi {
}
String keyIndex = "SK" + SYMUtil.genPrivateKeyMark("000000", "00A", String.format("%08d", iKeyIndex));
log.debug("\"SK\" + SYMUtil.genPrivateKeyMark方法返回值{}", keyIndex);
@CheckForNull
SydApiException le = null;
updateLastUseTime();
for (SydApi4j api : this.hsms) {

View File

@ -33,13 +33,16 @@ public class HsmLinkInfo {
log.debug("mutiHsmLinkInfo方法接收参数:pcIpList:{},iPortList:{},iConnectTimeOut:{},iDealTimeOut:{}", Arrays.toString(pcIpList),Arrays.toString(iPortList),iConnectTimeOut,iAllDealTimeOut);
log.debug("链接参数整理");
if (null == pcIpList &&
null == iPortList &&
pcIpList.length != iPortList.length) {
if (null == pcIpList ||
null == iPortList
) {
log.error("ip 和 port 为空");
throw new IllegalArgumentException("入参错误");
}
if ( pcIpList.length != iPortList.length){
log.error("加密机配置 ip 和 port 数量错误");
throw new IllegalArgumentException("入参错误");
}
if ( iAllDealTimeOut < pcIpList.length) {
log.error("加密机配置交易时间过短");
throw new IllegalArgumentException("入参错误");

View File

@ -36,7 +36,7 @@ public class LogFactory {
public static String pcLogPath = "./sydapi-logs/";
// 日期格式
private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
public static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private LogFactory() {
}

View File

@ -3,10 +3,10 @@ package com.sunyard.sge.pool;
public class PoolConfig {
// 最大空闲时间
private long maxIdle = 5 * 60 ; // 5 分钟
private long maxIdle = 5L * 60L ; // 5 分钟
// 最大无用时间
private long maxUseless = 30 * 60 ; // 30 分钟
private long maxUseless = 30L * 60L ; // 30 分钟
public long getMaxIdle() {
return maxIdle;