rzo1 commented on code in PR #57:
URL: https://github.com/apache/geronimo-xbean/pull/57#discussion_r3530909103
##########
xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java:
##########
@@ -200,28 +195,20 @@ private List<String> jar(URL location) throws IOException
{
InputStream in = url.openStream();
try {
JarInputStream jarStream = new JarInputStream(in);
- return jar(jarStream);
+ jar(jarStream);
} finally {
in.close();
}
}
- private List<String> jar(JarInputStream jarStream) throws IOException {
- List<String> classNames = new ArrayList<String>();
-
+ private void jar(JarInputStream jarStream) throws IOException {
JarEntry entry;
while ((entry = jarStream.getNextJarEntry()) != null) {
if (entry.isDirectory() || !entry.getName().endsWith(".class")) {
continue;
}
- String className = entry.getName();
- className = className.replaceFirst(".class$", "");
- if (className.contains(".")) continue;
- className = className.replace('/', '.');
- classNames.add(className);
+ readClassDef(jarStream);
Review Comment:
Previously class names were collected first and each one was read via
readClassDef(String), which caught IOException per class and just recorded it
in classesNotLoaded. Now readClassDef(InputStream) is called inline from the
scan loops, so a single bad .class entry (corrupt/truncated entry, unreadable
file) propagates out of jar(JarInputStream) / scanDir(File) and is only caught
by the per-URL catch (Exception e) { e.printStackTrace(); } in the constructor
- silently skipping all remaining entries of that jar/directory.
Perhaps just try/catch it to have previous behaviour?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]