htm.java icon indicating copy to clipboard operation
htm.java copied to clipboard

Fix NPE in Windows around "!" check

Open rhyolight opened this issue 8 years ago • 2 comments

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

rhyolight avatar Sep 06 '17 15:09 rhyolight

@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...

cogmission avatar Sep 06 '17 15:09 cogmission

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: "\"

houkx avatar Sep 07 '17 02:09 houkx