Program: 69458
Project: 69458
Buggy source:
private void extractTextEntrySettingsFromResponseDeclaration(){
  double mappedScore=0.0d;
  for (  Map.Entry<String,TextEntry> textEntryEntry : responseIdentifierToTextEntry.entrySet()) {
    TextEntry textEntry=textEntryEntry.getValue();
    ResponseDeclaration responseDeclaration=assessmentItem.getResponseDeclaration(textEntry.getResponseIdentifier());
    if (responseDeclaration != null) {
      String solution=null;
      CorrectResponse correctResponse=responseDeclaration.getCorrectResponse();
      if (correctResponse != null && correctResponse.getFieldValues().size() > 0) {
        List<FieldValue> fValues=correctResponse.getFieldValues();
        SingleValue sValue=fValues.get(0).getSingleValue();
        if (sValue instanceof StringValue) {
          solution=((StringValue)sValue).stringValue();
          textEntry.setSolution(solution);
        }
        if (correctResponse.getFieldValues().size() > 1) {
          List<TextEntryAlternative> alternatives=new ArrayList<>();
          for (int i=1; i < correctResponse.getFieldValues().size(); i++) {
            SingleValue aValue=fValues.get(i).getSingleValue();
            if (aValue instanceof StringValue) {
              TextEntryAlternative alternative=new TextEntryAlternative();
              alternative.setAlternative(((StringValue)aValue).stringValue());
              alternatives.add(alternative);
            }
          }
          textEntry.setAlternatives(alternatives);
        }
      }
      Mapping mapping=responseDeclaration.getMapping();
      if (mapping != null) {
        boolean caseSensitive=true;
        List<TextEntryAlternative> alternatives=new ArrayList<>();
        if (mapping != null) {
          List<MapEntry> mapEntries=mapping.getMapEntries();
          for (          MapEntry mapEntry : mapEntries) {
            TextEntryAlternative alternative=new TextEntryAlternative();
            SingleValue sValue=mapEntry.getMapKey();
            if (sValue instanceof StringValue) {
              String alt=((StringValue)sValue).stringValue();
              if (solution == null || !solution.equals(alt)) {
                alternative.setAlternative(alt);
                alternative.setScore(mapEntry.getMappedValue());
                alternatives.add(alternative);
                mappedScore+=mapEntry.getMappedValue();
              }
            }
            caseSensitive&=mapEntry.getCaseSensitive();
          }
        }
        textEntry.setCaseSensitive(caseSensitive);
        textEntry.setAlternatives(alternatives);
      }
    }
  }
  boolean hasMapping=mappedScore > (-1.0 * responseIdentifierToTextEntry.size());
  scoreEvaluation=hasMapping ? ScoreEvaluation.perAnswer : ScoreEvaluation.allCorrectAnswers;
}

Fixed version (ground truth):
private void extractTextEntrySettingsFromResponseDeclaration(){
  double mappedScore=0.0d;
  for (  Map.Entry<String,TextEntry> textEntryEntry : responseIdentifierToTextEntry.entrySet()) {
    TextEntry textEntry=textEntryEntry.getValue();
    ResponseDeclaration responseDeclaration=assessmentItem.getResponseDeclaration(textEntry.getResponseIdentifier());
    if (responseDeclaration != null) {
      String solution=null;
      CorrectResponse correctResponse=responseDeclaration.getCorrectResponse();
      if (correctResponse != null && correctResponse.getFieldValues().size() > 0) {
        List<FieldValue> fValues=correctResponse.getFieldValues();
        SingleValue sValue=fValues.get(0).getSingleValue();
        if (sValue instanceof StringValue) {
          solution=((StringValue)sValue).stringValue();
          textEntry.setSolution(solution);
        }
        if (correctResponse.getFieldValues().size() > 1) {
          List<TextEntryAlternative> alternatives=new ArrayList<>();
          for (int i=1; i < correctResponse.getFieldValues().size(); i++) {
            SingleValue aValue=fValues.get(i).getSingleValue();
            if (aValue instanceof StringValue) {
              TextEntryAlternative alternative=new TextEntryAlternative();
              alternative.setAlternative(((StringValue)aValue).stringValue());
              alternatives.add(alternative);
            }
          }
          textEntry.setAlternatives(alternatives);
        }
      }
      Mapping mapping=responseDeclaration.getMapping();
      if (mapping != null) {
        boolean caseSensitive=true;
        List<TextEntryAlternative> alternatives=new ArrayList<>();
        if (mapping != null) {
          List<MapEntry> mapEntries=mapping.getMapEntries();
          for (          MapEntry mapEntry : mapEntries) {
            TextEntryAlternative alternative=new TextEntryAlternative();
            SingleValue sValue=mapEntry.getMapKey();
            if (sValue instanceof StringValue) {
              String alt=((StringValue)sValue).stringValue();
              if (solution == null || !solution.equals(alt)) {
                alternative.setAlternative(alt);
                alternative.setScore(mapEntry.getMappedValue());
                alternatives.add(alternative);
                mappedScore+=mapEntry.getMappedValue();
              }
 else               if (alt.equals(solution)) {
                textEntry.setScore(mapEntry.getMappedValue());
              }
            }
            caseSensitive&=mapEntry.getCaseSensitive();
          }
        }
        textEntry.setCaseSensitive(caseSensitive);
        textEntry.setAlternatives(alternatives);
      }
    }
  }
  boolean hasMapping=mappedScore > (-1.0 * responseIdentifierToTextEntry.size());
  scoreEvaluation=hasMapping ? ScoreEvaluation.perAnswer : ScoreEvaluation.allCorrectAnswers;
}