Scanning non existing jars, files..on classpath..

451 views
Skip to first unread message

iker.ol...@gmail.com

unread,
Apr 10, 2014, 1:58:23 PM4/10/14
to google-code...@googlegroups.com
I have an issue when in my classpath there is non exinting jar, jar without no permission,  with reflections version 0.9.9-RC1 , for example running on Weblogic


could not create Dir using jarFile from url file:/D:/Servers/Oracle10.3.5/patch_wls1035/profiles/default/sys_manifest_classpath/weblogic_patch.jar. skipping.

java.lang.NullPointerException: null

       at java.util.zip.ZipFile.<init>(ZipFile.java:108) ~[na:1.6.0_24]

       at java.util.jar.JarFile.<init>(JarFile.java:135) ~[na:1.6.0_24]

       at java.util.jar.JarFile.<init>(JarFile.java:99) ~[na:1.6.0_24]

       at org.reflections.vfs.Vfs$DefaultUrlTypes$1.createDir(Vfs.java:207) ~[reflections-0.9.9-RC1.jar:na]

       at org.reflections.vfs.Vfs.fromURL(Vfs.java:99) [reflections-0.9.9-RC1.jar:na]

       at org.reflections.vfs.Vfs.fromURL(Vfs.java:91) [reflections-0.9.9-RC1.jar:na]

       at org.reflections.Reflections.scan(Reflections.java:231) [reflections-0.9.9-RC1.jar:na]

       at org.reflections.Reflections.scan(Reflections.java:204) [reflections-0.9.9-RC1.jar:na]

       at org.reflections.Reflections.<init>(Reflections.java:129) [reflections-0.9.9-RC1.jar:na]

It looks a known issue. 

The key is  in the class  REFLECTION  the are two method "scan"

1.  protected method scan :
2.  public method scan :


The matter is that ....i n the "protected method scan"  never is caugth the ReflectionsException .

     

     for (final URL url : configuration.getUrls()) {

            try {

                if (executorService != null) {

                    futures.add(executorService.submit(new Runnable() {

                        public void run() {

                            if (log != null && log.isDebugEnabled()) log.debug("[" + Thread.currentThread().toString() + "] scanning " + url);

                            scan(url);

                        }

                    }));

                } else {

                    scan(url);

                }

                scannedUrls++;

            } catch (ReflectionsException e) {

                if (log != null && log.isWarnEnabled()) log.warn("could not create Vfs.Dir from url. ignoring the exception and continuing", e);

            }  

        }

 

So  the method breaks.....What i did???  Encapsule  the posible exceptions of the PUBLIC method "scan" AND...  throw a new ReflectionExcpetion : 

 

  } catch (Exception e) {

                if (log != null && log.isWarnEnabled()) log.warn("<Exception>could not create Vfs.Dir from url " + url +" ignoring the exception and continuing", e);

                throw new ReflectionsException(e):

            } catch (Throwable e) {

                if (log != null && log.isWarnEnabled()) log.warn("<Throwable>could not create Vfs.Dir from url " + url +" ignoring the exception and continuing", e);

throw new ReflectionsException(e):

 

            }

        } 


Reflections.java
Reply all
Reply to author
Forward
0 new messages