From 4784a4bcc4aa1ae697f5c48f6d6271cd9bda1bda Mon Sep 17 00:00:00 2001 From: noah-livio <95378272+noah-livio@users.noreply.github.com> Date: Fri, 25 Mar 2022 13:37:57 -0400 Subject: [PATCH] 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 --- .../managers/screen/menu/BaseVoiceCommandManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java index 0cf2549cbe..ec07e5305e 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/menu/BaseVoiceCommandManager.java @@ -217,21 +217,27 @@ List removeEmptyVoiceCommands(List voiceCommands) { List validatedVoiceCommands = new ArrayList<>(); for (VoiceCommand voiceCommand : voiceCommands) { if (voiceCommand == null) { + DebugTool.logWarning(TAG, "Voice command is null, it will not be uploaded"); continue; } List voiceCommandStrings = new ArrayList<>(); for (String voiceCommandString : voiceCommand.getVoiceCommands()) { if (voiceCommandString == null) { + DebugTool.logWarning(TAG, "Removing null string from voice command"); continue; } String trimmedString = voiceCommandString.trim(); if (trimmedString.length() > 0) { voiceCommandStrings.add(trimmedString); + } else { + DebugTool.logWarning(TAG, "Empty string removed from voice command"); } } if (voiceCommandStrings.size() > 0) { voiceCommand.setVoiceCommands(voiceCommandStrings); validatedVoiceCommands.add(voiceCommand); + } else { + DebugTool.logWarning(TAG, "Voice command will not be uploaded as it contained no valid strings"); } } return validatedVoiceCommands;