mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
5061 log unlogged exceptions, fix copy paste and typo comment errors
This commit is contained in:
parent
938d0826d7
commit
65bf9cc497
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user