numenta/htm.java

Fix NPE in Windows around "!" check

rhyolight opened this issue · 2 comments

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

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

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