Program: 120037
Project: 120037
Buggy source:
public void checkLinks(){
  boolean isJoblet=false;
  if (PluginChecker.isJobLetPluginLoaded()) {
    IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    if (service != null && service.isJobletComponent(this)) {
      isJoblet=true;
    }
  }
  if (!(Boolean)getPropertyValue(EParameterName.STARTABLE.getName())) {
    if ((getCurrentActiveLinksNbInput(EConnectionType.FLOW_MAIN) == 0) && (getConnectorFromType(EConnectionType.FLOW_MAIN).getMinLinkInput() == 0) & (getConnectorFromType(EConnectionType.FLOW_MAIN).getMaxLinkInput() != 0)) {
      String errorMessage=Messages.getString("String_Node_Str");
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
    if ((getCurrentActiveLinksNbInput(EConnectionType.FLOW_MAIN) == 0) && (getCurrentActiveLinksNbInput(EConnectionType.FLOW_REF) > 0)) {
      String errorMessage=Messages.getString("String_Node_Str");
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
  }
  if ((getConnectorFromType(EConnectionType.FLOW_MAIN).getMaxLinkInput() == 0) && (getConnectorFromType(EConnectionType.FLOW_MAIN).getMaxLinkOutput() != 0)) {
    if ((getCurrentActiveLinksNbOutput(EConnectionType.FLOW_MAIN) == 0) && (getCurrentActiveLinksNbOutput(EConnectionType.FLOW_MERGE) == 0) && (getCurrentActiveLinksNbOutput(EConnectionType.FLOW_REF) == 0)&& (getCurrentActiveLinksNbOutput(EConnectionType.ITERATE) == 0)) {
      String errorMessage=Messages.getString("String_Node_Str");
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
  }
  if (!isJoblet) {
    if (!isSubProcessStart() || (!(Boolean)getPropertyValue(EParameterName.STARTABLE.getName()))) {
      if ((getCurrentActiveLinksNbOutput(EConnectionType.ON_SUBJOB_OK) > 0) || getCurrentActiveLinksNbOutput(EConnectionType.ON_SUBJOB_ERROR) > 0) {
        String errorMessage=Messages.getString("String_Node_Str");
        Problems.add(ProblemStatus.ERROR,this,errorMessage);
      }
    }
    if ((!isELTComponent() && !isSubProcessStart()) || (!(Boolean)getPropertyValue(EParameterName.STARTABLE.getName()))) {
      if ((getCurrentActiveLinksNbInput(EConnectionType.ON_SUBJOB_OK) > 0) || (getCurrentActiveLinksNbInput(EConnectionType.RUN_IF) > 0) || (getCurrentActiveLinksNbInput(EConnectionType.ON_COMPONENT_OK) > 0)|| (getCurrentActiveLinksNbInput(EConnectionType.ON_COMPONENT_ERROR) > 0)|| (getCurrentActiveLinksNbInput(EConnectionType.STARTS) > 0)) {
        String errorMessage=Messages.getString("String_Node_Str");
        Problems.add(ProblemStatus.ERROR,this,errorMessage);
      }
    }
    if (isHL7Output()) {
      if (getIncomingConnections(EConnectionType.FLOW_MERGE).size() <= 0) {
        String errorMessage=Messages.getString("String_Node_Str");
        Problems.add(ProblemStatus.ERROR,this,errorMessage);
      }
 else {
        List<Map<String,String>> maps=(List<Map<String,String>>)ElementParameterParser.getObjectValue(this,"String_Node_Str");
        List<IMetadataTable> tables=this.getMetadataList();
        for (        IConnection connection : getIncomingConnections(EConnectionType.FLOW_MERGE)) {
          IMetadataTable metadataTable=connection.getMetadataTable();
          String rowName=connection.getUniqueName();
          String schemaName=null;
          for (          Map<String,String> map : maps) {
            if (map.containsValue(rowName)) {
              if (map.get("String_Node_Str") != null && map.get("String_Node_Str").equals(rowName)) {
                schemaName=map.get("String_Node_Str");
                int first=schemaName.indexOf("String_Node_Str");
                int second=schemaName.lastIndexOf("String_Node_Str");
                if (first > 0 && first < second) {
                  schemaName=schemaName.substring(first + 1,second);
                  break;
                }
              }
            }
          }
          for (          IMetadataTable nodeTable : tables) {
            if (schemaName != null && nodeTable.getLabel() != null && nodeTable.getLabel().equals(schemaName)) {
              if (!metadataTable.sameMetadataAs(nodeTable,IMetadataColumn.OPTIONS_NONE)) {
                String errorMessage=Messages.getString("String_Node_Str");
                Problems.add(ProblemStatus.ERROR,this,errorMessage);
              }
            }
          }
        }
      }
    }
  }
  int jobletBuildConnectorNum=0;
  for (  INodeConnector nodeConnector : listConnector) {
    if (!nodeConnector.getDefaultConnectionType().hasConnectionCategory(IConnectionCategory.USE_HASH) && nodeConnector.getDefaultConnectionType() != EConnectionType.FLOW_MERGE) {
      int nbMaxOut;
      nbMaxOut=nodeConnector.getMaxLinkOutput();
      int nbMaxIn;
      nbMaxIn=nodeConnector.getMaxLinkInput();
      int nbMinOut;
      nbMinOut=nodeConnector.getMinLinkOutput();
      int nbMinIn;
      nbMinIn=nodeConnector.getMinLinkInput();
      int curLinkOut;
      curLinkOut=nodeConnector.getCurLinkNbOutput();
      int curLinkIn;
      curLinkIn=nodeConnector.getCurLinkNbInput();
      String typeName=nodeConnector.getMenuName();
      if (nodeConnector.getDefaultConnectionType() == EConnectionType.FLOW_MAIN) {
        typeName="String_Node_Str";
        if (isJoblet) {
          if (nodeConnector.isBuiltIn()) {
            jobletBuildConnectorNum++;
          }
          continue;
        }
      }
      if (nbMaxOut != -1) {
        if (curLinkOut > nbMaxOut) {
          String errorMessage=Messages.getString("String_Node_Str",typeName);
          Problems.add(ProblemStatus.WARNING,this,errorMessage);
        }
      }
      if (nbMinOut != 0) {
        if (curLinkOut < nbMinOut) {
          String errorMessage=Messages.getString("String_Node_Str",typeName);
          Problems.add(ProblemStatus.WARNING,this,errorMessage);
        }
      }
      if (!isJoblet) {
        if (nbMaxIn != -1) {
          if (curLinkIn > nbMaxIn) {
            String errorMessage=Messages.getString("String_Node_Str",typeName);
            Problems.add(ProblemStatus.WARNING,this,errorMessage);
          }
        }
        if (nbMinIn != 0) {
          if (curLinkIn < nbMinIn) {
            String errorMessage=Messages.getString("String_Node_Str",typeName);
            Problems.add(ProblemStatus.WARNING,this,errorMessage);
          }
        }
      }
    }
  }
  if (isJoblet) {
    List<? extends IConnection> outgoingConnections=this.getOutgoingConnections(EConnectionType.FLOW_MAIN);
    for (    IConnection con : outgoingConnections) {
      INodeConnector connector=this.getConnectorFromName(con.getConnectorName());
      if (connector == null && con instanceof Connection) {
        ((Connection)con).disconnect();
      }
    }
    String typeName="String_Node_Str";
    outgoingConnections=this.getOutgoingConnections(EConnectionType.FLOW_MAIN);
    if (outgoingConnections.size() > jobletBuildConnectorNum) {
      String errorMessage=Messages.getString("String_Node_Str",typeName);
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
 else     if (outgoingConnections.size() < jobletBuildConnectorNum) {
      String errorMessage=Messages.getString("String_Node_Str",typeName);
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
  }
}

Fixed version (ground truth):
public void checkLinks(){
  boolean isJoblet=false;
  if (PluginChecker.isJobLetPluginLoaded()) {
    IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    if (service != null && service.isJobletComponent(this)) {
      isJoblet=true;
    }
  }
  if (!(Boolean)getPropertyValue(EParameterName.STARTABLE.getName())) {
    if ((getCurrentActiveLinksNbInput(EConnectionType.FLOW_MAIN) == 0) && (getConnectorFromType(EConnectionType.FLOW_MAIN).getMinLinkInput() == 0) & (getConnectorFromType(EConnectionType.FLOW_MAIN).getMaxLinkInput() != 0)) {
      String errorMessage=Messages.getString("String_Node_Str");
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
    if ((getCurrentActiveLinksNbInput(EConnectionType.FLOW_MAIN) == 0) && (getCurrentActiveLinksNbInput(EConnectionType.FLOW_REF) > 0)) {
      String errorMessage=Messages.getString("String_Node_Str");
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
  }
  if ((getConnectorFromType(EConnectionType.FLOW_MAIN).getMaxLinkInput() == 0) && (getConnectorFromType(EConnectionType.FLOW_MAIN).getMaxLinkOutput() != 0)) {
    if ((getCurrentActiveLinksNbOutput(EConnectionType.FLOW_MAIN) == 0) && (getCurrentActiveLinksNbOutput(EConnectionType.FLOW_MERGE) == 0) && (getCurrentActiveLinksNbOutput(EConnectionType.FLOW_REF) == 0)&& (getCurrentActiveLinksNbOutput(EConnectionType.ITERATE) == 0)) {
      String errorMessage=Messages.getString("String_Node_Str");
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
  }
  if (!isJoblet) {
    if (!isSubProcessStart() || (!(Boolean)getPropertyValue(EParameterName.STARTABLE.getName()))) {
      if ((getCurrentActiveLinksNbOutput(EConnectionType.ON_SUBJOB_OK) > 0) || getCurrentActiveLinksNbOutput(EConnectionType.ON_SUBJOB_ERROR) > 0) {
        String errorMessage=Messages.getString("String_Node_Str");
        Problems.add(ProblemStatus.ERROR,this,errorMessage);
      }
    }
    if ((!isELTComponent() && !isSubProcessStart()) || (!(Boolean)getPropertyValue(EParameterName.STARTABLE.getName()))) {
      if ((getCurrentActiveLinksNbInput(EConnectionType.ON_SUBJOB_OK) > 0) || (getCurrentActiveLinksNbInput(EConnectionType.RUN_IF) > 0) || (getCurrentActiveLinksNbInput(EConnectionType.ON_COMPONENT_OK) > 0)|| (getCurrentActiveLinksNbInput(EConnectionType.ON_COMPONENT_ERROR) > 0)|| (getCurrentActiveLinksNbInput(EConnectionType.STARTS) > 0)) {
        String errorMessage=Messages.getString("String_Node_Str");
        Problems.add(ProblemStatus.ERROR,this,errorMessage);
      }
    }
    if (isHL7Output()) {
      if (getIncomingConnections(EConnectionType.FLOW_MERGE).size() <= 0) {
        String errorMessage=Messages.getString("String_Node_Str");
        Problems.add(ProblemStatus.ERROR,this,errorMessage);
      }
 else {
        List<Map<String,String>> maps=(List<Map<String,String>>)ElementParameterParser.getObjectValue(this,"String_Node_Str");
        List<IMetadataTable> tables=this.getMetadataList();
        for (        IConnection connection : getIncomingConnections(EConnectionType.FLOW_MERGE)) {
          IMetadataTable metadataTable=connection.getMetadataTable();
          String rowName=connection.getUniqueName();
          String schemaName=null;
          for (          Map<String,String> map : maps) {
            if (map.containsValue(rowName)) {
              if (map.get("String_Node_Str") != null && map.get("String_Node_Str").equals(rowName)) {
                schemaName=map.get("String_Node_Str");
                break;
              }
            }
          }
          for (          IMetadataTable nodeTable : tables) {
            if (nodeTable.getTableName() != null && nodeTable.getTableName().equals(schemaName)) {
              if (!metadataTable.sameMetadataAs(nodeTable,IMetadataColumn.OPTIONS_NONE)) {
                String errorMessage=Messages.getString("String_Node_Str");
                Problems.add(ProblemStatus.ERROR,this,errorMessage);
              }
            }
          }
        }
      }
    }
  }
  int jobletBuildConnectorNum=0;
  for (  INodeConnector nodeConnector : listConnector) {
    if (!nodeConnector.getDefaultConnectionType().hasConnectionCategory(IConnectionCategory.USE_HASH) && nodeConnector.getDefaultConnectionType() != EConnectionType.FLOW_MERGE) {
      int nbMaxOut;
      nbMaxOut=nodeConnector.getMaxLinkOutput();
      int nbMaxIn;
      nbMaxIn=nodeConnector.getMaxLinkInput();
      int nbMinOut;
      nbMinOut=nodeConnector.getMinLinkOutput();
      int nbMinIn;
      nbMinIn=nodeConnector.getMinLinkInput();
      int curLinkOut;
      curLinkOut=nodeConnector.getCurLinkNbOutput();
      int curLinkIn;
      curLinkIn=nodeConnector.getCurLinkNbInput();
      String typeName=nodeConnector.getMenuName();
      if (nodeConnector.getDefaultConnectionType() == EConnectionType.FLOW_MAIN) {
        typeName="String_Node_Str";
        if (isJoblet) {
          if (nodeConnector.isBuiltIn()) {
            jobletBuildConnectorNum++;
          }
          continue;
        }
      }
      if (nbMaxOut != -1) {
        if (curLinkOut > nbMaxOut) {
          String errorMessage=Messages.getString("String_Node_Str",typeName);
          Problems.add(ProblemStatus.WARNING,this,errorMessage);
        }
      }
      if (nbMinOut != 0) {
        if (curLinkOut < nbMinOut) {
          String errorMessage=Messages.getString("String_Node_Str",typeName);
          Problems.add(ProblemStatus.WARNING,this,errorMessage);
        }
      }
      if (!isJoblet) {
        if (nbMaxIn != -1) {
          if (curLinkIn > nbMaxIn) {
            String errorMessage=Messages.getString("String_Node_Str",typeName);
            Problems.add(ProblemStatus.WARNING,this,errorMessage);
          }
        }
        if (nbMinIn != 0) {
          if (curLinkIn < nbMinIn) {
            String errorMessage=Messages.getString("String_Node_Str",typeName);
            Problems.add(ProblemStatus.WARNING,this,errorMessage);
          }
        }
      }
    }
  }
  if (isJoblet) {
    List<? extends IConnection> outgoingConnections=this.getOutgoingConnections(EConnectionType.FLOW_MAIN);
    for (    IConnection con : outgoingConnections) {
      INodeConnector connector=this.getConnectorFromName(con.getConnectorName());
      if (connector == null && con instanceof Connection) {
        ((Connection)con).disconnect();
      }
    }
    String typeName="String_Node_Str";
    outgoingConnections=this.getOutgoingConnections(EConnectionType.FLOW_MAIN);
    if (outgoingConnections.size() > jobletBuildConnectorNum) {
      String errorMessage=Messages.getString("String_Node_Str",typeName);
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
 else     if (outgoingConnections.size() < jobletBuildConnectorNum) {
      String errorMessage=Messages.getString("String_Node_Str",typeName);
      Problems.add(ProblemStatus.WARNING,this,errorMessage);
    }
  }
}