Mantis - Quercus
Viewing Issue Advanced Details
4229 minor always 09-27-10 14:07 09-28-10 06:25
domdorn  
 
normal  
new 4.0.11  
open  
none    
none  
0004229: Refactor: MergePath does not include WEB-INF/lib/*.jar in Glassfish v3/non-resin
MergePath does not include WEB-INF/lib/*.jar in a Glassfish v3 environment.
Currently only libs in glassfish's module directory currently get scanned.

MergePath -> _root -> _pathList =

[jar:(/home/domdorn/tmp/glassfish/release/server/glassfishv3/glassfish/modules/glassfish.jar)/, jar:(/home/domdorn/tmp/glassfish/release/server/glassfishv3/glassfish/lib/monitor/btrace-agent.jar)/, jar:(/home/domdorn/tmp/glassfish/release/server/glassfishv3/glassfish/modules/endorsed/jaxb-api-osgi.jar)/, jar:(/home/domdorn/tmp/glassfish/release/server/glassfishv3/glassfish/modules/endorsed/javax.annotation.jar)/, jar:(/home/domdorn/tmp/glassfish/release/server/glassfishv3/glassfish/modules/endorsed/webservices-api-osgi.jar)/, jar:(/opt/jdk/jdk1.6.0_21/jre/lib/resources.jar)/, jar:(/opt/jdk/jdk1.6.0_21/jre/lib/rt.jar)/, jar:(/opt/jdk/jdk1.6.0_21/jre/lib/jsse.jar)/, jar:(/opt/jdk/jdk1.6.0_21/jre/lib/jce.jar)/, jar:(/opt/jdk/jdk1.6.0_21/jre/lib/charsets.jar)/, jar:(/home/domdorn/tmp/glassfish/release/server/glassfishv3/glassfish/lib/monitor/btrace-boot.jar)/]

but should include
/WEB-INF/inject-16.jar
/WEB-INF/javamail-141.jar
/WEB-INF/quercus.jar
/WEB-INF/resin.jar
/WEB-INF/resin-kernel.jar



QA php/1t61.qa
would fail in a Glassfish Environment because
com.caucho.quercus.lib.pdf.AfmParser.parse:
MergePath mergePath = new MergePath();
    mergePath.addClassPath();

does not add the WEB-INF/lib folder.


Notes
(0004758)
domdorn   
09-28-10 06:25   
temporary fixed in

resin/modules/quercus/src/com/caucho/quercus/lib/pdf/AfmParser.java
resin/modules/quercus/src/com/caucho/quercus/lib/pdf/PDF.java

code involved:

Path p = _env.getQuercus().getPwd().lookup("WEB-INF/lib/");
webInfLibPath = String.valueOf(p);

    MergePath mergePath = new MergePath();
    mergePath.addClassPath();

    File webInfLibFile = new File(webInfLibPath);
    if(webInfLibPath != null && !webInfLibPath.isEmpty() && webInfLibFile.isDirectory())
    {
      Path webInfPath = Vfs.lookup(webInfLibFile.getAbsolutePath());
      for( File f : webInfLibFile.listFiles())
      {
        /*
        only look for files that are either jars or zips
         */
        if(f.isFile() && (f.getAbsolutePath().endsWith(".jar") || f.getAbsolutePath().endsWith(".zip")))
        {
          /*
          get a path object with the Jar relative to WEB-INF/lib
           */
          Path jarPath = webInfPath.lookup(f.getName());
          /*
            Encapsulate it as a JarPath, else mergePath.lookup does not look
            "into" the jar when looking for resources
           */
          mergePath.addMergePath(JarPath.create(jarPath));
        }
      }
    }
...
    Path path = mergePath.lookup("com/caucho/quercus/lib/pdf/font/" + name + ".afm");



This should probably go into MergePath.java or some other nice location to ease handling.