Beispiel #1
0
 // Forms new instance of factory
 @DSSafe(DSCat.SAFE_LIST)
 @DSGenerator(
     tool_name = "Doppelganger",
     tool_version = "2.0",
     generated_on = "2014-09-03 15:00:08.675 -0400",
     hash_original_method = "A22E26D7D508455A024AA2A1D979B72B",
     hash_generated_method = "95A1D0DF36A51AD50595EF2DE46F3F97")
 private static Object newInstance(String factoryName, Provider prv) throws SaslException {
   String msg = "auth.31"; // $NON-NLS-1$
   Object factory;
   ClassLoader cl = prv.getClass().getClassLoader();
   if (cl == null) {
     cl = ClassLoader.getSystemClassLoader();
   }
   try {
     factory = (Class.forName(factoryName, true, cl)).newInstance();
     return factory;
   } catch (IllegalAccessException e) {
     throw new SaslException(msg + factoryName, e);
   } catch (ClassNotFoundException e) {
     throw new SaslException(msg + factoryName, e);
   } catch (InstantiationException e) {
     throw new SaslException(msg + factoryName, e);
   }
 }
  @DSSource({DSSourceKind.SENSITIVE_UNCATEGORIZED})
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:35:58.971 -0500",
      hash_original_method = "EA4DC0433A5C7A22C1BA1C659599A634",
      hash_generated_method = "CBA9A0CE4A50ED64B8154F5699F116CF")
  public ClassLoader getClassLoader(String zip, String libPath, ClassLoader parent) {
    /*
     * This is the parent we use if they pass "null" in.  In theory
     * this should be the "system" class loader; in practice we
     * don't use that and can happily (and more efficiently) use the
     * bootstrap class loader.
     */
    ClassLoader baseParent = ClassLoader.getSystemClassLoader().getParent();

    synchronized (mLoaders) {
      if (parent == null) {
        parent = baseParent;
      }

      /*
       * If we're one step up from the base class loader, find
       * something in our cache.  Otherwise, we create a whole
       * new ClassLoader for the zip archive.
       */
      if (parent == baseParent) {
        ClassLoader loader = mLoaders.get(zip);
        if (loader != null) {
          return loader;
        }

        PathClassLoader pathClassloader = new PathClassLoader(zip, libPath, parent);

        mLoaders.put(zip, pathClassloader);
        return pathClassloader;
      }

      return new PathClassLoader(zip, parent);
    }
  }