Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.nio.file.Files;
import java.util.Objects;

import static android.content.Context.PRINT_SERVICE;

Expand Down Expand Up @@ -68,9 +70,9 @@ protected Boolean doInBackground(Void... voids) {
return Boolean.FALSE;
}

file.getParentFile().mkdirs();
Files.createDirectories(file.toPath().getParent());

if (!file.getParentFile().exists()) {
if (!Objects.requireNonNull(file.getParentFile()).exists()) {
Log_OC.d(TAG, file.getParentFile().getAbsolutePath() + " does not exist");
return Boolean.FALSE;
}
Expand All @@ -85,7 +87,7 @@ protected Boolean doInBackground(Void... voids) {
long transferred = 0;

Header contentLength = getMethod.getResponseHeader("Content-Length");
long totalToTransfer = contentLength != null && contentLength.getValue().length() > 0 ?
long totalToTransfer = contentLength != null && !contentLength.getValue().isEmpty() ?
Long.parseLong(contentLength.getValue()) : 0;

byte[] bytes = new byte[4096];
Expand Down
Loading