Skip to content

Commit

Permalink
[WIP] Fix SevenZipHelperCallable unable to open 7z with full paths
Browse files Browse the repository at this point in the history
  • Loading branch information
TranceLove committed Oct 30, 2023
1 parent 337b78b commit 8a5d25e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,12 @@ public boolean equals(Object obj) {
&& size == otherObj.size;
} else return false;
}
@Override
public int hashCode() {
int result = (directory ? 1 : 0);
result = 31 * result + type;
result = 31 * result + name.hashCode();
result = 31 * result + (int) (size ^ (size >>> 32));
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ package com.amaze.filemanager.asynchronous.asynctasks.compress
import androidx.annotation.WorkerThread
import com.amaze.filemanager.adapters.data.CompressedObjectParcelable
import org.apache.commons.compress.archivers.ArchiveException
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.util.*
import java.util.concurrent.Callable

Expand All @@ -31,6 +33,8 @@ abstract class CompressedHelperCallable internal constructor(
) :
Callable<ArrayList<CompressedObjectParcelable>> {

protected val logger: Logger = LoggerFactory.getLogger(javaClass)

@WorkerThread
@Throws(ArchiveException::class)
override fun call(): ArrayList<CompressedObjectParcelable> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

package com.amaze.filemanager.asynchronous.asynctasks.compress

import android.util.Log
import com.amaze.filemanager.adapters.data.CompressedObjectParcelable
import com.amaze.filemanager.fileoperations.filesystem.compressed.ArchivePasswordCache
import com.amaze.filemanager.filesystem.compressed.CompressedHelper
Expand All @@ -29,7 +28,6 @@ import org.apache.commons.compress.PasswordRequiredException
import org.apache.commons.compress.archivers.ArchiveException
import java.io.File
import java.io.IOException
import java.lang.UnsupportedOperationException

class SevenZipHelperCallable(
private val filePath: String,
Expand Down Expand Up @@ -62,22 +60,20 @@ class SevenZipHelperCallable(
== relativePath
)
if (isInBaseDir || isInRelativeDir) {
elements.add(
CompressedObjectParcelable(
entry.name,
try {
entry.lastModifiedDate.time
} catch (e: UnsupportedOperationException) {
Log.w(
javaClass.simpleName,
"Unable to get modified date for 7zip file"
)
0L
},
entry.size,
entry.isDirectory
)
val p = CompressedObjectParcelable(
entry.name,
try {
entry.lastModifiedDate.time
} catch (e: UnsupportedOperationException) {
logger.warn("Unable to get modified date for 7zip file", e)
0L
},
entry.size,
entry.isDirectory,
)
if (!elements.contains(p)) {
elements.add(p)
}
}
}
} catch (e: PasswordRequiredException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicLong;

import org.slf4j.Logger;
Expand Down

0 comments on commit 8a5d25e

Please sign in to comment.