struberg commented on code in PR #57:
URL: https://github.com/apache/geronimo-xbean/pull/57#discussion_r3531125006


##########
xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java:
##########
@@ -162,36 +157,36 @@ protected Class<?> loadClass(String fixedName) throws 
ClassNotFoundException {
 
 
 
-    private List<String> file(URL location) {
-        List<String> classNames = new ArrayList<String>();
+    private void file(URL location) throws IOException {
         File dir = new File(URLDecoder.decode(location.getPath()));
         if (dir.getName().equals("META-INF")) {
             dir = dir.getParentFile(); // Scrape "META-INF" off
         }
         if (dir.isDirectory()) {
-            scanDir(dir, classNames, "");
+            scanDir(dir);
         }
-        return classNames;
     }
 
-    private void scanDir(File dir, List<String> classNames, String 
packageName) {
+    private void scanDir(File dir) throws IOException {
         File[] files = dir.listFiles();
         if (files == null) {
             return;
         }
         for (File file : files) {
             if (file.isDirectory()) {
-                scanDir(file, classNames, packageName + file.getName() + ".");
+                scanDir(file);
             } else if (file.getName().endsWith(".class")) {
-                String name = file.getName();
-                name = name.replaceFirst(".class$", "");
-                if (name.contains(".")) continue;

Review Comment:
   now solved with a 
   ```
   if (name.indexOf('.') != name.length()-6) {
       continue;
   }
   ```
   
   This has  the benefit of not performing a potential memory allocation but 
only reading in the mem.



-- 
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]

Reply via email to