Program: 109380
Project: 109380
Buggy source:
@Override public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext){
  return ConfigurationBuilder.begin().addRule().when(Query.fromType(XmlFileModel.class).withProperty(XmlFileModel.ROOT_TAG_NAME,"String_Node_Str")).perform(new AbstractIterationOperation<XmlFileModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    XmlFileModel payload){
      try {
        Document doc=new XmlFileService(event.getGraphContext()).loadDocument(event,context,payload);
        extractMetadata(event,context,payload,doc);
      }
 catch (      Exception ex) {
        payload.setParseError("String_Node_Str" + ex.getMessage());
      }
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.IMPLEMENTS_TYPE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbEntityBeanModel> ejbEntityService=new GraphService<>(event.getGraphContext(),EjbEntityBeanModel.class);
        Iterable<EjbEntityBeanModel> entityBeanModels=ejbEntityService.findAllByProperty(EjbEntityBeanModel.EJB_IMPLEMENTATION_CLASS,classModel.getClassName(),true);
        if (entityBeanModels.iterator().hasNext())         return;
        EjbEntityBeanModel entity=ejbEntityService.create();
        entity.setApplications(payload.getFile().getApplications());
        entity.setEjbClass(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=ejbSessionService.findAllByProperty(EjbEntityBeanModel.EJB_HOME,classModel.getClassName(),true);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbHome(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=ejbSessionService.findAllByProperty(EjbEntityBeanModel.EJB_REMOTE,classModel.getClassName(),true);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbRemote(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.IMPLEMENTS_TYPE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=ejbSessionService.findAllByProperty(EjbEntityBeanModel.EJB_IMPLEMENTATION_CLASS,classModel.getClassName(),true);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbClass(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=ejbSessionService.findAllByProperty(EjbEntityBeanModel.EJB_LOCAL_HOME,classModel.getClassName(),true);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbLocalHome(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=ejbSessionService.findAllByProperty(EjbEntityBeanModel.EJB_LOCAL,classModel.getClassName(),true);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbLocal(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.IMPLEMENTS_TYPE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbMessageDrivenModel> ejbMessageDrivenService=new GraphService<>(event.getGraphContext(),EjbMessageDrivenModel.class);
        Iterable<EjbMessageDrivenModel> messageDrivenModels=ejbMessageDrivenService.findAllByProperty(EjbMessageDrivenModel.EJB_IMPLEMENTATION_CLASS,classModel.getClassName(),true);
        if (messageDrivenModels.iterator().hasNext())         return;
        EjbMessageDrivenModel messageDrivenModel=ejbMessageDrivenService.create();
        messageDrivenModel.setApplications(payload.getFile().getApplications());
        messageDrivenModel.setEjbClass(classModel);
      }
);
    }
  }
);
}

Fixed version (ground truth):
@Override public Configuration getConfiguration(RuleLoaderContext ruleLoaderContext){
  return ConfigurationBuilder.begin().addRule().when(Query.fromType(XmlFileModel.class).withProperty(XmlFileModel.ROOT_TAG_NAME,"String_Node_Str")).perform(new AbstractIterationOperation<XmlFileModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    XmlFileModel payload){
      try {
        Document doc=new XmlFileService(event.getGraphContext()).loadDocument(event,context,payload);
        extractMetadata(event,context,payload,doc);
      }
 catch (      Exception ex) {
        payload.setParseError("String_Node_Str" + ex.getMessage());
      }
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.IMPLEMENTS_TYPE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbEntityBeanModel> ejbEntityService=new GraphService<>(event.getGraphContext(),EjbEntityBeanModel.class);
        Iterable<EjbEntityBeanModel> entityBeanModels=findByClass(event.getGraphContext(),EjbEntityBeanModel.EJB_IMPLEMENTATION_CLASS,classModel,EjbEntityBeanModel.class);
        if (entityBeanModels.iterator().hasNext())         return;
        EjbEntityBeanModel entity=ejbEntityService.create();
        entity.setApplications(payload.getFile().getApplications());
        entity.setEjbClass(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=findByClass(event.getGraphContext(),EjbSessionBeanModel.EJB_HOME,classModel,EjbSessionBeanModel.class);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbHome(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=findByClass(event.getGraphContext(),EjbSessionBeanModel.EJB_REMOTE,classModel,EjbSessionBeanModel.class);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbRemote(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.IMPLEMENTS_TYPE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=findByClass(event.getGraphContext(),EjbSessionBeanModel.EJB_IMPLEMENTATION_CLASS,classModel,EjbSessionBeanModel.class);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbClass(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=findByClass(event.getGraphContext(),EjbSessionBeanModel.EJB_LOCAL_HOME,classModel,EjbSessionBeanModel.class);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbLocalHome(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.INHERITANCE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbSessionBeanModel> ejbSessionService=new GraphService<>(event.getGraphContext(),EjbSessionBeanModel.class);
        Iterable<EjbSessionBeanModel> sessionModels=findByClass(event.getGraphContext(),EjbSessionBeanModel.EJB_LOCAL,classModel,EjbSessionBeanModel.class);
        if (sessionModels.iterator().hasNext())         return;
        EjbSessionBeanModel sessionBeanModel=ejbSessionService.create();
        sessionBeanModel.setApplications(payload.getFile().getApplications());
        sessionBeanModel.setEjbLocal(classModel);
      }
);
    }
  }
).addRule().when(JavaClass.references("String_Node_Str").at(TypeReferenceLocation.IMPLEMENTS_TYPE)).perform(new AbstractIterationOperation<JavaTypeReferenceModel>(){
    @Override public void perform(    GraphRewrite event,    EvaluationContext context,    JavaTypeReferenceModel payload){
      List<JavaClassModel> classes=payload.getFile().getJavaClasses();
      classes.forEach(classModel -> {
        GraphService<EjbMessageDrivenModel> ejbMessageDrivenService=new GraphService<>(event.getGraphContext(),EjbMessageDrivenModel.class);
        Iterable<EjbMessageDrivenModel> messageDrivenModels=findByClass(event.getGraphContext(),EjbMessageDrivenModel.EJB_IMPLEMENTATION_CLASS,classModel,EjbMessageDrivenModel.class);
        if (messageDrivenModels.iterator().hasNext())         return;
        EjbMessageDrivenModel messageDrivenModel=ejbMessageDrivenService.create();
        messageDrivenModel.setApplications(payload.getFile().getApplications());
        messageDrivenModel.setEjbClass(classModel);
      }
);
    }
  }
);
}