Program: 59374
Project: 59374
Buggy source:
/** 
 * This method annotate all controllers if has Geo Fields
 * @param path
 */
public void annotateAllGeoEntityControllers(List<String> paths){
  Set<ClassOrInterfaceTypeDetails> entityControllers=typeLocationService.findClassesOrInterfaceDetailsWithAnnotation(ROO_WEB_SCAFFOLD_ANNOTATION);
  Validate.notNull(entityControllers,"String_Node_Str");
  List<JavaType> mapControllers=GeoUtils.getAllMapsControllers(typeLocationService);
  Iterator<ClassOrInterfaceTypeDetails> it=entityControllers.iterator();
  while (it.hasNext()) {
    ClassOrInterfaceTypeDetails entityController=it.next();
    AnnotationMetadata scaffoldAnnotation=entityController.getAnnotation(ROO_WEB_SCAFFOLD_ANNOTATION);
    Object entity=scaffoldAnnotation.getAttribute("String_Node_Str").getValue();
    ClassOrInterfaceTypeDetails entityDetails=typeLocationService.getTypeDetails((JavaType)entity);
    List<? extends FieldMetadata> entityFields=entityDetails.getDeclaredFields();
    Iterator<? extends FieldMetadata> fieldsIterator=entityFields.iterator();
    while (fieldsIterator.hasNext()) {
      FieldMetadata field=fieldsIterator.next();
      JavaType fieldType=field.getFieldType();
      JavaPackage fieldPackage=fieldType.getPackage();
      if (fieldPackage.toString().equals("String_Node_Str")) {
        ClassOrInterfaceTypeDetailsBuilder detailsBuilder=new ClassOrInterfaceTypeDetailsBuilder(entityController);
        AnnotationMetadataBuilder annotationBuilder=new AnnotationMetadataBuilder(GVNIX_WEB_ENTITY_MAP_LAYER_ANNOTATION);
        detailsBuilder.updateTypeAnnotation(annotationBuilder.build());
        typeManagementService.createOrUpdateTypeOnDisk(detailsBuilder.build());
        if (!(paths.size() == 1 && paths.get(0).equals("String_Node_Str"))) {
          Iterator<String> pathIterator=paths.iterator();
          while (pathIterator.hasNext()) {
            String currentPath=pathIterator.next();
            JavaType mapController=GeoUtils.getMapControllerByPath(currentPath,typeLocationService);
            annotateMapController(mapController,typeLocationService,typeManagementService,entityController.getType());
          }
        }
 else {
          for (          JavaType mapController : mapControllers) {
            annotateMapController(mapController,typeLocationService,typeManagementService,entityController.getType());
          }
        }
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This method annotate all controllers if has Geo Fields
 * @param path
 */
public void annotateAllGeoEntityControllers(List<String> paths){
  Set<ClassOrInterfaceTypeDetails> entityControllers=typeLocationService.findClassesOrInterfaceDetailsWithAnnotation(ROO_WEB_SCAFFOLD_ANNOTATION);
  Validate.notNull(entityControllers,"String_Node_Str");
  List<JavaType> mapControllers=GeoUtils.getAllMapsControllers(typeLocationService);
  Iterator<ClassOrInterfaceTypeDetails> it=entityControllers.iterator();
  while (it.hasNext()) {
    ClassOrInterfaceTypeDetails entityController=it.next();
    AnnotationMetadata scaffoldAnnotation=entityController.getAnnotation(ROO_WEB_SCAFFOLD_ANNOTATION);
    Object entity=scaffoldAnnotation.getAttribute("String_Node_Str").getValue();
    ClassOrInterfaceTypeDetails entityDetails=typeLocationService.getTypeDetails((JavaType)entity);
    AnnotationMetadata gvNIXEntityMapLayerAnnotation=entityDetails.getAnnotation(GVNIX_ENTITY_MAP_LAYER_ANNOTATION);
    if (gvNIXEntityMapLayerAnnotation != null) {
      List<? extends FieldMetadata> entityFields=entityDetails.getDeclaredFields();
      Iterator<? extends FieldMetadata> fieldsIterator=entityFields.iterator();
      while (fieldsIterator.hasNext()) {
        FieldMetadata field=fieldsIterator.next();
        JavaType fieldType=field.getFieldType();
        JavaPackage fieldPackage=fieldType.getPackage();
        if (fieldPackage.toString().equals("String_Node_Str")) {
          ClassOrInterfaceTypeDetailsBuilder detailsBuilder=new ClassOrInterfaceTypeDetailsBuilder(entityController);
          AnnotationMetadataBuilder annotationBuilder=new AnnotationMetadataBuilder(GVNIX_WEB_ENTITY_MAP_LAYER_ANNOTATION);
          detailsBuilder.updateTypeAnnotation(annotationBuilder.build());
          typeManagementService.createOrUpdateTypeOnDisk(detailsBuilder.build());
          if (!(paths.size() == 1 && paths.get(0).equals("String_Node_Str"))) {
            Iterator<String> pathIterator=paths.iterator();
            while (pathIterator.hasNext()) {
              String currentPath=pathIterator.next();
              JavaType mapController=GeoUtils.getMapControllerByPath(currentPath,typeLocationService);
              annotateMapController(mapController,typeLocationService,typeManagementService,entityController.getType());
            }
          }
 else {
            for (            JavaType mapController : mapControllers) {
              annotateMapController(mapController,typeLocationService,typeManagementService,entityController.getType());
            }
          }
          break;
        }
      }
    }
  }
}