Skip to content

Commit

Permalink
move to jakarta (#501)
Browse files Browse the repository at this point in the history
* Bump mockito, delete unneeded wrapper, get build to pass

* move to jakarta

* move servlet to version catalog and downgrade to 5.0 for java 8 compatibility

* add notes to changelog and rebase

* point at correct stone

---------

Co-authored-by: Jay Palacio <[email protected]>
  • Loading branch information
devPalacio and Jay Palacio committed Aug 4, 2023
1 parent c9f9f5e commit 42c4988
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 41 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## 5.4.6-SNAPSHOT
## 6.0.0-SNAPSHOT
- Updated to `jakarta.servlet` to unblock adoption of Spring Boot v3, **this is a breaking change if you use `DbxSessionStore`.**
- Added better error messaging when trying to build the project without submodules initialized.
- Improved generateStone task to properly declare inputs and outputs
- Removed obsolete javadoc flag
- Updated test dependencies
- Updated to Gradle 7.6.2
- Removed redundant gradle wrappers

## 5.4.5 (2023-05-16)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ 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 SDK-specific ProGuard rules when shrinking is enabled. However, since version **2.0.4**, the only ProGuard rules necessary are for the SDK's required and optional dependencies. If you encounter ProGuard warnings, consider adding the following "-dontwarn" directives to your ProGuard configuration file:
The only ProGuard rules necessary are for the SDK's required and optional dependencies. If you encounter ProGuard warnings, consider adding the following "-dontwarn" directives to your ProGuard configuration file:

```
-dontwarn okio.**
Expand Down
4 changes: 2 additions & 2 deletions dropbox-sdk-java/api/dropbox-sdk-java.api
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ public abstract interface class com/dropbox/core/DbxSessionStore {
}

public final class com/dropbox/core/DbxStandardSessionStore : com/dropbox/core/DbxSessionStore {
public fun <init> (Ljavax/servlet/http/HttpSession;Ljava/lang/String;)V
public fun <init> (Ljakarta/servlet/http/HttpSession;Ljava/lang/String;)V
public fun clear ()V
public fun get ()Ljava/lang/String;
public fun getKey ()Ljava/lang/String;
public fun getSession ()Ljavax/servlet/http/HttpSession;
public fun getSession ()Ljakarta/servlet/http/HttpSession;
public fun set (Ljava/lang/String;)V
}

Expand Down
3 changes: 1 addition & 2 deletions dropbox-sdk-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ dependencies {
// Android
compileOnly 'com.google.android:android:4.1.1.4' // Until 6.x when we have an Android Artifact
compileOnly(dropboxJavaSdkLibs.kotlin.stdlib) // Only used in Android Code

compileOnly(dropboxJavaSdkLibs.servlet.api)
compileOnly(dropboxJavaSdkLibs.jakarta.servlet.api)
compileOnly(dropboxJavaSdkLibs.okhttp2) // support both v2 and v3 to avoid
compileOnly(dropboxJavaSdkLibs.okhttp3) // method count bloat
compileOnly(dropboxJavaSdkLibs.appengine.api)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dropbox.core;

import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpSession;

/*>>> import checkers.nullness.quals.Nullable; */

Expand Down
12 changes: 6 additions & 6 deletions dropbox-sdk-java/src/main/java/com/dropbox/core/DbxWebAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
* <h2> Part 1 </h2>
* <p> Handler for "http://my-server.com/dropbox-auth-start": </p>
* <pre>
* {@link javax.servlet.http.HttpServletRequest} request = ...
* {@link javax.servlet.http.HttpServletResponse} response = ...
* {@link jakarta.servlet.http.HttpServletRequest} request = ...
* {@link jakarta.servlet.http.HttpServletResponse} response = ...
*
* <b>// Select a spot in the session for DbxWebAuth to store the CSRF token.</b>
* {@link javax.servlet.http.HttpSession} session = request.getSession(true);
* {@link jakarta.servlet.http.HttpSession} session = request.getSession(true);
* String sessionKey = "dropbox-auth-csrf-token";
* {@link DbxSessionStore} csrfTokenStore = new DbxStandardSessionStore(session, sessionKey);
*
Expand All @@ -62,11 +62,11 @@
* <h2> Part 2 </h2>
* <p> Handler for "http://my-server.com/dropbox-auth-finish": </p>
* <pre>
* {@link javax.servlet.http.HttpServletRequest} request = ...
* {@link javax.servlet.http.HttpServletResponse} response = ...
* {@link jakarta.servlet.http.HttpServletRequest} request = ...
* {@link jakarta.servlet.http.HttpServletResponse} response = ...
*
* <b>// Fetch the session to verify our CSRF token</b>
* {@link javax.servlet.http.HttpSession} session = request.getSession(true);
* {@link jakarta.servlet.http.HttpSession} session = request.getSession(true);
* String sessionKey = "dropbox-auth-csrf-token";
* {@link DbxSessionStore} csrfTokenStore = new DbxStandardSessionStore(session, sessionKey);
* String redirectUri = "http://my-server.com/dropbox-auth-finish";
Expand Down
4 changes: 2 additions & 2 deletions examples/android/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
-dontwarn com.google.protos.cloud.sql.**
-dontwarn com.google.cloud.sql.**
-dontwarn javax.activation.**
-dontwarn javax.mail.**
-dontwarn javax.servlet.**
-dontwarn jakarta.mail.**
-dontwarn jakarta.servlet.**
-dontwarn org.apache.**

# Support classes for compatibility with older API versions
Expand Down
6 changes: 3 additions & 3 deletions examples/examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ java {

dependencies {
implementation(project(":dropbox-sdk-java"))
implementation("org.eclipse.jetty.aggregate:jetty-server:8.1.18.v20150929")
implementation("javax.servlet:javax.servlet-api:3.1.0")
implementation("org.eclipse.jetty:jetty-server:11.0.15")
implementation(dropboxJavaSdkLibs.jakarta.servlet.api)
implementation("org.apache.commons:commons-lang3:3.4")
implementation(dropboxJavaSdkLibs.jackson.core)
implementation("com.fasterxml.jackson.core:jackson-databind:2.15.0")
implementation(dropboxJavaSdkLibs.okhttp3)
implementation("org.json:json:20220320")
implementation("org.json:json:20230618")

testImplementation(dropboxJavaSdkLibs.test.junit)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import com.dropbox.core.DbxStandardSessionStore;
import com.dropbox.core.DbxWebAuth;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import java.io.IOException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import com.dropbox.core.v2.files.LookupError;
import com.dropbox.core.v2.files.Metadata;

import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.Part;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.dropbox.core.examples.web_file_browser;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import com.dropbox.core.json.JsonReader;
import static com.dropbox.core.util.StringUtil.jq;

import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
Expand All @@ -14,10 +17,6 @@
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;

/**
Expand All @@ -38,9 +37,9 @@ private WebFileBrowserExample(PrintWriter log, DbxAppInfo dbxAppInfo, File userD
// -------------------------------------------------------------------------------------------
// URI Routing
// -------------------------------------------------------------------------------------------

@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
throws IOException, ServletException {
// Don't pollute the logging with the favicon.ico requests that browsers issue.
if (target.equals("/favicon.ico")) {
response.sendError(404);
Expand Down
2 changes: 1 addition & 1 deletion gradle/dropboxJavaSdkLibs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ androidx-recyclerview = 'androidx.recyclerview:recyclerview:1.2.1'
appengine-api = 'com.google.appengine:appengine-api-1.0-sdk:1.9.38'
glide = 'com.github.bumptech.glide:glide:4.12.0'
jackson-core = 'com.fasterxml.jackson.core:jackson-core:2.15.0'
jakarta-servlet-api = 'jakarta.servlet:jakarta.servlet-api:5.0.0'
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand All @@ -32,7 +33,6 @@ kotlin-test-jvm = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
okhttp2 = 'com.squareup.okhttp:okhttp:2.7.5'
okhttp3 = 'com.squareup.okhttp3:okhttp:4.0.0'
servlet-api = 'javax.servlet:servlet-api:2.5'

androidx-test-junit = 'androidx.test.ext:junit:1.1.3'
androidx-test-espresso-core = 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down

0 comments on commit 42c4988

Please sign in to comment.