Program: 77829
Project: 77829
Buggy source:
/** 
 * creats the filter selection for all kameras marks the chousen filter
 */
private void creatButtons(){
  try {
    filtergrid=new GridPane();
    filtergrid.prefWidth(Screen.getPrimary().getBounds().getWidth());
    filterscrollplanel=new ScrollPane();
    filtergrid.setStyle("String_Node_Str");
    filterscrollplanel.setStyle("String_Node_Str");
    filterscrollplanel.setFitToWidth(true);
    filterscrollplanel.setFitToHeight(false);
    filterscrollplanel.prefWidth(Screen.getPrimary().getBounds().getWidth());
    filtergrid.getColumnConstraints().add(0,new ColumnConstraints());
    filtergrid.getRowConstraints().add(0,new RowConstraints());
    filtergrid.getColumnConstraints().add(1,new ColumnConstraints());
    filtergrid.getRowConstraints().add(1,new RowConstraints());
    filtergrid.getColumnConstraints().add(2,new ColumnConstraints());
    filtergrid.getRowConstraints().add(2,new RowConstraints());
    filtergrid.getColumnConstraints().add(3,new ColumnConstraints());
    filtergrid.getRowConstraints().add(3,new RowConstraints());
    filtergrid.getColumnConstraints().add(4,new ColumnConstraints());
    filtergrid.getRowConstraints().add(4,new RowConstraints());
    filtergrid.getColumnConstraints().add(5,new ColumnConstraints());
    filtergrid.getRowConstraints().add(5,new RowConstraints());
    filtergrid.getColumnConstraints().get(0).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(0).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(1).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(1).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(2).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(2).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(3).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(3).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(4).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(4).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(5).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(5).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    int columcount=0;
    int rowcount=0;
    if (profileservice.getActiveProfile().getId() != profile.getId()) {
      profile=profileservice.getActiveProfile();
      filtermap.clear();
    }
    if (filtermap == null || filtermap.isEmpty()) {
      try {
        String filterPreviewImagePath=wm.copyResource("String_Node_Str");
        filtermap=filterService.getAllFilteredImages(filterPreviewImagePath);
      }
 catch (      IOException e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
    for (    Map.Entry<String,BufferedImage> filterentety : filtermap.entrySet()) {
      if (columcount == 6) {
        rowcount++;
        columcount=0;
      }
      if (rowcount >= 6) {
        filtergrid.getRowConstraints().add(rowcount,new RowConstraints());
        filtergrid.getRowConstraints().get(rowcount).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
      }
      ImageView iv=new ImageView();
      iv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
      iv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
      iv.setStyle("String_Node_Str");
      iv.setStyle("String_Node_Str");
      iv.setImage(SwingFXUtils.toFXImage(filterentety.getValue(),null));
      if (profile.getPairCameraPositions().get(index).getFilterName() != null) {
        if (filterentety.getKey().equals(profile.getPairCameraPositions().get(index).getFilterName())) {
          activiv=iv;
          activiv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
          activiv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
        }
      }
      iv.setOnMouseClicked((      MouseEvent mouseEvent) -> {
        if (activiv != null) {
          activiv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
          activiv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
        }
        activiv=iv;
        iv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
        iv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
        profile.getPairCameraPositions().get(index).setFilterName(filterentety.getKey());
      }
);
      filtergrid.add(iv,columcount,rowcount);
      columcount++;
    }
    filtergrid.setVisible(true);
    filterscrollplanel.setVisible(true);
    filterscrollplanel.setContent(filtergrid);
    root.add(filterscrollplanel,0,1);
  }
 catch (  ServiceException e) {
    LOGGER.error("String_Node_Str",e);
    showInformationDialog("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * creats the filter selection for all kameras marks the chousen filter
 */
private void creatButtons(){
  try {
    filtergrid=new GridPane();
    filtergrid.prefWidth(Screen.getPrimary().getBounds().getWidth());
    filterscrollplanel=new ScrollPane();
    filtergrid.setStyle("String_Node_Str");
    filterscrollplanel.setStyle("String_Node_Str");
    filterscrollplanel.setFitToWidth(true);
    filterscrollplanel.setFitToHeight(false);
    filterscrollplanel.prefWidth(Screen.getPrimary().getBounds().getWidth());
    filtergrid.getColumnConstraints().add(0,new ColumnConstraints());
    filtergrid.getRowConstraints().add(0,new RowConstraints());
    filtergrid.getColumnConstraints().add(1,new ColumnConstraints());
    filtergrid.getRowConstraints().add(1,new RowConstraints());
    filtergrid.getColumnConstraints().add(2,new ColumnConstraints());
    filtergrid.getRowConstraints().add(2,new RowConstraints());
    filtergrid.getColumnConstraints().add(3,new ColumnConstraints());
    filtergrid.getRowConstraints().add(3,new RowConstraints());
    filtergrid.getColumnConstraints().add(4,new ColumnConstraints());
    filtergrid.getRowConstraints().add(4,new RowConstraints());
    filtergrid.getColumnConstraints().add(5,new ColumnConstraints());
    filtergrid.getRowConstraints().add(5,new RowConstraints());
    filtergrid.getColumnConstraints().get(0).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(0).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(1).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(1).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(2).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(2).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(3).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(3).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(4).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(4).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getColumnConstraints().get(5).setPrefWidth(Screen.getPrimary().getBounds().getWidth() / 6);
    filtergrid.getRowConstraints().get(5).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
    int columcount=0;
    int rowcount=0;
    if (filtermap == null || filtermap.isEmpty()) {
      try {
        String filterPreviewImagePath=wm.copyResource("String_Node_Str");
        filtermap=filterService.getAllFilteredImages(filterPreviewImagePath);
      }
 catch (      IOException e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
    for (    Map.Entry<String,BufferedImage> filterentety : filtermap.entrySet()) {
      if (columcount == 6) {
        rowcount++;
        columcount=0;
      }
      if (rowcount >= 6) {
        filtergrid.getRowConstraints().add(rowcount,new RowConstraints());
        filtergrid.getRowConstraints().get(rowcount).setPrefHeight(Screen.getPrimary().getBounds().getWidth() / 6);
      }
      ImageView iv=new ImageView();
      iv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
      iv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
      iv.setStyle("String_Node_Str");
      iv.setStyle("String_Node_Str");
      iv.setImage(SwingFXUtils.toFXImage(filterentety.getValue(),null));
      if (profileservice.getActiveProfile().getPairCameraPositions().get(index).getFilterName() != null) {
        if (filterentety.getKey().equals(profileservice.getActiveProfile().getPairCameraPositions().get(index).getFilterName())) {
          activiv=iv;
          activiv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
          activiv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
        }
      }
      iv.setOnMouseClicked((      MouseEvent mouseEvent) -> {
        if (activiv != null) {
          activiv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
          activiv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 10);
        }
        activiv=iv;
        iv.setFitHeight(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
        iv.setFitWidth(Screen.getPrimary().getBounds().getWidth() / 6 - 40);
        try {
          profileservice.getActiveProfile().getPairCameraPositions().get(index).setFilterName(filterentety.getKey());
        }
 catch (        ServiceException e) {
          LOGGER.error("String_Node_Str",e);
        }
      }
);
      filtergrid.add(iv,columcount,rowcount);
      columcount++;
    }
    filtergrid.setVisible(true);
    filterscrollplanel.setVisible(true);
    filterscrollplanel.setContent(filtergrid);
    root.add(filterscrollplanel,0,1);
  }
 catch (  ServiceException e) {
    LOGGER.error("String_Node_Str",e);
    showInformationDialog("String_Node_Str");
  }
}