Changeset 4391


Ignore:
Timestamp:
Aug 12, 2008, 2:38:44 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

References #1084: Add logging to JarClassLoader?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/JarClassLoader.java

    r4390 r4391  
    207207  {
    208208    super(Thread.currentThread().getContextClassLoader());
     209    log.debug("Creating JarClassLoader: file=" + jarPath);
    209210    mainJarFile = new File(jarPath);
    210211    if (!mainJarFile.exists() || !mainJarFile.isFile())
     
    223224    -------------------------------------------
    224225  */
     226  @Override
    225227  protected Class<?> findClass(String name)
    226228    throws ClassNotFoundException
    227229  {
     230    log.debug("findClass: " + name);
    228231    File file = classPath.get(classNameToPath(name));
    229232    if (file == null)
     
    235238  }
    236239 
     240  @Override
    237241  protected URL findResource(String name)
    238242  {
     243    log.debug("findResource: " + name);
    239244    URL url = null;
    240245    try
     
    246251        url = new URL(newUrl);
    247252      }
     253      else
     254      {
     255        log.debug("Not found: " + name);
     256      }
    248257    }
    249258    catch (MalformedURLException ex)
     
    254263  }
    255264 
    256 
     265  @Override
     266  protected Class<?> loadClass(String name, boolean resolve)
     267    throws ClassNotFoundException
     268  {
     269    if (log.isDebugEnabled()) log.debug("loadClass: " + name);
     270    return super.loadClass(name, resolve);
     271  }
     272 
     273  @Override
     274  public URL getResource(String name)
     275  {
     276    if (log.isDebugEnabled()) log.debug("getResource: " + name);
     277    return super.getResource(name);
     278  }
    257279  // -------------------------------------------
    258280
     
    311333    throws IOException
    312334  {
     335    log.debug("loadJarFile: file=" + file);
    313336    jarFiles.add(new JarInfo(file));
    314337    if (!file.exists() || !file.isFile())
     
    322345    {
    323346      JarEntry jarEntry = entries.nextElement();
     347      if (jarEntry.isDirectory()) continue;
    324348      String name = jarEntry.getName();
    325      
    326349      if (!classPath.containsKey(name))
    327350      {
     351        log.trace("Adding: " + name);
    328352        classPath.put(name, file);
     353      }
     354      else
     355      {
     356        log.warn("Duplicate resource: '" + name + "' in '" + file + "'; also exists in '"
     357            + classPath.get(name) + "'");
    329358      }
    330359    }
     
    338367        {
    339368          String cp = attr.getValue(Attributes.Name.CLASS_PATH);
     369          log.debug("Class path of JAR file '" + file + "': " + cp);
    340370          if (cp != null)
    341371          {
     
    365395    throws ClassNotFoundException
    366396  {
     397    log.debug("loadClassData: " + name + " from file: " + file);
    367398    InputStream in = null;
    368399    try
     
    384415        if (numRead == -1) break;
    385416        totalRead += numRead;
     417        log.debug("loadClassData: size=" + classSize + "; loaded=" + totalRead);
    386418      }
    387419      if (totalRead != classSize)
Note: See TracChangeset for help on using the changeset viewer.