Skip to content

Commit

Permalink
2.0.5 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl Rieb committed Jun 8, 2016
1 parent fdbc62b commit f435971
Show file tree
Hide file tree
Showing 52 changed files with 1,951 additions and 4,149 deletions.
10 changes: 10 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2.0.5 (2016-06-08)
---------------------------------------------
- Allow old locale formats for APIv2 requests.
- Fix ExceptionInInitializationError caused by CertificateParsingException when using Java 6 JREs.
- Fix CertPathValidatorException: Trust anchor for certification path not found.
- Add support for OkHttp3.
- Add support for Google App Engine with new GoogleAppEngineRequestor.
- Add support for require_role, force_reapprove, state, and disable_signup parameters in the OAuth 2 web-based authorization flow (DbxWebAuth).
- Enable certificate pinning for OkHttpRequestor and OkHttp3Requestor by default.

2.0.4 (2016-05-31)
---------------------------------------------
- Update to latest API specs:
Expand Down
13 changes: 10 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you're using Maven, then edit your project's "pom.xml" and add this to the `<
<dependency>
<groupId>com.dropbox.core</groupId>
<artifactId>dropbox-core-sdk</artifactId>
<version>2.0.4</version>
<version>2.0.5</version>
</dependency>
```

Expand All @@ -23,7 +23,7 @@ If you are using Gradle, then edit your project's "build.gradle" and add this to
```groovy
dependencies {
// ...
compile 'com.dropbox.core:dropbox-core-sdk:2.0.4'
compile 'com.dropbox.core:dropbox-core-sdk:2.0.5'
}
```

Expand Down Expand Up @@ -158,6 +158,13 @@ Another workaround is to tell your OSGi container to provide that requirement: [

### Does this SDK require any special ProGuard rules for shrink optimizations?

Versions 2.0.0-2.0.3 of this SDK require specific ProGuard rules to work with shrinking enabled. However, since version **2.0.4**, the SDK no longer needs special ProGuard directives.
Versions 2.0.0-2.0.3 of this SDK require specific ProGuard rules to work with shrinking enabled. However, since version **2.0.4**, the SDK no longer needs special ProGuard directives. However, you may want to consider adding "-dontwarn" directives for unused optional dependencies:

```
-dontwarn okhttp3.**
-dontwarn com.squareup.okhttp.**
-dontwarn com.google.appengine.**
-dontwarn javax.servlet.**
```

**IMPORTANT: If you are running version 2.0.x before 2.0.3, you should update to the latest Dropbox SDK version to avoid a deserialization bug that can cause Android apps that use ProGuard to crash.**
55 changes: 45 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import org.gradle.internal.os.OperatingSystem;

apply plugin: 'java'
apply plugin: 'osgi'
apply plugin: 'maven'
apply plugin: 'com.github.ben-manes.versions' // dependencyUpdates task

description = 'Official Java client library for the Dropbox API.'
group = 'com.dropbox.core'
Expand All @@ -13,13 +16,15 @@ targetCompatibility = JavaVersion.VERSION_1_6
conf2ScopeMappings.addMapping(1, configurations.compileOnly, 'provided')

ext {
mavenName = 'Official Dropbox Java SDK'
generatedSources = file("$buildDir/generated-sources")
generatedResources = file("$buildDir/generated-resources")
authInfoPropertyName = 'com.dropbox.test.authInfoFile'
basePom = pom {
name = 'Official Dropbox Java SDK'
name = mavenName
artifactId = archivesBaseName
project {
description = description
packaging 'jar'
url 'https://www.dropbox.com/developers/core'

Expand Down Expand Up @@ -54,6 +59,7 @@ buildscript {
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
}
Expand All @@ -69,14 +75,21 @@ dependencies {
compile 'com.fasterxml.jackson.core:jackson-core:2.7.4'

compileOnly 'javax.servlet:servlet-api:2.5'
compileOnly 'com.squareup.okhttp:okhttp:2.7.5'
compileOnly 'com.squareup.okhttp:okhttp:2.7.5' // support both v2 and v3 to avoid
compileOnly 'com.squareup.okhttp3:okhttp:3.3.1' // method count bloat
compileOnly 'com.google.android:android:4.1.1.4'
compileOnly 'com.google.appengine:appengine-api-1.0-sdk:1.9.38'

testCompile 'org.testng:testng:6.9.10'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.openjdk.jmh:jmh-core:1.12'
testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.12'
testCompile 'com.google.appengine:appengine-api-1.0-sdk:1.9.38'
testCompile 'com.google.appengine:appengine-api-labs:1.9.38'
testCompile 'com.google.appengine:appengine-api-stubs:1.9.38'
testCompile 'com.google.appengine:appengine-testing:1.9.38'
testCompile 'com.squareup.okhttp:okhttp:2.7.5'
testCompile 'com.squareup.okhttp3:okhttp:3.3.1'
}

processResources {
Expand Down Expand Up @@ -162,27 +175,29 @@ task integrationTest(type: Test) {

ext {
authInfoPropertyName = 'com.dropbox.test.authInfoFile'
okHttpPropertyName = 'com.dropbox.test.okHttp'
httpRequestorPropertyName = 'com.dropbox.test.httpRequestor'
}

doFirst {
systemProperty authInfoPropertyName, getAuthInfoFile().absolutePath
if (project.hasProperty(okHttpPropertyName)) {
systemProperty okHttpPropertyName, project.property(okHttpPropertyName)
if (project.hasProperty(httpRequestorPropertyName)) {
systemProperty httpRequestorPropertyName, project.property(httpRequestorPropertyName)
}
}
}

javadoc {
title "${project.name} ${project.version} API"
title "${project.mavenName} ${project.version} API"
failOnError true

// JDK 8's javadoc has an on-by-default lint called "missing", which requires that everything
// be documented. Disable this lint because we intentionally don't document some things.
//
// NOTE: ugly hack to set our doclint settings due to strange handling of string options by the
// javadoc task.
options.addBooleanOption "Xdoclint:all,-missing", true
if (JavaVersion.current().isJava8Compatible()) {
options.addBooleanOption "Xdoclint:all,-missing", true
}
options.addStringOption "link", "http://docs.oracle.com/javase/6/docs/api/"
}

Expand Down Expand Up @@ -231,9 +246,29 @@ if (project.sourceCompatibility == JavaVersion.VERSION_1_6) {

logger.info("Setting JVM boot classpath to use ${jdkHome}")
project.tasks.withType(JavaCompile) {
options.bootClasspath = "${jdkHome}/jre/lib/rt.jar"
options.bootClasspath += "${sep}${jdkHome}/jre/lib/jsse.jar"
options.bootClasspath += "${sep}${jdkHome}/jre/lib/jce.jar"
def jdkLibs = "${jdkHome}/jre/lib"
def runtimeClasses = "rt.jar"
if (OperatingSystem.current().isMacOsX()) {
jdkLibs = "${jdkHome}/Classes"
runtimeClasses = "classes.jar"
}
options.bootClasspath = "${jdkLibs}/${runtimeClasses}"
options.bootClasspath += "${sep}${jdkLibs}/jsse.jar"
options.bootClasspath += "${sep}${jdkLibs}/jce.jar"
}
}
}

// reject dependencyUpdates candidates with alpha or beta in their names:
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.dropbox.core.v2.users.FullAccount;

import java.io.IOException;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -50,8 +49,7 @@ public static void main(String[] args)
}

// Create a DbxClientV1, which is what you use to make API calls.
String userLocale = Locale.getDefault().toLanguageTag();
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-account-info", userLocale);
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-account-info");
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.getAccessToken(), authInfo.getHost());

// Make the /account/info API call.
Expand Down
5 changes: 4 additions & 1 deletion examples/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ dependencies {
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.fasterxml.jackson.core:jackson-core:2.7.4'
// picasso 2.5.2 doesn't have OkHttp3 support (although it exists
// on master). Must use OkHttp v2 and v3 until new picasso release
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
}

apply plugin: 'com.getkeepsafe.dexcount'
Expand Down
2 changes: 2 additions & 0 deletions examples/android/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
# OkHttp and Servlet optional dependencies

-dontwarn okio.**
-dontwarn okhttp3.**
-dontwarn com.google.appengine.**
-dontwarn javax.servlet.**

# Support classes for compatibility with older API versions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.dropbox.core.examples.android;

import com.dropbox.core.http.OkHttpRequestor;
import com.dropbox.core.v2.DbxClientV2;
import com.dropbox.core.DbxHost;
import com.dropbox.core.DbxRequestConfig;

import java.util.Locale;
import com.dropbox.core.http.OkHttp3Requestor;
import com.dropbox.core.v2.DbxClientV2;

/**
* Singleton instance of {@link DbxClientV2} and friends
Expand All @@ -16,11 +14,9 @@ public class DropboxClientFactory {

public static void init(String accessToken) {
if (sDbxClient == null) {
String userLocale = Locale.getDefault().toLanguageTag();
DbxRequestConfig requestConfig = new DbxRequestConfig(
"examples-v2-demo",
userLocale,
OkHttpRequestor.INSTANCE);
DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("examples-v2-demo")
.withHttpRequestor(OkHttp3Requestor.INSTANCE)
.build();

sDbxClient = new DbxClientV2(requestConfig, accessToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
import com.dropbox.core.DbxException;
import com.dropbox.core.DbxRequestConfig;
import com.dropbox.core.DbxWebAuth;
import com.dropbox.core.DbxWebAuthNoRedirect;
import com.dropbox.core.json.JsonReader;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.File;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Locale;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -61,11 +59,13 @@ public static void main(String[] args) throws IOException {
}

// Run through Dropbox API authorization process
String userLocale = Locale.getDefault().toLanguageTag();
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-authorize", userLocale);
DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(requestConfig, appInfo);
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-authorize");
DbxWebAuth webAuth = new DbxWebAuth(requestConfig, appInfo);
DbxWebAuth.Request webAuthRequest = DbxWebAuth.newRequestBuilder()
.withNoRedirect()
.build();

String authorizeUrl = webAuth.start();
String authorizeUrl = webAuth.authorize(webAuthRequest);
System.out.println("1. Go to " + authorizeUrl);
System.out.println("2. Click \"Allow\" (you might have to log in first).");
System.out.println("3. Copy the authorization code.");
Expand All @@ -79,9 +79,9 @@ public static void main(String[] args) throws IOException {

DbxAuthFinish authFinish;
try {
authFinish = webAuth.finish(code);
authFinish = webAuth.finishFromCode(code);
} catch (DbxException ex) {
System.err.println("Error in DbxWebAuth.start: " + ex.getMessage());
System.err.println("Error in DbxWebAuth.authorize: " + ex.getMessage());
System.exit(1); return;
}

Expand All @@ -91,9 +91,10 @@ public static void main(String[] args) throws IOException {

// Save auth information to output file.
DbxAuthInfo authInfo = new DbxAuthInfo(authFinish.getAccessToken(), appInfo.getHost());
File output = new File(argAuthFileOutput);
try {
DbxAuthInfo.Writer.writeToFile(authInfo, argAuthFileOutput);
System.out.println("Saved authorization information to \"" + argAuthFileOutput + "\".");
DbxAuthInfo.Writer.writeToFile(authInfo, output);
System.out.println("Saved authorization information to \"" + output.getCanonicalPath() + "\".");
} catch (IOException ex) {
System.err.println("Error saving to <auth-file-out>: " + ex.getMessage());
System.err.println("Dumping to stderr instead:");
Expand Down
1 change: 1 addition & 0 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ subprojects {
//
// This is intended to be used by the ./run script and not through gradle directly
task run(type: JavaExec) {
standardInput = System.in
classpath = sourceSets.main.runtimeClasspath
main = "com.dropbox.core.examples.${project.name.replace('-','_')}.Main"
ignoreExitValue true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -110,9 +109,10 @@ public static void longpoll(DbxAuthInfo auth, String path) throws IOException {
*/
private static DbxClientV2 createClient(DbxAuthInfo auth, StandardHttpRequestor.Config config) {
String clientUserAgentId = "examples-longpoll";
String userLocale = Locale.getDefault().toLanguageTag();
StandardHttpRequestor requestor = new StandardHttpRequestor(config);
DbxRequestConfig requestConfig = new DbxRequestConfig(clientUserAgentId, userLocale, requestor);
DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder(clientUserAgentId)
.withHttpRequestor(requestor)
.build();

return new DbxClientV2(requestConfig, auth.getAccessToken(), auth.getHost());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down Expand Up @@ -47,8 +46,7 @@ public static void main(String[] args)
new DbxOAuth1AccessToken(cfg.accessTokenKey, cfg.accessTokenSecret);

// Get an OAuth 2 access token.
String userLocale = Locale.getDefault().toLanguageTag();
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-authorize", userLocale);
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-authorize");
DbxOAuth1Upgrader upgrader = new DbxOAuth1Upgrader(requestConfig, appInfo);

String oauth2AccessToken ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.Date;
import java.util.Locale;

/**
* An example command-line application that runs through the web-based OAuth
Expand Down Expand Up @@ -265,8 +264,7 @@ public static void main(String[] args) throws IOException {


// Create a DbxClientV2, which is what you use to make API calls.
String userLocale = Locale.getDefault().toLanguageTag();
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-upload-file", userLocale);
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-upload-file");
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.getAccessToken(), authInfo.getHost());

// upload the file with simple upload API if it is small enough, otherwise use chunked
Expand Down
Loading

0 comments on commit f435971

Please sign in to comment.