Skip to content

Commit

Permalink
[KotlinCleanup] FileUtil (ankidroid#12868)
Browse files Browse the repository at this point in the history
* Made uri non null.

* Removed explicit type argument.

Co-authored-by: Nishant <nishantbhandari0019@gmail.com>
  • Loading branch information
n1snt and n1snt authored Nov 21, 2022
1 parent 2b44f44 commit f28eca3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions AnkiDroid/src/main/java/com/ichi2/utils/FileUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ object FileUtil {
* @throws IOException
*/
@Throws(IOException::class)
@KotlinCleanup("nonnull uri")
fun internalizeUri(uri: Uri?, internalFile: File, contentResolver: ContentResolver): File {
fun internalizeUri(uri: Uri, internalFile: File, contentResolver: ContentResolver): File {
// If we got a real file name, do a copy from it
val inputStream: InputStream = try {
contentResolver.openInputStream(uri!!)!!
contentResolver.openInputStream(uri)!!
} catch (e: Exception) {
Timber.w(e, "internalizeUri() unable to open input stream from content resolver for Uri %s", uri)
throw e
Expand Down Expand Up @@ -105,7 +104,7 @@ object FileUtil {
var totalBytes = 0L
var numberOfDirectories = 0
var numberOfFiles = 0
val directoriesToProcess = mutableListOf<File>(root)
val directoriesToProcess = mutableListOf(root)
while (directoriesToProcess.isNotEmpty()) {
val dir = directoriesToProcess.removeLast()
listFiles(dir).forEach {
Expand Down

0 comments on commit f28eca3

Please sign in to comment.