Skip to content

Commit 306aeed

Browse files
committed
Update SDK to use XMLInputFactory.newInstance()
1 parent d42cd58 commit 306aeed

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

dist/CHANGES.txt CHANGES.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
Version 3.0.1 - March 2017
2+
- Updated XMLInputFactory.newFactory() to XMLInputFactory.newInstance() to support both IBM JDK and Oracle JDK.
3+
- Updated README file as per the changes listed - https://github.com/amzn/amazon-pay-sdk-java/pull/13
4+
- Updated thread sleep wait time constants to take milliseconds.
5+
16
Version 3.0.0 - March 2017
27
- Pay with Amazon has become Amazon Pay.
3-
We've changed our name, but you can still rely on us as a trusted and familiar payment solution. It's simpler, modern and universal?enabling us to create more connected experiences across diverse settings and devices.
8+
We've changed our name, but you can still rely on us as a trusted and familiar payment solution. It's simpler, modern and universalenabling us to create more connected experiences across diverse settings and devices.
49
https://pages.payments.amazon.com/Amazon_Pay_Rebrand_Landing_Page_US.html
510
- User-Agent header modified to adhere to standards
611

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Requirements
44

5-
* Amazon Pay - [Register here](https://payments.amazon.com/signup)
5+
* Amazon Pay - [Register here](https://pay.amazon.com/signup)
66
* Java 1.6 or higher *(including JCE Java Cryptography Extension)*
77
* Apache Commons Logging 1.2 *(or JCL-over-SLF4J drop in replacement)*
88
* Apache Commons Codec 1.10
@@ -159,7 +159,7 @@ client.closeOrderReference("AMAZON_ORDER_REFERENCE_ID");
159159

160160
```
161161

162-
### Subscriptions/Recurring Payments API Flow
162+
### Subscriptions/Recurring Payments API Flow
163163

164164
```java
165165
String merchantId = "YOUR_MERCHANT_ID";
@@ -327,10 +327,10 @@ user.getUserId();
327327
Below are the steps to turn on the logging feature for your project.
328328

329329
- Select a logging framework to use for your project.
330-
- Set the Logger instance 'log' in PaymentsLogUtil to the value of the logging framework.
330+
- Set the Logger instance 'log' in PayLogUtil to the value of the logging framework.
331331

332332
```java
333-
private static Logger log = Logger.getLogger(PaymentsLogUtil.class);
333+
private static Logger log = Logger.getLogger(PayLogUtil.class);
334334
```
335335
- logMessage is called from 3 different places
336336
* NotificationFactory.java that logs Headers and Notification Body
@@ -401,4 +401,4 @@ if (paymentDescriptor != null) {
401401
log.info("Instrument Name = " + paymentDescriptor.getName());
402402
log.info("Instrument Tail = " + paymentDescriptor.getAccountNumberTail());
403403
log.info("Use Amazon Balance First = " + paymentDescriptor.isUseAmazonBalanceFirst());
404-
}
404+
}
Binary file not shown.

pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.amazon.pay</groupId>
55
<artifactId>amazon-pay</artifactId>
66
<packaging>jar</packaging>
7-
<version>3.0.0</version>
7+
<version>3.0.1</version>
88
<dependencies>
99
<dependency>
1010
<groupId>com.sun.xml.bind</groupId>
@@ -67,4 +67,4 @@
6767
</plugin>
6868
</plugins>
6969
</build>
70-
</project>
70+
</project>

src/com/amazon/pay/impl/Util.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static ResponseData httpSendRequest(String method, String url, String url
143143

144144
userAgent.append("Java/" + JAVA_VERSION + "; " + OS_NAME + "/" + OS_VERSION + ")");
145145
headerMap.put("User-Agent", userAgent.toString());
146-
146+
147147
if (config.getProxyHost() != null) {
148148
Properties systemSettings = System.getProperties();
149149
systemSettings.put("proxySet", "true");

src/com/amazon/pay/impl/ipn/NotificationFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static Notification getNotification(String payLoad) {
153153
// XML parsing/unmarshalling issues, consider uncommenting the next line:
154154
// unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
155155

156-
XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
156+
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
157157
xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
158158
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
159159
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader);

src/com/amazon/pay/response/parser/Parser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static <T> T marshalXML(Class<T> clazz, ResponseData rawResponse) throws
185185
// XML parsing/unmarshalling issues, consider uncommenting the next line:
186186
// unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
187187

188-
XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
188+
XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
189189
xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
190190
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
191191
XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(reader);

src/com/amazon/pay/types/ServiceConstants.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ public class ServiceConstants {
115115
public static final String VALIDATE_BILLING_AGREEMENT_DETAILS = "ValidateBillingAgreement";
116116

117117
// SDK version
118-
public static final String APPLICATION_LIBRARY_VERSION = "3.0.0";
118+
public static final String APPLICATION_LIBRARY_VERSION = "3.0.1";
119119
public static final String GITHUB_SDK_NAME = "amazon-pay-sdk-java";
120120

121-
// Exponential backoff wait times (seconds) for retry operations
122-
public static final int FIRST_RETRY_WAIT_TIME = 1;
123-
public static final int SECOND_RETRY_WAIT_TIME = 4;
124-
public static final int THIRD_RETRY_WAIT_TIME = 10;
121+
// Exponential backoff wait times (milliseconds) for retry operations
122+
public static final int FIRST_RETRY_WAIT_TIME = 1000;
123+
public static final int SECOND_RETRY_WAIT_TIME = 4000;
124+
public static final int THIRD_RETRY_WAIT_TIME = 10000;
125125

126126
static {
127127
Map<Region, String> mwsEndpointMappingsMap = new HashMap<Region,String>();

tst/.gitkeep

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Feel free to delete this file as soon as actual Java code is added to this directory.

0 commit comments

Comments
 (0)