Skip to content

Commit cbeceb8

Browse files
committed
merge conflict fixed
2 parents b59b9e0 + 3ed9f56 commit cbeceb8

File tree

15 files changed

+29
-324
lines changed

15 files changed

+29
-324
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: java
2-
"dist": "precise"
32
jdk:
4-
- oraclejdk8
53
- oraclejdk7
64
- openjdk7
7-
- openjdk6
5+
- openjdk6

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Unix or Linux: runSample.sh <service_name>
110110
## JKS creation
111111

112112
- To convert the p12 file to JKS follow the steps mentioned below.
113-
- These commands will take out all the certs from the p12 file. 
113+
- These commands will take out all the certs from the p12 file.
114114
1. `openssl pkcs12 -in <Merchant_ID>.p12 -nocerts -out <Merchant_ID>.key`
115115
2. `openssl pkcs12 -in <Merchant_ID>.p12 -clcerts -nokeys -out <Merchant_ID>.crt`
116116
3. `openssl pkcs12 -in <Merchant_ID>.p12 -cacerts -nokeys -out CyberSourceCertAuth.crt`
@@ -224,3 +224,4 @@ _______________________________
224224
- For more information about CyberSource services, see <http://www.cybersource.com/developers/documentation>.
225225
- For all other support needs, see <http://www.cybersource.com/support>.
226226

227+

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

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.io.FileInputStream;
3535
import java.io.IOException;
3636
import java.io.StringReader;
37-
import java.lang.reflect.InvocationTargetException;
3837
import java.security.KeyStore;
3938
import java.security.cert.PKIXParameters;
4039
import java.security.cert.TrustAnchor;
@@ -91,16 +90,14 @@ public static Map runTransaction(Map<String,String> request, Properties props)
9190
* @throws FaultException if a fault occurs.
9291
* @throws ClientException if any other exception occurs.
9392
*/
94-
@SuppressWarnings("unchecked")
95-
public static Map runTransaction(
93+
public static Map runTransaction(
9694
Map<String, String> request, Properties props,
9795
Logger _logger, boolean prepare, boolean logTranStart)
9896
throws FaultException, ClientException {
9997
MerchantConfig mc;
10098
LoggerWrapper logger = null;
10199
Connection con = null;
102100

103-
104101
try {
105102
setVersionInformation(request);
106103

@@ -125,39 +122,8 @@ public static Map runTransaction(
125122
// FileWriter writer = new FileWriter(new File("signedDoc.xml"));
126123
// writer.write(XMLUtils.PrettyDocumentToString(signedDoc));
127124
// writer.close();
128-
if(mc.isCustomHttpClassEnabled()){
129-
Class<Connection> customConnectionClass;
130-
try {
131-
customConnectionClass = (Class<Connection>) Class.forName(mc.getcustomHttpClass());
132-
Class[] constructor_Args = new Class[] {com.cybersource.ws.client.MerchantConfig.class, javax.xml.parsers.DocumentBuilder.class, com.cybersource.ws.client.LoggerWrapper.class};
133-
con=customConnectionClass.getDeclaredConstructor(constructor_Args).newInstance(mc, builder, logger);
134-
135-
} catch (InstantiationException e) {
136-
logger.log(Logger.LT_INFO, "Failed to Instantiate the class "+e);
137-
throw new ClientException(e, false, null);
138-
} catch (IllegalAccessException e) {
139-
logger.log(Logger.LT_INFO, "Could not Access the method invoked "+e);
140-
throw new ClientException(e, false, null);
141-
} catch (ClassNotFoundException e) {
142-
logger.log(Logger.LT_INFO, "Could not load the custom HTTP class ");
143-
throw new ClientException(e, false, null);
144-
} catch (IllegalArgumentException e) {
145-
logger.log(Logger.LT_INFO, "Method invoked with Illegal Argument list "+e);
146-
throw new ClientException(e, false, null);
147-
} catch (SecurityException e) {
148-
logger.log(Logger.LT_INFO, "Security Exception "+e);
149-
throw new ClientException(e, false, null);
150-
} catch (InvocationTargetException e) {
151-
logger.log(Logger.LT_INFO, "Exception occured while calling the method "+e);
152-
throw new ClientException(e, false, null);
153-
} catch (NoSuchMethodException e) {
154-
logger.log(Logger.LT_INFO, "Method not found ");
155-
throw new ClientException(e, false, null);
156-
}
157-
}
158-
else{
159-
con = Connection.getInstance(mc, builder, logger);
160-
}
125+
126+
con = Connection.getInstance(mc, builder, logger);
161127
Document wrappedReply = con.post(signedDoc);
162128
Map<String, String> replyMap = soapUnwrap(wrappedReply, mc, logger);
163129
logger.log(Logger.LT_INFO, "Client, End of runTransaction Call ",false);

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,8 @@ abstract class Connection {
4747
final MerchantConfig mc;
4848
private final DocumentBuilder builder;
4949
final LoggerWrapper logger;
50-
51-
/**
52-
* It initializes three arguments MerchantConfig, DocumentBuilder and Logger
53-
* Any class extending this class must implement three argument constructor
54-
* @param mc
55-
* @param builder
56-
* @param logger
57-
*/
58-
protected Connection(MerchantConfig mc, DocumentBuilder builder,
50+
51+
Connection(MerchantConfig mc, DocumentBuilder builder,
5952
LoggerWrapper logger) {
6053
this.mc = mc;
6154
this.builder = builder;

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,7 @@ void postDocument(Document request)
6060
throws IOException, TransformerConfigurationException,
6161
TransformerException, MalformedURLException,
6262
ProtocolException {
63-
64-
/*
65-
* SimpleHttpConnectionManager(boolean alwaysClose) :
66-
* alwaysClose - if set true, the connection manager will always close connections upon release.
67-
*/
68-
69-
HttpClient httpClient = new HttpClient(new SimpleHttpConnectionManager(true));
63+
HttpClient httpClient = new HttpClient();
7064
setTimeout(httpClient, mc.getTimeout() * 1000);
7165
setProxy(httpClient);
7266

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ public class MerchantConfig {
6464
private String proxyUser;
6565
private String proxyPassword;
6666
private String cacertPassword;
67-
private String customHttpClass;
68-
private boolean customHttpClassEnabled;
67+
private String useClientHttpFactory;
68+
private boolean useClientHttpFactoryFlag;
6969

70-
public String getcustomHttpClass() {
71-
return customHttpClass;
70+
public String getUseClientHttpFactory() {
71+
return useClientHttpFactory;
7272
}
73-
public boolean isCustomHttpClassEnabled() {
74-
return customHttpClassEnabled;
73+
public boolean getUseClientHttpFactoryFlag() {
74+
return useClientHttpFactoryFlag;
7575
}
7676
// computed values
7777
private String effectiveServerURL;
@@ -261,7 +261,7 @@ public MerchantConfig(Properties _props, String _merchantID)
261261
logFilename = getProperty(merchantID, "logFilename");
262262
logMaximumSize = getIntegerProperty(merchantID, "logMaximumSize", 10);
263263
useHttpClient = getBooleanProperty(merchantID, "useHttpClient", ConnectionHelper.getDefaultUseHttpClient());
264-
customHttpClass = getProperty(merchantID, "customHttpClass");
264+
useClientHttpFactory = getProperty(merchantID, "useClientHttpFactory");
265265
timeout = getIntegerProperty(merchantID, "timeout", DEFAULT_TIMEOUT);
266266
proxyHost = getProperty(merchantID, "proxyHost");
267267
proxyPort = getIntegerProperty(merchantID, "proxyPort", DEFAULT_PROXY_PORT);
@@ -270,7 +270,7 @@ public MerchantConfig(Properties _props, String _merchantID)
270270
enableJdkCert = getBooleanProperty(merchantID, "enableJdkCert", false);
271271
enableCacert=getBooleanProperty(merchantID, "enableCacert", false);
272272
cacertPassword=getProperty(merchantID,"cacertPassword","changeit");
273-
customHttpClassEnabled=getBooleanProperty(merchantID,"customHttpClassEnabled",false);
273+
useClientHttpFactoryFlag=getBooleanProperty(merchantID,"useClientHttpFactoryFlag",false);
274274
// compute and store effective namespace URI
275275

276276
if (namespaceURI == null && targetAPIVersion == null) {
@@ -473,8 +473,8 @@ public String getLogString() {
473473
appendPair(sb, "logDirectory", logDirectory);
474474
appendPair(sb, "logFilename", logFilename);
475475
appendPair(sb, "logMaximumSize", logMaximumSize);
476-
appendPair(sb, "customHttpClass", customHttpClass);
477-
appendPair(sb, "customHttpClassEnabled", customHttpClassEnabled);
476+
appendPair(sb, "useClientHttpFactory", useClientHttpFactory);
477+
appendPair(sb, "useClientHttpFactoryFlag", useClientHttpFactoryFlag);
478478
appendPair(sb, "useHttpClient", useHttpClient);
479479
appendPair(sb, "enableJdkCert", enableJdkCert);
480480
appendPair(sb, "enableCacert", enableCacert);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private Utility() {
4848
/**
4949
* Version number of this release.
5050
*/
51-
public static final String VERSION = "6.2.5";
51+
public static final String VERSION = "6.2.3";
5252

5353
/**
5454
* If in the Request map, a key called "_has_escapes" is present and is set

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

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.io.ByteArrayOutputStream;
3636
import java.io.IOException;
3737
import java.io.StringReader;
38-
import java.lang.reflect.InvocationTargetException;
3938
import java.util.Properties;
4039

4140
/**
@@ -65,8 +64,7 @@ public class XMLClient {
6564

6665
private static Document soapEnvelope;
6766
private static Exception initException = null;
68-
69-
67+
7068
static {
7169
try {
7270
// load the SOAP envelope document.
@@ -139,8 +137,7 @@ public static Document runTransaction(Document request, Properties props)
139137
* @throws FaultException if a fault occurs.
140138
* @throws ClientException if any other exception occurs.
141139
*/
142-
@SuppressWarnings("unchecked")
143-
public static Document runTransaction(
140+
public static Document runTransaction(
144141
Document request, Properties props,
145142
Logger _logger, boolean prepare, boolean logTranStart)
146143
throws FaultException, ClientException {
@@ -180,39 +177,8 @@ public static Document runTransaction(
180177

181178
Document signedDoc
182179
= soapWrapAndSign(request, mc, builder, logger);
183-
if(mc.isCustomHttpClassEnabled()){
184-
Class<Connection> customConnectionClass;
185-
try {
186-
customConnectionClass = (Class<Connection>) Class.forName(mc.getcustomHttpClass());
187-
Class[] constructor_Args = new Class[] {com.cybersource.ws.client.MerchantConfig.class, javax.xml.parsers.DocumentBuilder.class, com.cybersource.ws.client.LoggerWrapper.class};
188-
con=customConnectionClass.getDeclaredConstructor(constructor_Args).newInstance(mc, builder, logger);
189-
190-
} catch (InstantiationException e) {
191-
logger.log(Logger.LT_INFO, "Failed to Instantiate the class "+e);
192-
throw new ClientException(e, false, null);
193-
} catch (IllegalAccessException e) {
194-
logger.log(Logger.LT_INFO, "Could not Access the method invoked "+e);
195-
throw new ClientException(e, false, null);
196-
} catch (ClassNotFoundException e) {
197-
logger.log(Logger.LT_INFO, "Could not load the custom HTTP class ");
198-
throw new ClientException(e, false, null);
199-
} catch (IllegalArgumentException e) {
200-
logger.log(Logger.LT_INFO, "Method invoked with Illegal Argument list "+e);
201-
throw new ClientException(e, false, null);
202-
} catch (SecurityException e) {
203-
logger.log(Logger.LT_INFO, "Security Exception "+e);
204-
throw new ClientException(e, false, null);
205-
} catch (InvocationTargetException e) {
206-
logger.log(Logger.LT_INFO, "Exception occured while calling the method "+e);
207-
throw new ClientException(e, false, null);
208-
} catch (NoSuchMethodException e) {
209-
logger.log(Logger.LT_INFO, "Method not found ");
210-
throw new ClientException(e, false, null);
211-
}
212-
}
213-
else{
214-
con = Connection.getInstance(mc, builder, logger);
215-
}
180+
181+
con = Connection.getInstance(mc, builder, logger);
216182
Document wrappedReply = con.post(signedDoc);
217183

218184
Document doc = soapUnwrap(wrappedReply, mc, builder, logger);

java/src/main/resources/cybs.properties

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ sendToAkamai=true
1717

1818
#To use your own Http library set useClientHttpFactoryFlag to true
1919
# set useClientHttpFactory field with the class name which has Http implementation
20-
#useClientHttpFactory=
21-
#useClientHttpFactoryFlag=false
20+
#useClientHttpFactory=AmazonHttpConnection
21+
#useClientHttpFactoryFlag=true
2222

2323
#useHttpClient=false
2424

@@ -32,12 +32,6 @@ allowRetry=true
3232
numberOfRetries=5
3333
retryInterval=5
3434

35-
36-
#To use your own Http library set customHttpClassEnabled to true
37-
# set customHttpClass field with the class name which has Http implementation. Provide the full class with package name.
38-
#customHttpClassEnabled=
39-
#customHttpClass=
40-
4135
# If This property is set to true then the p12 certificate must be stored in JKS format
4236
# program will read it from there. If it is set to false then the certificate will be read from
4337
# the location specified above from the key directory location

0 commit comments

Comments
 (0)