Skip to content

Commit

Permalink
Fixed a bug where selecting all prompt IDs under certain conditions w…
Browse files Browse the repository at this point in the history
…ould cause a crash.
  • Loading branch information
John Jenkins committed Dec 17, 2011
1 parent 3ad5fe5 commit cfd2f46
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/org/ohmage/request/survey/SurveyResponseReadRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -932,13 +932,21 @@ else if(OutputFormat.JSON_COLUMNS.equals(outputFormat) ||
}
}
else if(promptIds != null) {
int currNumPrompts = 0;
Map<Integer, SurveyItem> tempPromptMap = new HashMap<Integer, SurveyItem>(promptIds.size());
for(String promptId : promptIds) {
tempPromptMap.put(currNumPrompts, campaign.getPrompt(campaign.getSurveyIdForPromptId(promptId), promptId));
if(this.promptIds.equals(URN_SPECIAL_ALL_LIST)) {
for(Survey currSurvey : campaign.getSurveys().values()) {
populatePrompts(currSurvey.getSurveyItems(), prompts);
}
}
else {
int currNumPrompts = 0;
Map<Integer, SurveyItem> tempPromptMap = new HashMap<Integer, SurveyItem>(promptIds.size());
for(String promptId : promptIds) {
tempPromptMap.put(currNumPrompts, campaign.getPrompt(campaign.getSurveyIdForPromptId(promptId), promptId));
currNumPrompts++;
}

populatePrompts(tempPromptMap, prompts);
}

populatePrompts(tempPromptMap, prompts);
}
}
else {
Expand Down

0 comments on commit cfd2f46

Please sign in to comment.