Program: 30122
Project: 30122
Buggy source:
/** 
 * Prepares the application bits for running in the application server. For certain cases, this is exploding the jar file to a format the ContractProvider instance is expecting, generating non portable artifacts and other application specific tasks. Failure to prepare should throw an exception which will cause the overall deployment to fail.
 * @param dc deployment context
 * @return true if the prepare phase was successful
 */
@Override public boolean prepare(DeploymentContext dc){
  try {
    Application app=dc.getModuleMetaData(Application.class);
    if (app == null) {
      logger.severe(format(rb.getString("String_Node_Str")));
      return false;
    }
    BundleDescriptor bundle=DOLUtils.getCurrentBundleForContext(dc);
    String moduleCP=getModuleClassPath(dc);
    List<URL> moduleCPUrls=ASClassLoaderUtil.getURLsFromClasspath(moduleCP,File.pathSeparator,null);
    ClassLoader oldCl=Thread.currentThread().getContextClassLoader();
    URLClassLoader newCl=new URLClassLoader(ASClassLoaderUtil.convertURLListToArray(moduleCPUrls),oldCl);
    Thread.currentThread().setContextClassLoader(newCl);
    WebServicesDescriptor wsDesc=bundle.getWebServices();
    for (    WebService ws : wsDesc.getWebServices()) {
      if ((new WsUtil()).isJAXWSbasedService(ws)) {
        setupJaxWSServiceForDeployment(dc,ws);
      }
 else {
        JAXRPCCodeGenFacade facade=habitat.getByContract(JAXRPCCodeGenFacade.class);
        if (facade != null) {
          facade.run(habitat,dc,moduleCP,false);
        }
 else {
          throw new DeploymentException(rb.getString("String_Node_Str"));
        }
      }
    }
    doWebServicesDeployment(app,dc);
    Thread.currentThread().setContextClassLoader(oldCl);
    WebServicesContainer container=habitat.getComponent(WebServicesContainer.class);
    WebServicesDeploymentMBean bean=container.getDeploymentBean();
    WebServiceDeploymentNotifier notifier=getDeploymentNotifier();
    bean.deploy(wsDesc,notifier);
    return true;
  }
 catch (  Exception ex) {
    RuntimeException re=new RuntimeException(ex.getMessage());
    re.initCause(ex);
    throw re;
  }
}

Fixed version (ground truth):
/** 
 * Prepares the application bits for running in the application server. For certain cases, this is exploding the jar file to a format the ContractProvider instance is expecting, generating non portable artifacts and other application specific tasks. Failure to prepare should throw an exception which will cause the overall deployment to fail.
 * @param dc deployment context
 * @return true if the prepare phase was successful
 */
@Override public boolean prepare(DeploymentContext dc){
  try {
    Application app=dc.getModuleMetaData(Application.class);
    if (app == null) {
      logger.severe(format(rb.getString("String_Node_Str")));
      return false;
    }
    BundleDescriptor bundle=DOLUtils.getCurrentBundleForContext(dc);
    String moduleCP=getModuleClassPath(dc);
    final List<URL> moduleCPUrls=ASClassLoaderUtil.getURLsFromClasspath(moduleCP,File.pathSeparator,null);
    final ClassLoader oldCl=Thread.currentThread().getContextClassLoader();
    URLClassLoader newCl=AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>(){
      @Override public URLClassLoader run(){
        return new URLClassLoader(ASClassLoaderUtil.convertURLListToArray(moduleCPUrls),oldCl);
      }
    }
);
    Thread.currentThread().setContextClassLoader(newCl);
    WebServicesDescriptor wsDesc=bundle.getWebServices();
    for (    WebService ws : wsDesc.getWebServices()) {
      if ((new WsUtil()).isJAXWSbasedService(ws)) {
        setupJaxWSServiceForDeployment(dc,ws);
      }
 else {
        JAXRPCCodeGenFacade facade=habitat.getByContract(JAXRPCCodeGenFacade.class);
        if (facade != null) {
          facade.run(habitat,dc,moduleCP,false);
        }
 else {
          throw new DeploymentException(rb.getString("String_Node_Str"));
        }
      }
    }
    doWebServicesDeployment(app,dc);
    Thread.currentThread().setContextClassLoader(oldCl);
    WebServicesContainer container=habitat.getComponent(WebServicesContainer.class);
    WebServicesDeploymentMBean bean=container.getDeploymentBean();
    WebServiceDeploymentNotifier notifier=getDeploymentNotifier();
    bean.deploy(wsDesc,notifier);
    return true;
  }
 catch (  Exception ex) {
    RuntimeException re=new RuntimeException(ex.getMessage());
    re.initCause(ex);
    throw re;
  }
}