Skip to content

Commit 2ba9064

Browse files
committed
touching up
Signed-off-by: Alex Knop <knopalex@msu.edu>
1 parent fe019fe commit 2ba9064

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

app/src/main/java/com/owncloud/android/files/services/IndexedForest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,7 @@ public V get(String accountName, String remotePath) {
215215
* @param accountName
216216
*/
217217
public void remove(String accountName){
218-
for (String key : mMap.keySet()) {
219-
Log_OC.d("IndexedForest", "Number of pending downloads= " + mMap.size());
220-
if (key.startsWith(accountName)) {
221-
mMap.remove(key);
222-
}
223-
}
218+
mMap.keySet().removeIf(key -> key.startsWith(accountName));
224219
}
225220

226221
/**

app/src/main/java/com/owncloud/android/operations/DownloadFileOperation.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ protected RemoteOperationResult run(OwnCloudClient client) {
196196
downloadOperation = new DownloadFileRemoteOperation(file.getRemotePath(), tmpFolder);
197197

198198
if (downloadType == DownloadType.DOWNLOAD) {
199-
for (OnDatatransferProgressListener dataTransferListener : dataTransferListeners) {
200-
downloadOperation.addDatatransferProgressListener(dataTransferListener);
201-
}
199+
dataTransferListeners.forEach(downloadOperation::addDatatransferProgressListener);
202200
}
203201

204202
result = downloadOperation.execute(client);

app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,22 @@ private String internetShortcutDesktopText(String url, String filename) {
636636

637637
@Nullable
638638
private File createTempFile(String text) {
639-
File file = new File(getActivity().getCacheDir(), "tmp.tmp");
639+
final var activity = getActivity();
640+
if (activity == null) {
641+
return null;
642+
}
643+
644+
final var cacheDir = activity.getCacheDir();
645+
646+
File file = new File(cacheDir, "tmp.tmp");
647+
640648
try (FileWriter fw = new FileWriter(file)) {
641649
fw.write(text);
642650
} catch (IOException e) {
643651
Log_OC.d(TAG, "Error ", e);
644652
return null;
645653
}
654+
646655
return file;
647656
}
648657
}

0 commit comments

Comments
 (0)