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

Fix NPE in Windows around "!" check #528

Open
rhyolight opened this issue Sep 6, 2017 · 2 comments
Open

Fix NPE in Windows around "!" check #528

rhyolight opened this issue Sep 6, 2017 · 2 comments

Comments

@rhyolight
Copy link
Member

NullPointerException: entry, in windows env, innerPath startsWith "", and jar.getEntry()return null

@cogmission
Copy link
Collaborator

cogmission commented Sep 6, 2017

@houkx

This has to be tested outside of Windows. I would suggest testing the Stream to see if it is null, and if it is, then in another try/catch, switching to your method?

In other words, create a block that catches the "normal" NPE (on Windows), then try to use your fix to create the URL in the way Windows likes...

@houkx
Copy link

houkx commented Sep 7, 2017

not the stream null, is the entry, jar.getEntry("\rec-center-hourly.csv") return null
so trigger the null check code in java.util.zip.ZipFile:
public InputStream getInputStream(ZipEntry entry) throws IOException {
if (entry == null) {
throw new NullPointerException("entry");// jar.getEntry("\rec-center-hourly.csv") ==null
}
// jar.getEntry("rec-center-hourly.csv") is not null, SO remove the preffix: "\"

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

Successfully merging a pull request may close this issue.

3 participants