Improve diagnostics when reading a nested jar throws a runtime exception

Previously, only IOExceptions were caught and wrapped in a new
IOException that included the name of the nested entry that was
being read.

Following this commit, any Exception is caught and wrapped so that the
problematic entry can be identified in more failure scenarios.

Closes gh-8711
This commit is contained in:
Andy Wilkinson
2017-03-24 10:30:04 +00:00
parent aa25bfb0e0
commit e6cfb4e5fb

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -247,7 +247,7 @@ public class JarFile extends java.util.jar.JarFile {
try {
return createJarFileFromEntry(entry);
}
catch (IOException ex) {
catch (Exception ex) {
throw new IOException(
"Unable to open nested jar file '" + entry.getName() + "'", ex);
}