Skip to content

Commit 1841809

Browse files
committed
removed logger object refrenc from identity class
1 parent 36f1699 commit 1841809

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

java/src/main/java/com/cybersource/ws/client/Identity.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ public class Identity {
4343

4444
private char[] pswd;
4545

46-
private Logger logger;
47-
4846
/**
4947
* Creates an Identity instance.this type of the instance can
5048
* only be used to store server certificate identity.
@@ -56,8 +54,6 @@ public class Identity {
5654
public Identity(MerchantConfig merchantConfig,X509Certificate x509Certificate,Logger logger) throws SignException {
5755
this.merchantConfig = merchantConfig;
5856
this.x509Cert=x509Certificate;
59-
this.logger=logger;
60-
6157
if(merchantConfig.isJdkCertEnabled() || merchantConfig.isCacertEnabled()){
6258
setupJdkServerCerts();
6359
}
@@ -97,16 +93,13 @@ else if (subjectDNrray.length == 2 && subjectDNrray[1].contains(SERVER_ALIAS)) {
9793
* @param privateKey
9894
* @throws SignException
9995
*/
100-
public Identity(MerchantConfig merchantConfig,X509Certificate x509Certificate, PrivateKey privateKey,Logger logger) throws SignException {
96+
public Identity(MerchantConfig merchantConfig,X509Certificate x509Certificate, PrivateKey privateKey, Logger logger) throws SignException {
10197
this.merchantConfig = merchantConfig;
10298
this.x509Cert = x509Certificate;
10399
this.privateKey = privateKey;
104-
this.logger=logger;
105-
106100
try {
107101
this.lastModifiedDate=merchantConfig.getKeyFile().lastModified();
108102
} catch (ConfigException e) {
109-
110103
logger.log(Logger.LT_EXCEPTION,
111104
"Identity object ,cannot instantiate with key file lastModifiedDate. "
112105
+ e.getMessage());
@@ -120,7 +113,7 @@ public Identity(MerchantConfig merchantConfig,X509Certificate x509Certificate, P
120113
* else isValid method will return true and certificate reload will not occur.
121114
*/
122115

123-
public boolean isValid(File keyFile) {
116+
public boolean isValid(File keyFile, Logger logger) {
124117
boolean changeKeyFileStatus=(this.lastModifiedDate == keyFile.lastModified());
125118
if (!changeKeyFileStatus) {
126119
logger.log(Logger.LT_INFO, "Key file changed");

java/src/main/java/com/cybersource/ws/client/SecurityUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private static void initKeystore() throws KeyStoreException, CredentialException
7777
public static void loadMerchantP12File(MerchantConfig merchantConfig, Logger logger) throws SignException, SignEncryptException, ConfigException {
7878

7979
Identity identity=identities.get(merchantConfig.getKeyAlias());
80-
if(!merchantConfig.isCertificateCacheEnabled() || identity == null || !(identity.isValid(merchantConfig.getKeyFile()))){
80+
if(!merchantConfig.isCertificateCacheEnabled() || identity == null || !(identity.isValid(merchantConfig.getKeyFile(), logger))){
8181
try {
8282
if (localKeyStoreHandler == null)
8383
initKeystore();

0 commit comments

Comments
 (0)