Skip to content

Commit 4784a4b

Browse files
authored
Add error logging when removing empty voice commands and voice command strings (#1799)
* Add error logging when removing empty commands * Switch from logging error to logging warnings * Update warning messages based on PR suggestions
1 parent 0f75391 commit 4784a4b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,27 @@ List<VoiceCommand> removeEmptyVoiceCommands(List<VoiceCommand> voiceCommands) {
217217
List<VoiceCommand> validatedVoiceCommands = new ArrayList<>();
218218
for (VoiceCommand voiceCommand : voiceCommands) {
219219
if (voiceCommand == null) {
220+
DebugTool.logWarning(TAG, "Voice command is null, it will not be uploaded");
220221
continue;
221222
}
222223
List<String> voiceCommandStrings = new ArrayList<>();
223224
for (String voiceCommandString : voiceCommand.getVoiceCommands()) {
224225
if (voiceCommandString == null) {
226+
DebugTool.logWarning(TAG, "Removing null string from voice command");
225227
continue;
226228
}
227229
String trimmedString = voiceCommandString.trim();
228230
if (trimmedString.length() > 0) {
229231
voiceCommandStrings.add(trimmedString);
232+
} else {
233+
DebugTool.logWarning(TAG, "Empty string removed from voice command");
230234
}
231235
}
232236
if (voiceCommandStrings.size() > 0) {
233237
voiceCommand.setVoiceCommands(voiceCommandStrings);
234238
validatedVoiceCommands.add(voiceCommand);
239+
} else {
240+
DebugTool.logWarning(TAG, "Voice command will not be uploaded as it contained no valid strings");
235241
}
236242
}
237243
return validatedVoiceCommands;

0 commit comments

Comments
 (0)