Skip to content

Commit 716300f

Browse files
committed
GAE changes: SDK 1.4.0 support, increase timeout to 55 seconds.
1 parent 79aa721 commit 716300f

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ Add this dependency to your project's POM:
1717
<dependency>
1818
<groupId>com.stripe</groupId>
1919
<artifactId>stripe-java</artifactId>
20-
<version>1.0.5</version>
20+
<version>1.0.6</version>
2121
</dependency>
2222

2323
### Others
2424

2525
You'll need to manually install the following JARs:
2626

27-
* The Stripe JAR from https://code.stripe.com/stripe-java-1.0.5.jar
27+
* The Stripe JAR from https://code.stripe.com/stripe-java-1.0.6.jar
2828
* [Google Gson](http://code.google.com/p/google-gson/) from <http://google-gson.googlecode.com/files/google-gson-1.7.1-release.zip>.
2929

3030
Usage

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.5
1+
1.0.6

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.stripe</groupId>
55
<artifactId>stripe-java</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.0.5</version>
7+
<version>1.0.6</version>
88
<name>stripe-java</name>
99
<url>https://github.com/stripe/stripe-java</url>
1010
<dependencies>

src/main/java/com/stripe/Stripe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
public abstract class Stripe
44
{
55
public static final String API_BASE = "https://api.stripe.com/v1";
6-
public static final String VERSION = "1.0.5";
6+
public static final String VERSION = "1.0.6";
77
public static String apiKey;
88
}

src/main/java/com/stripe/net/APIResource.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,22 @@ private static StripeResponse makeAppEngineRequest(RequestMethod method,
251251
Object httpMethod = requestMethodClass.getDeclaredField(method.name()).get(null);
252252

253253
Class<?> fetchOptionsBuilderClass = Class.forName("com.google.appengine.api.urlfetch.FetchOptions$Builder");
254-
Object fetchOptions = fetchOptionsBuilderClass.getDeclaredMethod("validateCertificate").invoke(null);
254+
Object fetchOptions = null;
255+
try {
256+
fetchOptions = fetchOptionsBuilderClass.getDeclaredMethod("validateCertificate").invoke(null);
257+
} catch (NoSuchMethodException e) {
258+
System.err.println("Warning: this App Engine SDK version does not allow verification of SSL certificates;" +
259+
"this exposes you to a MITM attack. Please upgrade your App Engine SDK to >=1.5.0. " +
260+
"If you have questions, contact support@stripe.com.");
261+
fetchOptions = fetchOptionsBuilderClass.getDeclaredMethod("withDefaults").invoke(null);
262+
}
263+
255264

256265
Class<?> fetchOptionsClass = Class.forName("com.google.appengine.api.urlfetch.FetchOptions");
266+
267+
// GAE requests can time out after 60 seconds, so make sure we leave
268+
// some time for the application to handle a slow Stripe
269+
fetchOptionsClass.getDeclaredMethod("setDeadline", java.lang.Double.class).invoke(fetchOptions, new Double(55));
257270

258271
Class<?> requestClass = Class.forName("com.google.appengine.api.urlfetch.HTTPRequest");
259272

0 commit comments

Comments
 (0)