Program: 176548
Project: 176548
Buggy source:
/** 
 * Scan class and put metadata.
 * @param bits the bits
 * @param reader the reader
 * @param entityMetadataMap the entity metadata map
 * @param entityNameToClassMap the entity name to class map
 * @param keyDiscriptor
 * @param persistence unit the persistence unit.
 * @throws IOException Signals that an I/O exception has occurred.
 */
private List<Class<?>> scanClassAndPutMetadata(InputStream bits,Reader reader,Map<String,EntityMetadata> entityMetadataMap,Map<String,Class<?>> entityNameToClassMap,String persistenceUnit,String client,Map<String,List<String>> clazzToPuMap,Map<String,IdDiscriptor> entityNameToKeyDiscriptorMap) throws IOException {
  DataInputStream dstream=new DataInputStream(new BufferedInputStream(bits));
  ClassFile cf=null;
  String className=null;
  List<Class<?>> classes=new ArrayList<Class<?>>();
  try {
    cf=new ClassFile(dstream);
    className=cf.getName();
    List<String> annotations=new ArrayList<String>();
    reader.accumulateAnnotations(annotations,(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.visibleTag));
    reader.accumulateAnnotations(annotations,(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.invisibleTag));
    for (    String validAnn : reader.getValidAnnotations()) {
      if (annotations.contains(validAnn)) {
        Class<?> clazz=this.getClass().getClassLoader().loadClass(className);
        if (entityNameToClassMap.containsKey(clazz.getSimpleName()) && !entityNameToClassMap.get(clazz.getSimpleName()).getName().equals(clazz.getName())) {
          throw new MetamodelLoaderException("String_Node_Str" + entityNameToClassMap.get(clazz.getSimpleName()).getName() + "String_Node_Str"+ clazz.getName()+ "String_Node_Str"+ "String_Node_Str"+ persistenceUnit);
        }
        entityNameToClassMap.put(clazz.getSimpleName(),clazz);
        EntityMetadata metadata=entityMetadataMap.get(clazz);
        if (null == metadata) {
          log.debug("String_Node_Str" + clazz.getName());
synchronized (clazz) {
            if (null == metadata) {
              MetadataBuilder metadataBuilder=new MetadataBuilder(persistenceUnit,client,KunderaCoreUtils.getExternalProperties(persistenceUnit,externalProperyMap,persistenceUnits));
              metadata=metadataBuilder.buildEntityMetadata(clazz);
              if (metadata != null) {
                entityMetadataMap.put(clazz.getName(),metadata);
                mapClazztoPu(clazz,persistenceUnit,clazzToPuMap);
                processGeneratedValueAnnotation(clazz,persistenceUnit,metadata,entityNameToKeyDiscriptorMap);
              }
            }
          }
        }
        onValidateClientProperties(classes,clazz,persistenceUnit);
      }
    }
  }
 catch (  ClassNotFoundException e) {
    log.error("String_Node_Str" + className + "String_Node_Str");
  }
 finally {
    dstream.close();
    bits.close();
  }
  return classes;
}

Fixed version (ground truth):
/** 
 * Scan class and put metadata.
 * @param bits the bits
 * @param reader the reader
 * @param entityMetadataMap the entity metadata map
 * @param entityNameToClassMap the entity name to class map
 * @param keyDiscriptor
 * @param persistence unit the persistence unit.
 * @throws IOException Signals that an I/O exception has occurred.
 */
private List<Class<?>> scanClassAndPutMetadata(InputStream bits,Reader reader,Map<String,EntityMetadata> entityMetadataMap,Map<String,Class<?>> entityNameToClassMap,String persistenceUnit,String client,Map<String,List<String>> clazzToPuMap,Map<String,IdDiscriptor> entityNameToKeyDiscriptorMap) throws IOException {
  DataInputStream dstream=new DataInputStream(new BufferedInputStream(bits));
  ClassFile cf=null;
  String className=null;
  List<Class<?>> classes=new ArrayList<Class<?>>();
  try {
    cf=new ClassFile(dstream);
    className=cf.getName();
    List<String> annotations=new ArrayList<String>();
    reader.accumulateAnnotations(annotations,(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.visibleTag));
    reader.accumulateAnnotations(annotations,(AnnotationsAttribute)cf.getAttribute(AnnotationsAttribute.invisibleTag));
    for (    String validAnn : reader.getValidAnnotations()) {
      if (annotations.contains(validAnn)) {
        Class<?> clazz=this.getClass().getClassLoader().loadClass(className);
        if (entityNameToClassMap.containsKey(clazz.getSimpleName()) && !entityNameToClassMap.get(clazz.getSimpleName()).getName().equals(clazz.getName())) {
          throw new MetamodelLoaderException("String_Node_Str" + entityNameToClassMap.get(clazz.getSimpleName()).getName() + "String_Node_Str"+ clazz.getName()+ "String_Node_Str"+ "String_Node_Str"+ persistenceUnit);
        }
        entityNameToClassMap.put(clazz.getSimpleName(),clazz);
        EntityMetadata metadata=entityMetadataMap.get(clazz);
        if (null == metadata) {
          log.debug("String_Node_Str" + clazz.getName());
synchronized (clazz) {
            if (null == metadata) {
              MetadataBuilder metadataBuilder=new MetadataBuilder(persistenceUnit,client,KunderaCoreUtils.getExternalProperties(persistenceUnit,externalPropertyMap,persistenceUnits));
              metadata=metadataBuilder.buildEntityMetadata(clazz);
              if (metadata != null) {
                entityMetadataMap.put(clazz.getName(),metadata);
                mapClazztoPu(clazz,persistenceUnit,clazzToPuMap);
                processGeneratedValueAnnotation(clazz,persistenceUnit,metadata,entityNameToKeyDiscriptorMap);
              }
            }
          }
        }
        onValidateClientProperties(classes,clazz,persistenceUnit);
      }
    }
  }
 catch (  ClassNotFoundException e) {
    log.error("String_Node_Str" + className + "String_Node_Str");
  }
 finally {
    dstream.close();
    bits.close();
  }
  return classes;
}