Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

java.lang.NullPointerException: Inflater has been closed #160

Open
aravindakv opened this issue Jul 24, 2020 · 3 comments
Open

java.lang.NullPointerException: Inflater has been closed #160

aravindakv opened this issue Jul 24, 2020 · 3 comments

Comments

@aravindakv
Copy link

I am usinng archive-patcher on Android. I am getting below exception while generating patch, please help me.

2020-07-24 16:19:56.145 920-920/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.apkpatcher, PID: 920
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.apkpatcher/com.example.apkpatcher.MainActivity}:java.lang.NullPointerException: Inflater has been closed
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3623)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2261)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8107)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)

Caused by: java.lang.NullPointerException: Inflater has been closed
at java.util.zip.Inflater.ensureOpen(Inflater.java:416)
at java.util.zip.Inflater.reset(Inflater.java:370)
at com.google.archivepatcher.generator.DefaultDeflateCompressionDiviner.divineDeflateParameters(DefaultDeflateCompressionDiviner.java:173)
at com.google.archivepatcher.generator.DefaultDeflateCompressionDiviner.divineDeflateParameters(DefaultDeflateCompressionDiviner.java:114)
at com.google.archivepatcher.generator.PreDiffExecutor.generatePreDiffPlan(PreDiffExecutor.java:216)
at com.google.archivepatcher.generator.PreDiffExecutor.prepareForDiffing(PreDiffExecutor.java:157)
at com.google.archivepatcher.generator.FileByFileV1DeltaGenerator.generateDelta(FileByFileV1DeltaGenerator.java:81)
at com.example.apkpatcher.DeltaCounter.generatePatch(DeltaCounter.java:97)
at com.example.apkpatcher.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:7957)
at android.app.Activity.performCreate(Activity.java:7946)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3598)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2261) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:237) 
at android.app.ActivityThread.main(ActivityThread.java:8107) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) 
2020-07-24 16:21:01.356 1578-1578/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.apkpatcher, PID: 1578
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.apkpatcher/com.example.apkpatcher.MainActivity}: java.lang.NullPointerException: Inflater has been closed
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3623)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3775)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2261)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8107)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: java.lang.NullPointerException: Inflater has been closed
at java.util.zip.Inflater.ensureOpen(Inflater.java:416)
at java.util.zip.Inflater.reset(Inflater.java:370)
at com.google.archivepatcher.generator.DefaultDeflateCompressionDiviner.divineDeflateParameters(DefaultDeflateCompressionDiviner.java:173)
at com.google.archivepatcher.generator.DefaultDeflateCompressionDiviner.divineDeflateParameters(DefaultDeflateCompressionDiviner.java:114)
at com.google.archivepatcher.generator.PreDiffExecutor.generatePreDiffPlan(PreDiffExecutor.java:216)
at com.google.archivepatcher.generator.PreDiffExecutor.prepareForDiffing(PreDiffExecutor.java:157)
at com.google.archivepatcher.generator.FileByFileV1DeltaGenerator.generateDelta(FileByFileV1DeltaGenerator.java:81)
at com.example.apkpatcher.DeltaCounter.generatePatch(DeltaCounter.java:97)

@andrewhayden
Copy link
Contributor

Hi there,

I can't speak for the team at this point, but archive-patcher was not designed to generate patches on Android. Apply, yes - generate, no. The zip implementation on Android is not the same as the Zip implementation elsewhere, and there are some minor differences that can, from time to time, result in behavioral differences. I believe this one is known, and has to do with the way Android resets (or does not reset) the internal flags of Inflater objects when trying to reset the Inflater for further use.

If possible, it's generally better to generate patches on another platform. Applying them on Android absolutely should work, but generating them there may not.

@andrewhayden
Copy link
Contributor

For the record, this is a dupe of issue #138 , and a fix was made on a branch that is currently idle. It might be possible to fix in master as well, but like I said, I do not speak for the team.

@aravindakv
Copy link
Author

aravindakv commented Jul 24, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants