Re: [PR] Fb perf [geronimo-xbean]

rzo1 (via GitHub) <[email protected]> Mon, 06 Jul 2026 17:35:56 -0000
Newsgroups gmane.comp.java.geronimo.devel
Message-ID <PR_kwDOAAOrUs7ubJnH-4868a12b-286c-45e2-be75-bbebf46df69c@gitbox.apache.org>
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. 



-- 
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: dev-unsubscribe-nmThH5wfGryY1pf4d8vP8EB+6BGkLq7r@public.gmane.org

For queries about this service, please contact Infrastructure at:
users-pF6z+fRhj9EyzMRdD/[email protected]