5061 log unlogged exceptions, fix copy paste and typo comment errors

This commit is contained in:
William Schaefer 2019-06-06 12:52:09 -04:00
parent 938d0826d7
commit 65bf9cc497
4 changed files with 12 additions and 12 deletions

View File

@ -71,7 +71,7 @@ public class BingTranslator implements TextTranslator {
}
/**
* Converts an input test to the JSON format required by Bing Translator,
* Converts an input text to the JSON format required by Bing Translator,
* posts it to Microsoft, and returns the JSON text response.
*
* @param string The input text to be translated.

View File

@ -22,7 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
/**
* Class to handle the settings associated with the GoogleTranslator
* Class to handle the settings associated with the BingTranslator
*/
public final class BingTranslatorSettings {
@ -35,7 +35,7 @@ public final class BingTranslatorSettings {
private String targetLanguageCode;
/**
* Construct a new GoogleTranslatorSettingsObject
* Construct a new BingTranslatorSettings object
*/
BingTranslatorSettings() {
loadSettings();

View File

@ -36,7 +36,7 @@ import org.apache.commons.lang3.StringUtils;
import org.openide.util.NbBundle.Messages;
/**
* Settings panel for the GoogleTranslator
* Settings panel for the BingTranslator
*/
public class BingTranslatorSettingsPanel extends javax.swing.JPanel {
@ -47,7 +47,7 @@ public class BingTranslatorSettingsPanel extends javax.swing.JPanel {
private String targetLanguageCode = "";
/**
* Creates new form GoogleTranslatorSettingsPanel
* Creates new form BingTranslatorSettingsPanel
*/
public BingTranslatorSettingsPanel(String authenticationKey, String code) {
initComponents();
@ -254,16 +254,13 @@ public class BingTranslatorSettingsPanel extends javax.swing.JPanel {
private javax.swing.JLabel untranslatedLabel;
private javax.swing.JLabel warningLabel;
// End of variables declaration//GEN-END:variables
/**
* Converts an input test to the JSON format required by Bing Translator,
* posts it to Microsoft, and returns the JSON text response.
* Attempts to translate the text specified in the Untranslated field using
* the settings currently specified but not necessarily saved
*
* @param string The input text to be translated.
* @return true if the translation was able to be performed, false otherwise
*
* @return The translation response as a JSON string
*
* @throws IOException if the request could not be executed due to
* cancellation, a connectivity problem or timeout.
*/
private boolean testTranslationSetup() {
testResultValueLabel.setText("");
@ -291,6 +288,7 @@ public class BingTranslatorSettingsPanel extends javax.swing.JPanel {
testResultValueLabel.setText(translation0.get("text").getAsString());
return true;
} catch (IOException | IllegalStateException | ClassCastException | NullPointerException | IndexOutOfBoundsException e) {
logger.log(Level.WARNING, "Test of Bing Translator failed due to exception", ex);
return false;
}
}

View File

@ -73,8 +73,10 @@ public final class GoogleTranslator implements TextTranslator {
address = InetAddress.getByName(host);
return address.isReachable(1500);
} catch (UnknownHostException ex) {
logger.log(Level.WARNING, "Unable to reach google.com due to unknown host", ex);
return false;
} catch (IOException ex) {
logger.log(Level.WARNING, "Unable to reach google.com due IOException", ex);
return false;
}
}