예제 #1
0
 public void handleScannedItem(ScannedItem item) {
   if ("class".equals(item.getExtension()) && item.getName().indexOf('$') == -1) {
     try {
       handleClass(item.loadAsClass());
     } catch (NoClassDefFoundError e) {
       // Ignore errors with Tide classes depending on Gravity
     } catch (LinkageError e) {
       // Ignore errors with GraniteDS/Hibernate classes depending on Hibernate 3 when using
       // Hibernate 4
     } catch (Throwable t) {
       log.error(t, "Could not load class: %s", item);
     }
   }
 }
  public Class<?> loadClass(ScannedItem item) throws IOException, ClassFormatError {
    String name = item.getClassName();

    Class<?> clazz = findLoadedClass(name);
    if (clazz == null) {

      SecurityManager securityManager = System.getSecurityManager();
      if (securityManager != null) {
        int iLastDot = name.lastIndexOf('.');
        if (iLastDot != -1) securityManager.checkPackageAccess(name.substring(0, iLastDot));
      }

      byte[] data = item.getContent();
      clazz = defineClass(name, data, 0, data.length);
    }
    return clazz;
  }
예제 #3
0
 public boolean handleMarkerItem(ScannedItem item) {
   try {
     return handleProperties(item.loadAsProperties());
   } catch (Exception e) {
     log.error(e, "Could not load properties: %s", item);
   }
   return true;
 }