Skip to content

Commit 6248a89

Browse files
author
Karl Rieb
committed
Removed use of public final fields from core classes.
1 parent 2734add commit 6248a89

File tree

35 files changed

+622
-576
lines changed

35 files changed

+622
-576
lines changed

ChangeLog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- Prepend 'with' to method names
1111
- Change format of tagged union classes.
1212
- getTag() renamed to tag() to avoid naming conflicts
13-
- Tags without values now referenced as public final singletons
13+
- Tags without values now referenced as public static final singletons
1414
- Unions composed of only tags without values generated as enums
1515
- Add builders for request and response classes.
1616
- Fix deserialization bug with Union containing tags with optional values.

ReadMe.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ cd examples
103103
./run web-file-browser 5000 test.app web-file-browser.db
104104
```
105105

106-
## Running the tests
106+
## Running the integration tests
107107

108108
1. Run through the `authorize` example above to get a "test.auth" file.
109-
2. `./run-tests <path-to-test.auth>`
109+
2. `./run-integration-tests <path-to-test.auth>`
110110

111-
Run `./run-tests` with no arguments to see how to run individual tests.
111+
Run `./run-integration-tests` with no arguments to see how to run individual tests.
112112

113113
## Running the benchmarks
114114

examples/account-info/src/com/dropbox/core/examples/account_info/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static void main(String[] args)
5757
// Create a DbxClientV1, which is what you use to make API calls.
5858
String userLocale = Locale.getDefault().toString();
5959
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-account-info", userLocale);
60-
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.accessToken, authInfo.host);
60+
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.getAccessToken(), authInfo.getHost());
6161

6262
// Make the /account/info API call.
6363
FullAccount dbxAccountInfo;

examples/android/src/main/java/com/dropbox/core/examples/android/DropboxClientFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void init(String accessToken) {
2222
userLocale,
2323
OkHttpRequestor.INSTANCE);
2424

25-
sDbxClient = new DbxClientV2(requestConfig, accessToken, DbxHost.Default);
25+
sDbxClient = new DbxClientV2(requestConfig, accessToken);
2626
}
2727
}
2828

examples/authorize/src/com/dropbox/core/examples/authorize/Main.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public static void main(String[] args)
7979
}
8080

8181
System.out.println("Authorization complete.");
82-
System.out.println("- User ID: " + authFinish.userId);
83-
System.out.println("- Access Token: " + authFinish.accessToken);
82+
System.out.println("- User ID: " + authFinish.getUserId());
83+
System.out.println("- Access Token: " + authFinish.getAccessToken());
8484

8585
// Save auth information to output file.
86-
DbxAuthInfo authInfo = new DbxAuthInfo(authFinish.accessToken, appInfo.host);
86+
DbxAuthInfo authInfo = new DbxAuthInfo(authFinish.getAccessToken(), appInfo.getHost());
8787
try {
8888
DbxAuthInfo.Writer.writeToFile(authInfo, argAuthFileOutput);
8989
System.out.println("Saved authorization information to \"" + argAuthFileOutput + "\".");

examples/longpoll/src/com/dropbox/core/examples/longpoll/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static void longpoll(DbxAuthInfo auth, String path) throws IOException {
7777
}
7878
} catch (DbxApiException ex) {
7979
// if a user message is available, try using that instead
80-
String message = ex.userMessage != null ? ex.userMessage.toString() : ex.getMessage();
80+
String message = ex.getUserMessage() != null ? ex.getUserMessage().getText() : ex.getMessage();
8181
System.err.println("Error making API call: " + message);
8282
System.exit(1);
8383
return;
@@ -103,7 +103,7 @@ private static DbxClientV2 createClient(DbxAuthInfo auth, StandardHttpRequestor.
103103
StandardHttpRequestor requestor = new StandardHttpRequestor(config);
104104
DbxRequestConfig requestConfig = new DbxRequestConfig(clientUserAgentId, userLocale, requestor);
105105

106-
return new DbxClientV2(requestConfig, auth.accessToken, auth.host);
106+
return new DbxClientV2(requestConfig, auth.getAccessToken(), auth.getHost());
107107
}
108108

109109
/**

examples/upgrade-oauth1-token/src/com/dropbox/core/examples/upgrade_oauth1_token/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static void main(String[] args)
6161
}
6262

6363
System.out.println("OAuth 2 access token obtained.");
64-
DbxAuthInfo authInfo = new DbxAuthInfo(oauth2AccessToken, appInfo.host);
64+
DbxAuthInfo authInfo = new DbxAuthInfo(oauth2AccessToken, appInfo.getHost());
6565
DbxAuthInfo.Writer.writeToStream(authInfo, System.out);
6666
System.out.println();
6767

examples/upload-file/src/com/dropbox/core/examples/upload_file/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private static int _main(String[] args)
8484
// Create a DbxClientV2, which is what you use to make API calls.
8585
String userLocale = Locale.getDefault().toString();
8686
DbxRequestConfig requestConfig = new DbxRequestConfig("examples-upload-file", userLocale);
87-
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.accessToken, authInfo.host);
87+
DbxClientV2 dbxClient = new DbxClientV2(requestConfig, authInfo.getAccessToken(), authInfo.getHost());
8888

8989
// Make the API call to upload the file.
9090
File localFile = new File(localPath);

examples/web-file-browser/src/com/dropbox/core/examples/web_file_browser/DropboxAuth.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public void doFinish(HttpServletRequest request, HttpServletResponse response)
101101

102102
// We have an Dropbox API access token now. This is what will let us make Dropbox API
103103
// calls. Save it in the database entry for the current user.
104-
user.dropboxAccessToken = authFinish.accessToken;
104+
user.dropboxAccessToken = authFinish.getAccessToken();
105105
common.saveUserDb();
106106

107107
response.sendRedirect("/");

examples/web-file-browser/src/com/dropbox/core/examples/web_file_browser/DropboxBrowse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private DbxClientV2 requireDbxClient(HttpServletRequest request, HttpServletResp
5353

5454
return new DbxClientV2(common.getRequestConfig(request),
5555
user.dropboxAccessToken,
56-
common.dbxAppInfo.host);
56+
common.dbxAppInfo.getHost());
5757
}
5858

5959
private boolean checkPathError(HttpServletResponse response, String path, LookupError le)

0 commit comments

Comments
 (0)