Program: 64163
Project: 64163
Buggy source:
@Override public void buildSessions(){
  XRDynamicClassLoader xrdecl=new XRDynamicClassLoader(parentClassLoader);
  Project orProject=null;
  if (DBWS_OR_STREAM.size() != 0) {
    orProject=XMLProjectReader.read(new StringReader(DBWS_OR_STREAM.toString()),xrdecl);
  }
 else {
    orProject=new Project();
    orProject.setName(builder.getProjectName().concat(OR_PRJ_SUFFIX));
  }
  Project oxProject=null;
  if (DBWS_OX_STREAM.size() != 0) {
    Map<String,DBWSMetadataSource> metadataMap=new HashMap<String,DBWSMetadataSource>();
    StreamSource xml=new StreamSource(new StringReader(DBWS_OX_STREAM.toString()));
    try {
      JAXBContext jc=JAXBContext.newInstance(XmlBindingsModel.class);
      Unmarshaller unmarshaller=jc.createUnmarshaller();
      JAXBElement<XmlBindingsModel> jaxbElt=unmarshaller.unmarshal(xml,XmlBindingsModel.class);
      XmlBindingsModel model=jaxbElt.getValue();
      for (      XmlBindings xmlBindings : model.getBindingsList()) {
        metadataMap.put(xmlBindings.getPackageName(),new DBWSMetadataSource(xmlBindings));
      }
    }
 catch (    JAXBException jaxbex) {
      jaxbex.printStackTrace();
    }
    Map<String,Map<String,DBWSMetadataSource>> properties=new HashMap<String,Map<String,DBWSMetadataSource>>();
    properties.put(JAXBContextProperties.OXM_METADATA_SOURCE,metadataMap);
    try {
      org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext jCtx=org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM(xrdecl,properties);
      oxProject=jCtx.getXMLContext().getSession(0).getProject();
      if (oxProject.getAliasDescriptors() != null) {
        Map<String,ClassDescriptor> aliasDescriptors=new HashMap<String,ClassDescriptor>();
        for (        Object key : oxProject.getAliasDescriptors().keySet()) {
          String alias=key.toString();
          XMLDescriptor xdesc=(XMLDescriptor)oxProject.getAliasDescriptors().get(alias);
          String defaultRootElement=xdesc.getDefaultRootElement();
          String proposedAlias=defaultRootElement;
          if (defaultRootElement.endsWith(TYPE_STR)) {
            proposedAlias=defaultRootElement.substring(0,defaultRootElement.lastIndexOf(TYPE_STR));
          }
          proposedAlias=proposedAlias.toLowerCase();
          xdesc.setAlias(proposedAlias);
          aliasDescriptors.put(proposedAlias,xdesc);
          for (          DatabaseMapping mapping : xdesc.getMappings()) {
            if (mapping instanceof XMLBinaryDataMapping) {
              ((XMLBinaryDataMapping)mapping).setAttributeClassification(APBYTE);
              ((XMLBinaryDataMapping)mapping).setAttributeClassificationName(APBYTE.getName());
            }
          }
        }
        oxProject.setAliasDescriptors(aliasDescriptors);
      }
    }
 catch (    JAXBException e) {
      e.printStackTrace();
    }
  }
 else {
    oxProject=new Project();
  }
  oxProject.setName(builder.getProjectName().concat(OX_PRJ_SUFFIX));
  DatasourceLogin login=new DatabaseLogin();
  login.setUserName(username);
  login.setPassword(password);
  ((DatabaseLogin)login).setConnectionString(url);
  ((DatabaseLogin)login).setDriverClassName(DATABASE_PLATFORM);
  Platform platform=builder.getDatabasePlatform();
  ConversionManager conversionManager=platform.getConversionManager();
  if (conversionManager != null) {
    conversionManager.setLoader(xrdecl);
  }
  login.setDatasourcePlatform(platform);
  ((DatabaseLogin)login).bindAllParameters();
  orProject.setDatasourceLogin(login);
  login=(DatasourceLogin)oxProject.getDatasourceLogin();
  if (login != null) {
    platform=login.getDatasourcePlatform();
    if (platform != null) {
      conversionManager=platform.getConversionManager();
      if (conversionManager != null) {
        conversionManager.setLoader(xrdecl);
      }
    }
  }
  ProjectHelper.fixOROXAccessors(orProject,oxProject);
  DatabaseSession databaseSession=orProject.createDatabaseSession();
  if (OFF_STR.equalsIgnoreCase(builder.getLogLevel())) {
    databaseSession.dontLogMessages();
  }
 else {
    databaseSession.setLogLevel(AbstractSessionLog.translateStringToLoggingLevel(builder.getLogLevel()));
  }
  xrService.setORSession(databaseSession);
  xrService.setXMLContext(new XMLContext(oxProject));
  xrService.setOXSession(xrService.getXMLContext().getSession(0));
}

Fixed version (ground truth):
@Override public void buildSessions(){
  XRDynamicClassLoader xrdecl=new XRDynamicClassLoader(parentClassLoader);
  DatasourceLogin login=new DatabaseLogin();
  login.setUserName(username);
  login.setPassword(password);
  ((DatabaseLogin)login).setConnectionString(url);
  ((DatabaseLogin)login).setDriverClassName(DATABASE_PLATFORM);
  Platform platform=builder.getDatabasePlatform();
  ConversionManager conversionManager=platform.getConversionManager();
  if (conversionManager != null) {
    conversionManager.setLoader(xrdecl);
  }
  login.setDatasourcePlatform(platform);
  ((DatabaseLogin)login).bindAllParameters();
  Project orProject=null;
  if (DBWS_OR_STREAM.size() != 0) {
    MetadataProcessor processor=new MetadataProcessor(new XRPersistenceUnitInfo(xrdecl),new DatabaseSessionImpl(login),xrdecl,false,true,false,false,false,null,null);
    processor.setMetadataSource(new JPAMetadataSource(xrdecl,new StringReader(DBWS_OR_STREAM.toString())));
    PersistenceUnitProcessor.processORMetadata(processor,true,PersistenceUnitProcessor.Mode.ALL);
    processor.addNamedQueries();
    orProject=processor.getProject().getProject();
  }
 else {
    orProject=new Project();
  }
  orProject.setName(builder.getProjectName().concat(OR_PRJ_SUFFIX));
  orProject.setDatasourceLogin(login);
  DatabaseSession databaseSession=orProject.createDatabaseSession();
  if (OFF_STR.equalsIgnoreCase(builder.getLogLevel())) {
    databaseSession.dontLogMessages();
  }
 else {
    databaseSession.setLogLevel(AbstractSessionLog.translateStringToLoggingLevel(builder.getLogLevel()));
  }
  xrService.setORSession(databaseSession);
  orProject.convertClassNamesToClasses(xrdecl);
  Project oxProject=null;
  if (DBWS_OX_STREAM.size() != 0) {
    Map<String,OXMMetadataSource> metadataMap=new HashMap<String,OXMMetadataSource>();
    StreamSource xml=new StreamSource(new StringReader(DBWS_OX_STREAM.toString()));
    try {
      JAXBContext jc=JAXBContext.newInstance(XmlBindingsModel.class);
      Unmarshaller unmarshaller=jc.createUnmarshaller();
      JAXBElement<XmlBindingsModel> jaxbElt=unmarshaller.unmarshal(xml,XmlBindingsModel.class);
      XmlBindingsModel model=jaxbElt.getValue();
      for (      XmlBindings xmlBindings : model.getBindingsList()) {
        metadataMap.put(xmlBindings.getPackageName(),new OXMMetadataSource(xmlBindings));
      }
    }
 catch (    JAXBException jaxbex) {
      jaxbex.printStackTrace();
    }
    Map<String,Map<String,OXMMetadataSource>> properties=new HashMap<String,Map<String,OXMMetadataSource>>();
    properties.put(JAXBContextProperties.OXM_METADATA_SOURCE,metadataMap);
    try {
      org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext jCtx=org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromOXM(xrdecl,properties);
      oxProject=jCtx.getXMLContext().getSession(0).getProject();
    }
 catch (    JAXBException e) {
      e.printStackTrace();
    }
  }
 else {
    oxProject=new Project();
  }
  oxProject.setName(builder.getProjectName().concat(OX_PRJ_SUFFIX));
  login=(DatasourceLogin)oxProject.getDatasourceLogin();
  if (login != null) {
    platform=login.getDatasourcePlatform();
    if (platform != null) {
      conversionManager=platform.getConversionManager();
      if (conversionManager != null) {
        conversionManager.setLoader(xrdecl);
      }
    }
  }
  xrService.setXMLContext(new XMLContext(oxProject));
  xrService.setOXSession(xrService.getXMLContext().getSession(0));
  alignDescriptorAliases(oxProject,orProject,xrdecl);
  ProjectHelper.fixOROXAccessors(orProject,oxProject);
}