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

Run the demo, it has a NPE, msg is "Inflater has been closed" #138

Closed
commutescript opened this issue Jul 5, 2019 · 19 comments
Closed

Run the demo, it has a NPE, msg is "Inflater has been closed" #138

commutescript opened this issue Jul 5, 2019 · 19 comments

Comments

@commutescript
Copy link

it can not work well

@Archive-Patcher-Sync-Robot
Copy link
Collaborator

could you share some details on how you run the demo?

@commutescript
Copy link
Author

could you share some details on how you run the demo?

I have established a application module, then copy the code in the SamplePatchApplier class into MainActivity, after launch it show "Inflater has been closed".

@Archive-Patcher-Sync-Robot
Copy link
Collaborator

Hi, multiple things could have gone wrong here.

One thing to try is to remove the part of the code that compresses the patch and decompress it. (e.g., generate the patch using just FileByFileDeltaGenerator without DeflaterOutputStream, apply the patch using FileByFileDeltaApplier). If that works, we know the problem is within the compression bit. If that doesn't, then something is probably wrong within the patching part.

@commutescript
Copy link
Author

Thank you for you reply. I have remove the DeflaterOutputStream, it still have the same NPE. It is DefaultDeflateCompressionDiviner's method--divineDeflateParameters go wrong. And i directly use BsDiffDeltaGenerator to generate the delta, the output file is aways about 20B.

@pspencil
Copy link
Collaborator

pspencil commented Jul 6, 2019 via email

@commutescript
Copy link
Author

  1. NPE occur in the generator, i do not have test applier.
  2. I test the generator with wexin, qq. And what's your email address, it's my honor to send old and new archive to you.

@Archive-Patcher-Sync-Robot
Copy link
Collaborator

@commutescript
Copy link
Author

Old version and new version apk is posted to your email, MainActivity is also in the zip.

Thank you for your patience!

@pspencil
Copy link
Collaborator

Found the cause. It is due to different implementation of InflaterInputStream in android JDK.

In Android, close() ends the inflater all the time. https://chromium.googlesource.com/android_tools/+/refs/heads/master/sdk/sources/android-25/java/util/zip/InflaterInputStream.java#229

In non-Android it only closes if it is created within the InflaterInputStream. https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/util/zip/InflaterInputStream.java#L226

Since we reuse the Inflater here and closes the InflaterInputStream here, it behaves differently on Android.

I will have to think about how to fix this.

@commutescript
Copy link
Author

Ok, thx!

Archive-Patcher-Sync-Robot pushed a commit that referenced this issue Jul 15, 2019
Archive-Patcher-Sync-Robot pushed a commit that referenced this issue Jul 15, 2019
@pspencil
Copy link
Collaborator

Should be fixed by the commit.

@commutescript
Copy link
Author

It still cannot word well in the demo i post you

@commutescript
Copy link
Author

BsDiffDeltaGenerator can not generate delta well, the delta size is always 20B.

@pspencil
Copy link
Collaborator

  1. note that the commit is in the v2 branch only.
  2. I will look into the bsdiff thing.

@pspencil
Copy link
Collaborator

For the BSDIFF thing, it seems that the task never finish. Probably it times out? Since you are generating patches on Android, it could be very slow.

@commutescript
Copy link
Author

ok, thx

@commutescript
Copy link
Author

hi, what's the difference between the master and v2, v2 is stable? Thank you very mach!

@pspencil
Copy link
Collaborator

Technically speaking, master is stable. I am adding new features to v2. One of them is diffing embedded archives inside archives.

@commutescript
Copy link
Author

ok,thank you for your patient!

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

No branches or pull requests

3 participants