Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jadx.core.utils.exceptions.JadxRuntimeException: Failed to remove code cache for con #1503

Closed
CezarKing9436 opened this issue May 30, 2022 · 3 comments
Assignees
Labels
bug GUI Issues in jadx-gui module
Milestone

Comments

@CezarKing9436
Copy link

Please describe what you did before the error occurred.
IMPORTANT! If the error occurs with a specific APK file please attach or provide link to apk file!

  • Jadx version: 1.4.0.420-98c0416b
  • Java version: 18.0.1.1
  • Java VM: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM
  • Platform: Windows 10 (10.0 amd64)
  • Max heap size: 11376 MB
  • Program args: -Xms128M -XX:MaxRAMPercentage=70.0 -XX:+UseG1GC -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true
jadx.core.utils.exceptions.JadxRuntimeException: Failed to remove code cache for con
	at jadx.gui.utils.codecache.disk.DiskCodeCache.remove(DiskCodeCache.java:197)
	at jadx.gui.utils.codecache.disk.DiskCodeCache.lambda$add$0(DiskCodeCache.java:134)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.nio.file.FileSystemException: C:\Users\Shai\Downloads\com.twitter.android_9.16.2-release.00-29162000_minAPI21(arm64-v8a,armeabi-v7a,x86,x86_64)(nodpi)_apkmirror.com (1).apk.cache\sources\con.java: The handle is invalid
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:275)
	at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
	at java.base/java.nio.file.Files.deleteIfExists(Files.java:1191)
	at jadx.gui.utils.codecache.disk.DiskCodeCache.remove(DiskCodeCache.java:194)
	... 4 more

@jpstotz
Copy link
Collaborator

jpstotz commented May 30, 2022

con is a reserved file name on Windows, it can not be used for creating files. Looks like we should add some escaping to the code cache file names (best independent of the used OS to make the code cache moveable between multiple computers).

According to Microsoft the following names are reserved: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9

@skylot
Copy link
Owner

skylot commented May 30, 2022

Yeah, looks like I missed a lot of file system restrictions:

  1. Case sensitivity
  2. Reserved names
  3. Files count limit in one directory
  4. File name length limit
  5. ... maybe more

And it will be hard to satisfy all these restrictions with original class name. So I think it will be easier just made additional mapping for classes. For example class name to a number, use a hex string of class number as a file name (also with a first byte as directory to not store all files in one directory) and save that mapping in file.

@skylot skylot self-assigned this May 30, 2022
@skylot skylot added bug GUI Issues in jadx-gui module labels May 30, 2022
@skylot skylot added this to the TBD milestone May 30, 2022
@skylot
Copy link
Owner

skylot commented May 30, 2022

I commit changes as I describe above, it should resolve the issue.
@CezarKing9436 please check latest unstable build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug GUI Issues in jadx-gui module
Projects
None yet
Development

No branches or pull requests

3 participants