diff --git a/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java b/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java index eb4e8a5535bfb7c592e42240118589789daa6af5..a042b5b25adabbc1163a960963a62080134043a4 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java +++ b/bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java @@ -1,7 +1,7 @@ /* * SleuthKit Java Bindings * - * Copyright 2011-2017 Basis Technology Corp. + * Copyright 2011-2018 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -82,8 +82,8 @@ public abstract class AbstractFile extends AbstractContent { private boolean md5HashDirty = false; private String mimeType; private boolean mimeTypeDirty = false; - private static final Logger logger = Logger.getLogger(AbstractFile.class.getName()); - private static final ResourceBundle bundle = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle"); + private static final Logger LOGGER = Logger.getLogger(AbstractFile.class.getName()); + private static final ResourceBundle BUNDLE = ResourceBundle.getBundle("org.sleuthkit.datamodel.Bundle"); private long dataSourceObjectId; private final String extension; @@ -801,7 +801,7 @@ protected int readInt(byte[] buf, long offset, long len) throws TskCoreException protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreException { if (!localPathSet) { throw new TskCoreException( - bundle.getString("AbstractFile.readLocal.exception.msg1.text")); + BUNDLE.getString("AbstractFile.readLocal.exception.msg1.text")); } if (isDir()) { @@ -811,11 +811,11 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE loadLocalFile(); if (!localFile.exists()) { throw new TskCoreException( - MessageFormat.format(bundle.getString("AbstractFile.readLocal.exception.msg2.text"), localAbsPath)); + MessageFormat.format(BUNDLE.getString("AbstractFile.readLocal.exception.msg2.text"), localAbsPath)); } if (!localFile.canRead()) { throw new TskCoreException( - MessageFormat.format(bundle.getString("AbstractFile.readLocal.exception.msg3.text"), localAbsPath)); + MessageFormat.format(BUNDLE.getString("AbstractFile.readLocal.exception.msg3.text"), localAbsPath)); } int bytesRead = 0; @@ -826,10 +826,10 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE try { localFileHandle = new RandomAccessFile(localFile, "r"); } catch (FileNotFoundException ex) { - final String msg = MessageFormat.format(bundle.getString( + final String msg = MessageFormat.format(BUNDLE.getString( "AbstractFile.readLocal.exception.msg4.text"), localAbsPath); - logger.log(Level.SEVERE, msg, ex); + LOGGER.log(Level.SEVERE, msg, ex); //file could have been deleted or moved throw new TskCoreException(msg, ex); } @@ -863,8 +863,8 @@ protected final int readLocal(byte[] buf, long offset, long len) throws TskCoreE return localFileHandle.read(buf, 0, (int) len); } } catch (IOException ex) { - final String msg = MessageFormat.format(bundle.getString("AbstractFile.readLocal.exception.msg5.text"), localAbsPath); - logger.log(Level.SEVERE, msg, ex); + final String msg = MessageFormat.format(BUNDLE.getString("AbstractFile.readLocal.exception.msg5.text"), localAbsPath); + LOGGER.log(Level.SEVERE, msg, ex); //local file could have been deleted / moved throw new TskCoreException(msg, ex); } @@ -937,7 +937,7 @@ public boolean exists() { loadLocalFile(); return localFile.exists(); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, ex.getMessage()); + LOGGER.log(Level.SEVERE, ex.getMessage()); return false; } } @@ -958,7 +958,7 @@ public boolean canRead() { loadLocalFile(); return localFile.canRead(); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, ex.getMessage()); + LOGGER.log(Level.SEVERE, ex.getMessage()); return false; } } @@ -973,7 +973,7 @@ public boolean canRead() { private void loadLocalFile() throws TskCoreException { if (!localPathSet) { throw new TskCoreException( - bundle.getString("AbstractFile.readLocal.exception.msg1.text")); + BUNDLE.getString("AbstractFile.readLocal.exception.msg1.text")); } // already been set @@ -998,7 +998,7 @@ public void close() { try { localFileHandle.close(); } catch (IOException ex) { - logger.log(Level.SEVERE, "Could not close file handle for file: " + getParentPath() + "/" + getName(), ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Could not close file handle for file: " + getParentPath() + getName(), ex); //NON-NLS } localFileHandle = null; }