Skip to content

Commit a35361b

Browse files
committed
Merge branch 'feature/issue_1018_SA_peformance_1'
2 parents 78d8650 + 0b8f4f4 commit a35361b

27 files changed

Lines changed: 56 additions & 59 deletions

src/main/java/com/couchbase/lite/BlobStore.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private void verifyExistingStore() throws CouchbaseLiteException {
108108
throw new CouchbaseLiteException(Status.UNAUTHORIZED);
109109
} else if (!encryptionAlg.equals(ENCRYPTION_ALGORITHM)) {
110110
Log.w(Log.TAG_DATABASE, "BlobStore: Blob store uses unrecognized encryption '" +
111-
encryptionAlg + "'");
111+
encryptionAlg + '\'');
112112
throw new CouchbaseLiteException(Status.UNAUTHORIZED);
113113
}
114114
} else if (!isMarkerExists) {
@@ -180,7 +180,7 @@ public boolean accept(File dir, String name) {
180180
@Override
181181
public void execute() throws ActionException {
182182
Log.i(Log.TAG_DATABASE, "BlobStore: " +
183-
(newKey != null ? "encrypting" : "decrypting") + " " + path);
183+
(newKey != null ? "encrypting" : "decrypting") + ' ' + path);
184184
Log.i(Log.TAG_DATABASE, "BlobStore: **No blobs to copy; done.**");
185185
encryptionKey = newKey;
186186
try {
@@ -216,7 +216,7 @@ public void execute() throws ActionException {
216216
@Override
217217
public void execute() throws ActionException {
218218
Log.i(Log.TAG_DATABASE, "BlobStore: " +
219-
(newKey != null ? "encrypting" : "decrypting") + " " + path);
219+
(newKey != null ? "encrypting" : "decrypting") + ' ' + path);
220220
if (tempStoreDir == null)
221221
throw new ActionException("Cannot create a temporary directory");
222222
}
@@ -315,7 +315,7 @@ public boolean accept(File dir, String name) {
315315
});
316316

317317
for (File file : files) {
318-
String name = file.getName().substring(0);
318+
String name = file.getName();
319319
name = name.substring(0, name.indexOf(FILE_EXTENSION));
320320
File dest = new File(directory, name.toUpperCase() + FILE_EXTENSION);
321321
file.renameTo(dest);

src/main/java/com/couchbase/lite/Database.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public interface ChangeListener {
675675
*/
676676
@InterfaceAudience.Public
677677
public String toString() {
678-
return this.getClass().getName() + "[" + path + "]";
678+
return this.getClass().getName() + '[' + path + ']';
679679
}
680680

681681
///////////////////////////////////////////////////////////////////////////
@@ -1244,7 +1244,7 @@ SymmetricKey createSymmetricKey(Object keyOrPassword) throws CouchbaseLiteExcept
12441244
rawKey = (byte[])keyOrPassword;
12451245
} else {
12461246
throw new CouchbaseLiteException("Key must be String or byte[" +
1247-
SymmetricKey.KEY_SIZE + "]", Status.BAD_REQUEST);
1247+
SymmetricKey.KEY_SIZE + ']', Status.BAD_REQUEST);
12481248
}
12491249

12501250
SymmetricKey symmetricKey = null;
@@ -1677,7 +1677,7 @@ public static List<String> parseCouchDBRevisionHistory(Map<String, Object> docPr
16771677
if (start != null) {
16781678
for (int i = 0; i < revIDs.size(); i++) {
16791679
String revID = revIDs.get(i);
1680-
revIDs.set(i, Integer.toString(start--) + "-" + revID);
1680+
revIDs.set(i, Integer.toString(start--) + '-' + revID);
16811681
}
16821682
}
16831683
return revIDs;

src/main/java/com/couchbase/lite/Revision.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public int hashCode() {
254254
@Override
255255
@InterfaceAudience.Public
256256
public String toString() {
257-
return "{" + this.document.getId() + " #" + this.getId() + (isDeletion() ? "DEL" : "") + "}";
257+
return '{' + this.document.getId() + " #" + this.getId() + (isDeletion() ? "DEL" : "") + '}';
258258
}
259259

260260
/**

src/main/java/com/couchbase/lite/Status.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public String getMessage() {
8585

8686
@Override
8787
public String toString() {
88-
return "HTTP " + code + " " + message;
88+
return "HTTP " + code + ' ' + message;
8989
}
9090
}
9191

@@ -162,7 +162,7 @@ public boolean isError() {
162162

163163
@Override
164164
public String toString() {
165-
return "Status: " + code + " (" + getHTTPStatus().toString() + ")";
165+
return "Status: " + code + " (" + getHTTPStatus().toString() + ')';
166166
}
167167

168168
public HTTPStatus getHTTPStatus() {

src/main/java/com/couchbase/lite/View.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ protected Status updateIndexes(List<View> views) throws CouchbaseLiteException {
330330
@InterfaceAudience.Private
331331
protected List<View> getViewsInGroup() {
332332
List<View> views = new ArrayList<View>();
333-
int slash = name.indexOf("/");
333+
int slash = name.indexOf('/');
334334
if (slash > 0) {
335335
String prefix = name.substring(0, slash + 1);
336336
for (View view : database.getAllViews()) {
@@ -371,7 +371,7 @@ public static Object keyForPrefixMatch(Object key, int depth) {
371371
return key;
372372
} else if (key instanceof String) {
373373
// Kludge: prefix match a string by appending max possible character value to it
374-
return key + "\uffff";
374+
return (String) key + '\uffff';
375375
} else if (key instanceof List) {
376376
List<Object> nuKey = new ArrayList<Object>(((List<Object>) key));
377377
if (depth == 1) {

src/main/java/com/couchbase/lite/auth/BasicAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public boolean usesCookieBasedLogin() {
2525
@Override
2626
public String authUserInfo() {
2727
if (this.username != null && this.password != null) {
28-
return this.username + ":" + this.password;
28+
return this.username + ':' + this.password;
2929
}
3030
return super.authUserInfo();
3131
}

src/main/java/com/couchbase/lite/auth/TokenAuthenticator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public Map<String, String> loginParametersForSite(URL site) {
3131
public String loginPathForSite(URL site) {
3232
String path = loginPath;
3333
if (path != null && !path.startsWith("/")) {
34-
path = "/" + path;
34+
path = '/' + path;
3535
}
3636
return path;
3737
}

src/main/java/com/couchbase/lite/internal/RevisionInternal.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public long getSequence() {
194194

195195
@Override
196196
public String toString() {
197-
return "{" + this.docID + " #" + this.revID + (deleted ? "DEL" : "") + "}";
197+
return '{' + this.docID + " #" + this.revID + (deleted ? "DEL" : "") + '}';
198198
}
199199

200200
/**
@@ -208,7 +208,7 @@ public int getGeneration() {
208208
public static int generationFromRevID(String revID) {
209209
if(revID == null) return 0;
210210
int generation = 0;
211-
int dashPos = revID.indexOf("-");
211+
int dashPos = revID.indexOf('-');
212212
if (dashPos > 0) {
213213
generation = Integer.parseInt(revID.substring(0, dashPos));
214214
}
@@ -217,7 +217,7 @@ public static int generationFromRevID(String revID) {
217217

218218
public static String digestFromRevID(String revID) {
219219
String digest = "error";
220-
int dashPos = revID.indexOf("-");
220+
int dashPos = revID.indexOf('-');
221221
if (dashPos > 0) {
222222
digest = revID.substring(dashPos + 1);
223223
return digest;

src/main/java/com/couchbase/lite/replicator/BulkDownloader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void run() {
9292
}
9393

9494
public String toString() {
95-
return this.getClass().getName() + "[" + url.getPath() + "]";
95+
return this.getClass().getName() + '[' + url.getPath() + ']';
9696
}
9797

9898
private static final int BUF_LEN = 1024;

src/main/java/com/couchbase/lite/replicator/ChangeTracker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public String getChangesFeedPath() {
191191
throw new IllegalArgumentException(e);
192192
}
193193
}
194-
path += "&" + URLEncoder.encode(key) + "=" + URLEncoder.encode(value.toString());
194+
path += '&' + URLEncoder.encode(key) + '=' + URLEncoder.encode(value.toString());
195195
}
196196
}
197197
}

0 commit comments

Comments
 (0)