Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
JSP support to give more helpful error message on corrupted zip-s
Browse files Browse the repository at this point in the history
  • Loading branch information
ddekany committed Aug 31, 2015
1 parent 3de562f commit a26e832
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/freemarker/ext/jsp/TaglibFactory.java
Expand Up @@ -48,6 +48,7 @@
import java.util.jar.JarFile;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipInputStream;

import javax.servlet.ServletContext;
Expand Down Expand Up @@ -721,6 +722,16 @@ private void addTldLocationsFromJarDirectoryEntryURL(final URL jarBaseEntryUrl)
} finally {
zipIn.close();
}
} catch (ZipException e) {
// ZipException messages miss the zip URL
IOException ioe = new IOException("Error reading ZIP (see cause excepetion) from: "
+ rawJarContentUrlEF);
try {
ioe.initCause(e);
} catch (Exception e2) {
throw e;
}
throw ioe;
} finally {
in.close();
}
Expand Down

0 comments on commit a26e832

Please sign in to comment.