Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit dd6be60

Browse files
committed
Add external storage permissions and fix verification
Change-Id: Ifac1992756521ec144d2dcfc507fc101be2b8e63
1 parent 3511494 commit dd6be60

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

lib/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ limitations under the License.
2121
<uses-permission android:name="android.permission.INTERNET"/>
2222
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
2323

24+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
25+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
26+
2427
<application android:label="@string/app_name"></application>
2528
</manifest>

lib/src/main/java/com/couchbase/lite/CouchbaseLite.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,12 @@ static Map<String, String> loadErrorMessages(@NonNull Context ctxt) {
142142
private static String verifyDir(@Nullable File dir) {
143143
if (dir == null) { return null; }
144144

145-
final String path = dir.getAbsolutePath();
146-
if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { return path; }
145+
IOException err = null;
146+
try {
147+
if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { return dir.getCanonicalPath(); }
148+
}
149+
catch (IOException e) { err = e; }
147150

148-
throw new IllegalStateException("Cannot create or access directory at " + path);
151+
throw new IllegalStateException("Cannot create or access directory at " + dir, err);
149152
}
150153
}

lib/src/main/java/com/couchbase/lite/internal/AndroidExecutionService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public Cancellable postDelayedOnExecutor(long delayMs, @NonNull Executor executo
100100
Log.w(LogDomain.DATABASE, "Scheduled on closed executor: " + task + ", " + executor);
101101
}
102102
catch (RejectedExecutionException e) {
103-
dumpServiceState(executor, "after: " + delayMs, e);
103+
if (!throttled()) { dumpServiceState(executor, "after: " + delayMs, e); }
104104
}
105105
};
106106

0 commit comments

Comments
 (0)