Program: 77856
Project: 77856
Buggy source:
/** 
 * if a change oared or a new profile got installed the filter buttons get created
 */
private void creatButtons(){
  try {
    if (shootingservice.searchIsActive().getActive()) {
      profile=profileservice.get(shootingservice.searchIsActive().getProfileid());
    }
    List<Profile.PairCameraPosition> pairList=profile.getPairCameraPositions();
    if (pairList == null || pairList.isEmpty()) {
      rightbutton.setVisible(false);
    }
 else {
      int column=(int)((float)pairList.size() / 3.0f);
      int width;
      if (pairList.size() > 3) {
        width=(int)((float)gridpanel.getWidth() / 3) - 10;
      }
 else       if (pairList.size() > 2) {
        width=(int)((float)gridpanel.getWidth() / 2) - 10;
      }
 else {
        width=(int)((float)gridpanel.getWidth()) - 10;
      }
      int high=(int)((float)gridpanel.getHeight() / 3) - 7;
      int countrow=1;
      int countcolumn=0;
      grid=new GridPane();
      for (int i=0; i < pairList.size(); i++) {
        GridPane gp=new GridPane();
        String name="String_Node_Str" + pairList.get(i).getCamera().getId() + "String_Node_Str"+ pairList.get(i).getPosition().getName();
        int shot=profileservice.getActiveProfile().getPairCameraPositions().get(i).getShotType();
        ImageView imageView=new ImageView();
        imageView.setVisible(true);
        imageView.prefHeight(high);
        imageView.prefWidth(20);
        if (!pairList.get(i).isGreenScreenReady()) {
          if (profileservice.getActiveProfile().getPairCameraPositions().get(i).getFilterName() == null || profileservice.getActiveProfile().getPairCameraPositions().get(i).getFilterName().equals("String_Node_Str")) {
            imageView.setImage(new Image("String_Node_Str",imageView.getFitHeight(),imageView.getFitWidth(),true,true));
          }
 else {
            imageView.setImage(SwingFXUtils.toFXImage(filterList.get(profileservice.getActiveProfile().getPairCameraPositions().get(i).getFilterName()),null));
          }
        }
 else {
          if (profileservice.getActiveProfile().getPairCameraPositions().get(i).getBackground() != null) {
            if (profileservice.getActiveProfile().getPairCameraPositions().get(i).getBackground().getPath() != null) {
              FileInputStream file=new FileInputStream(profileservice.getActiveProfile().getPairCameraPositions().get(i).getBackground().getPath());
              Image ima=new Image(file,imageView.getFitHeight(),imageView.getFitWidth(),true,true);
              file.close();
              imageView.setImage(ima);
            }
 else {
              imageView.setImage(new Image("String_Node_Str",imageView.getFitHeight(),imageView.getFitWidth(),true,true));
            }
          }
 else {
            imageView.setImage(new Image("String_Node_Str",imageView.getFitHeight(),imageView.getFitWidth(),true,true));
          }
        }
        Image i2;
        if (shot == 0) {
          i2=new Image("String_Node_Str");
        }
 else         if (shot == 1) {
          i2=new Image("String_Node_Str");
        }
 else {
          i2=new Image("String_Node_Str");
        }
        ImageView iv2=new ImageView();
        iv2.setImage(i2);
        iv2.setFitHeight(high / 4);
        iv2.setFitWidth(high / 4);
        imageView.setFitHeight(high / 2);
        imageView.setFitWidth(high / 2);
        Group blend=new Group(imageView,iv2);
        if (pairList.size() <= 3) {
          if (countrow == 1) {
            GridPane top=new GridPane();
            top.setPrefHeight(high / 2);
            top.setStyle("String_Node_Str");
            grid.add(top,countcolumn,0);
          }
          countrow=countrow + 2;
        }
 else {
          if (countcolumn < 2) {
            countcolumn=+2;
            if (countrow == 1) {
              GridPane top=new GridPane();
              top.setPrefHeight(high / 4);
              top.setStyle("String_Node_Str");
              grid.add(top,countcolumn,0);
            }
          }
 else {
            countrow++;
            countcolumn=+2;
          }
        }
        Button filter=new Button();
        filter.setText(name);
        filter.setStyle("String_Node_Str");
        filter.setVisible(true);
        filter.setPrefWidth(width - 20);
        filter.setPrefHeight(high / 2);
        String url=pairList.get(i).getCameraLable();
        LOGGER.debug("String_Node_Str" + url);
        filter.setStyle("String_Node_Str" + url + "String_Node_Str");
        filter.setStyle("String_Node_Str");
        filter.setStyle("String_Node_Str");
        double size;
        if (column == 0) {
          size=allpicturesview.getFont().getSize();
        }
 else {
          size=(int)(allpicturesview.getFont().getSize() / column);
        }
        filter.setStyle("String_Node_Str" + size + "String_Node_Str");
        final int index=i;
        filter.setOnMouseClicked((        MouseEvent mouseEvent) -> {
          filterChouseside=true;
          windowmanager.showKameraFilterSceen(index,1,pairList.get(index).isGreenScreenReady());
        }
);
        gp.prefWidth(width);
        gp.prefHeight(high);
        gp.add(filter,0,0);
        gp.add(blend,1,0);
        grid.add(gp,countcolumn,countrow);
        GridPane fill=new GridPane();
        fill.setPrefHeight(high / 2);
        fill.setStyle("String_Node_Str");
        if (pairList.size() > 3) {
          GridPane fillside=new GridPane();
          fill.setPrefWidth(20);
          fill.setStyle("String_Node_Str");
          grid.add(fillside,countcolumn + 1,countrow);
        }
        grid.add(fill,countcolumn,countrow + 1);
      }
      basicpane.add(grid,1,0);
      isButtoncreated=true;
    }
  }
 catch (  ServiceException e) {
    LOGGER.error("String_Node_Str",e);
    showInformationDialog(e.getMessage());
  }
catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * if a change oared or a new profile got installed the filter buttons get created
 */
private void creatButtons(){
  try {
    if (shootingservice.searchIsActive().getActive()) {
      profile=profileservice.get(shootingservice.searchIsActive().getProfileid());
    }
    List<Profile.PairCameraPosition> pairList=profile.getPairCameraPositions();
    if (pairList == null || pairList.isEmpty()) {
      rightbutton.setVisible(false);
    }
 else {
      int column=(int)((float)pairList.size() / 3.0f);
      int width;
      if (pairList.size() > 3) {
        width=(int)((float)gridpanel.getWidth() / 6) - 10;
      }
 else       if (pairList.size() > 2) {
        width=(int)((float)gridpanel.getWidth() / 5) - 10;
      }
 else {
        width=(int)((float)gridpanel.getWidth()) - 10;
      }
      int high=(int)((float)gridpanel.getWidth() / 6) - 7;
      int countrow=1;
      int countcolumn=0;
      grid=new GridPane();
      for (int i=0; i < pairList.size(); i++) {
        GridPane gp=new GridPane();
        String name="String_Node_Str" + pairList.get(i).getCamera().getId() + "String_Node_Str"+ pairList.get(i).getPosition().getName();
        int shot=profileservice.getActiveProfile().getPairCameraPositions().get(i).getShotType();
        ImageView imageView=new ImageView();
        imageView.setVisible(true);
        imageView.prefHeight(high);
        imageView.prefWidth(20);
        if (!pairList.get(i).isGreenScreenReady()) {
          if (profileservice.getActiveProfile().getPairCameraPositions().get(i).getFilterName() == null || profileservice.getActiveProfile().getPairCameraPositions().get(i).getFilterName().equals("String_Node_Str")) {
            imageView.setImage(new Image("String_Node_Str",imageView.getFitHeight(),imageView.getFitWidth(),true,true));
          }
 else {
            imageView.setImage(SwingFXUtils.toFXImage(filterList.get(profileservice.getActiveProfile().getPairCameraPositions().get(i).getFilterName()),null));
          }
        }
 else {
          if (profileservice.getActiveProfile().getPairCameraPositions().get(i).getBackground() != null) {
            if (profileservice.getActiveProfile().getPairCameraPositions().get(i).getBackground().getPath() != null) {
              FileInputStream file=new FileInputStream(profileservice.getActiveProfile().getPairCameraPositions().get(i).getBackground().getPath());
              Image ima=new Image(file,imageView.getFitHeight(),imageView.getFitWidth(),true,true);
              file.close();
              imageView.setImage(ima);
            }
 else {
              imageView.setImage(new Image("String_Node_Str",imageView.getFitHeight(),imageView.getFitWidth(),true,true));
            }
          }
 else {
            imageView.setImage(new Image("String_Node_Str",imageView.getFitHeight(),imageView.getFitWidth(),true,true));
          }
        }
        Image i2;
        if (shot == 0) {
          i2=new Image("String_Node_Str");
        }
 else         if (shot == 1) {
          i2=new Image("String_Node_Str");
        }
 else {
          i2=new Image("String_Node_Str");
        }
        ImageView iv2=new ImageView();
        iv2.setImage(i2);
        if (pairList.size() <= 3) {
          if (countrow == 1) {
            GridPane top=new GridPane();
            top.setPrefHeight(high / 2);
            top.setStyle("String_Node_Str");
            grid.add(top,countcolumn,0);
          }
          countrow=countrow + 2;
        }
 else {
          if (countcolumn < 2) {
            countcolumn=+2;
            if (countrow == 1) {
              GridPane top=new GridPane();
              top.setPrefHeight(high / 4);
              top.setStyle("String_Node_Str");
              grid.add(top,countcolumn,0);
            }
          }
 else {
            countrow++;
            countcolumn=+2;
          }
        }
        Button filter=new Button();
        filter.setText(name);
        filter.setStyle("String_Node_Str");
        filter.setVisible(true);
        filter.setPrefWidth(width - high / 2);
        filter.setPrefHeight(high / 2);
        String url=pairList.get(i).getCameraLable();
        LOGGER.debug("String_Node_Str" + url);
        filter.setStyle("String_Node_Str" + url + "String_Node_Str");
        filter.setStyle("String_Node_Str");
        filter.setStyle("String_Node_Str");
        double size;
        if (column == 0) {
          size=allpicturesview.getFont().getSize();
        }
 else {
          size=(int)(allpicturesview.getFont().getSize() / column);
        }
        filter.setStyle("String_Node_Str" + size + "String_Node_Str");
        final int index=i;
        filter.setOnMouseClicked((        MouseEvent mouseEvent) -> {
          filterChouseside=true;
          windowmanager.showKameraFilterSceen(index,1,pairList.get(index).isGreenScreenReady());
        }
);
        iv2.setFitWidth(high / 4);
        iv2.setFitHeight(high / 4);
        imageView.setFitWidth(high / 1.5);
        imageView.setFitHeight(high / 1.5);
        Group blend=new Group(imageView,iv2);
        gp.prefWidth(width);
        gp.prefHeight(high);
        gp.add(filter,0,0);
        gp.add(blend,1,0);
        grid.add(gp,countcolumn,countrow);
        GridPane fill=new GridPane();
        fill.setPrefHeight(high / 2);
        fill.setStyle("String_Node_Str");
        if (pairList.size() > 3) {
          GridPane fillside=new GridPane();
          fill.setPrefWidth(20);
          fill.setStyle("String_Node_Str");
          grid.add(fillside,countcolumn + 1,countrow);
        }
        grid.add(fill,countcolumn,countrow + 1);
      }
      basicpane.add(grid,1,0);
      isButtoncreated=true;
    }
  }
 catch (  ServiceException e) {
    LOGGER.error("String_Node_Str",e);
    showInformationDialog(e.getMessage());
  }
catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}