Skip to content

Commit

Permalink
GAE changes: SDK 1.4.0 support, increase timeout to 55 seconds.
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag committed Nov 23, 2011
1 parent 79aa721 commit 716300f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</dependency>

### Others

You'll need to manually install the following JARs:

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

Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.5
1.0.6
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<packaging>jar</packaging>
<version>1.0.5</version>
<version>1.0.6</version>
<name>stripe-java</name>
<url>https://github.com/stripe/stripe-java</url>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/stripe/Stripe.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
public abstract class Stripe
{
public static final String API_BASE = "https://api.stripe.com/v1";
public static final String VERSION = "1.0.5";
public static final String VERSION = "1.0.6";
public static String apiKey;
}
15 changes: 14 additions & 1 deletion src/main/java/com/stripe/net/APIResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,22 @@ private static StripeResponse makeAppEngineRequest(RequestMethod method,
Object httpMethod = requestMethodClass.getDeclaredField(method.name()).get(null);

Class<?> fetchOptionsBuilderClass = Class.forName("com.google.appengine.api.urlfetch.FetchOptions$Builder");
Object fetchOptions = fetchOptionsBuilderClass.getDeclaredMethod("validateCertificate").invoke(null);
Object fetchOptions = null;
try {
fetchOptions = fetchOptionsBuilderClass.getDeclaredMethod("validateCertificate").invoke(null);
} catch (NoSuchMethodException e) {
System.err.println("Warning: this App Engine SDK version does not allow verification of SSL certificates;" +
"this exposes you to a MITM attack. Please upgrade your App Engine SDK to >=1.5.0. " +
"If you have questions, contact [email protected].");
fetchOptions = fetchOptionsBuilderClass.getDeclaredMethod("withDefaults").invoke(null);
}


Class<?> fetchOptionsClass = Class.forName("com.google.appengine.api.urlfetch.FetchOptions");

// GAE requests can time out after 60 seconds, so make sure we leave
// some time for the application to handle a slow Stripe
fetchOptionsClass.getDeclaredMethod("setDeadline", java.lang.Double.class).invoke(fetchOptions, new Double(55));

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

Expand Down

0 comments on commit 716300f

Please sign in to comment.