Program: 29587
Project: 29587
Buggy source:
public static void createResources(DeploymentContext dc,boolean embedded,boolean deployResources) throws ResourceException {
  String appName=getAppNameFromDeployCmdParams(dc);
  Application app=dc.getTransientAppMetaData(Application.APPLICATION,Application.class);
  Map<String,Map<String,List>> resourcesList=(Map<String,Map<String,List>>)dc.getTransientAppMetadata().get(APP_SCOPED_RESOURCES_MAP);
  if (resourcesList != null) {
    Map<String,List> appLevelResources=resourcesList.get(appName);
    if (appLevelResources != null) {
      List<org.glassfish.resources.api.Resource> connectorResources=appLevelResources.get(CONNECTOR_RESOURCES);
      createAppScopedResources(app,connectorResources,dc,embedded);
      List<org.glassfish.resources.api.Resource> nonConnectorResources=appLevelResources.get(NON_CONNECTOR_RESOURCES);
      createAppScopedResources(app,nonConnectorResources,dc,embedded);
    }
    List<Module> modules=app.getModule();
    if (modules != null) {
      for (      Module module : modules) {
        String actualModuleName=ResourceUtil.getActualModuleNameWithExtension(module.getName());
        if (!appName.equals(actualModuleName)) {
          Map<String,List> moduleResources=resourcesList.get(actualModuleName);
          if (moduleResources != null) {
            List<org.glassfish.resources.api.Resource> connectorResources=moduleResources.get(CONNECTOR_RESOURCES);
            createModuleScopedResources(app,module,connectorResources,dc,embedded);
            List<org.glassfish.resources.api.Resource> nonConnectorResources=moduleResources.get(NON_CONNECTOR_RESOURCES);
            createModuleScopedResources(app,module,nonConnectorResources,dc,embedded);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void createResources(DeploymentContext dc,boolean embedded,boolean deployResources) throws ResourceException {
  String appName=getAppNameFromDeployCmdParams(dc);
  Application app=dc.getTransientAppMetaData(Application.APPLICATION,Application.class);
  Map<String,Map<String,List>> resourcesList=(Map<String,Map<String,List>>)dc.getTransientAppMetadata().get(APP_SCOPED_RESOURCES_MAP);
  if (resourcesList != null) {
    Map<String,List> appLevelResources=resourcesList.get(appName);
    if (appLevelResources != null) {
      List<org.glassfish.resources.api.Resource> connectorResources=appLevelResources.get(CONNECTOR_RESOURCES);
      createAppScopedResources(app,connectorResources,dc,embedded);
      List<org.glassfish.resources.api.Resource> nonConnectorResources=appLevelResources.get(NON_CONNECTOR_RESOURCES);
      createAppScopedResources(app,nonConnectorResources,dc,embedded);
    }
    List<Module> modules=app.getModule();
    if (modules != null) {
      for (      Module module : modules) {
        String actualModuleName=ResourceUtil.getActualModuleNameWithExtension(module.getName());
        if (!appName.equals(actualModuleName)) {
          Map<String,List> moduleResources=resourcesList.get(actualModuleName);
          if (moduleResources != null) {
            List<org.glassfish.resources.api.Resource> connectorResources=moduleResources.get(CONNECTOR_RESOURCES);
            createModuleScopedResources(app,module,connectorResources,dc,embedded);
            List<org.glassfish.resources.api.Resource> nonConnectorResources=moduleResources.get(NON_CONNECTOR_RESOURCES);
            createModuleScopedResources(app,module,nonConnectorResources,dc,embedded);
          }
        }
      }
    }
  }
}