Added logs and cleaned up imports

This commit is contained in:
Eugene Livis 2015-10-14 15:53:12 -04:00
parent 09c0f5dfc2
commit 0838207a9c
5 changed files with 5 additions and 14 deletions

View File

@ -28,7 +28,6 @@ import java.io.IOException;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.GeneralSecurityException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

View File

@ -18,23 +18,22 @@
*/
package org.sleuthkit.autopsy.core;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.Base64;
import java.util.logging.Level;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
/**
* Provides ability to convert text to hex text.
*/
class TextConverter {
private static final Logger logger = Logger.getLogger(TextConverter.class.getName());
private static final char[] TMP = "dontlookhere".toCharArray();
private static final byte[] SALT = {
(byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12,
@ -55,6 +54,7 @@ class TextConverter {
pbeCipher.init(Cipher.ENCRYPT_MODE, key, new PBEParameterSpec(SALT, 20));
return base64Encode(pbeCipher.doFinal(property.getBytes("UTF-8")));
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error converting text to hex text", ex); //NON-NLS
throw new IllegalArgumentException(
NbBundle.getMessage(TextConverter.class, "TextConverter.convert.exception.txt"));
}
@ -78,6 +78,7 @@ class TextConverter {
pbeCipher.init(Cipher.DECRYPT_MODE, key, new PBEParameterSpec(SALT, 20));
return new String(pbeCipher.doFinal(base64Decode(property)), "UTF-8");
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error converting hex text to text", ex); //NON-NLS
throw new IllegalArgumentException(
NbBundle.getMessage(TextConverter.class, "TextConverter.convertFromHex.exception.txt"));
}

View File

@ -18,9 +18,6 @@
*/
package org.sleuthkit.autopsy.core;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.prefs.BackingStoreException;
import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo;
import java.util.prefs.PreferenceChangeListener;

View File

@ -18,12 +18,8 @@ import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.events.MessageServiceConnectionInfo;
import org.sleuthkit.autopsy.coreutils.Logger;
import java.awt.Cursor;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import javax.swing.ImageIcon;
import org.openide.util.Exceptions;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;

View File

@ -19,9 +19,7 @@
package org.sleuthkit.autopsy.events;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
import java.util.Set;
import java.util.logging.Level;
import javax.jms.JMSException;