From d0e6b72e69a81cb0385194e9ade0dfa738e16c92 Mon Sep 17 00:00:00 2001 From: Carl Wilson Date: Fri, 18 May 2018 16:37:38 +0100 Subject: [PATCH 1/3] MAINT - Core and apps compiler warnings - removed unthrown exceptions in method definitions; - removed unused variables, code, and imports, including `PropertyPath.java`; - made methods static where trivial; - replaced some `for (int i...)` loops with `for (x : y)` style; - added try with resources for file and stream handling where trivial; - explicit types for generic declarations; - fixed `variable.equals(constant)` to be `constant.equals(variable)` to protect against null pointer errors; - removed associated and unnecessary casts; and - added missing `@Override` annotations. --- jhove-apps/src/main/java/ADump.java | 1 - jhove-apps/src/main/java/GDump.java | 7 +- jhove-apps/src/main/java/J2Dump.java | 9 +- jhove-apps/src/main/java/JDump.java | 12 +- jhove-apps/src/main/java/Jhove.java | 2 +- jhove-apps/src/main/java/TDump.java | 34 +-- jhove-apps/src/main/java/UserHome.java | 2 +- jhove-apps/src/main/java/WDump.java | 1 - .../harvard/hul/ois/jhove/ConfigWriter.java | 6 +- .../jhove/DefaultConfigurationBuilder.java | 21 +- .../hul/ois/jhove/viewer/AppInfoWindow.java | 7 +- .../hul/ois/jhove/viewer/ConfigWindow.java | 25 +- .../hul/ois/jhove/viewer/InfoWindow.java | 20 +- .../hul/ois/jhove/viewer/JhoveWindow.java | 36 ++- .../ois/jhove/viewer/ModuleInfoWindow.java | 41 +-- .../hul/ois/jhove/viewer/NoConfAlert.java | 1 + .../hul/ois/jhove/viewer/PrefsWindow.java | 3 + .../hul/ois/jhove/viewer/RepTreeRoot.java | 53 ++-- .../hul/ois/jhove/viewer/ViewHandler.java | 9 +- .../hul/ois/jhove/viewer/ViewWindow.java | 11 +- .../hul/ois/jhove/AESAudioMetadata.java | 44 ++- .../java/edu/harvard/hul/ois/jhove/App.java | 7 - .../hul/ois/jhove/ByteArrayXMPSource.java | 2 +- .../hul/ois/jhove/ChecksumInputStream.java | 5 + .../harvard/hul/ois/jhove/Checksummer.java | 6 +- .../harvard/hul/ois/jhove/ConfigHandler.java | 57 ++-- .../hul/ois/jhove/CountedInputStream.java | 4 + .../edu/harvard/hul/ois/jhove/Document.java | 18 +- .../hul/ois/jhove/EnumerationType.java | 1 + .../harvard/hul/ois/jhove/HandlerBase.java | 37 ++- .../edu/harvard/hul/ois/jhove/JhoveBase.java | 12 +- .../edu/harvard/hul/ois/jhove/MacStuff.java | 4 +- .../edu/harvard/hul/ois/jhove/ModuleBase.java | 78 +++-- .../hul/ois/jhove/ObjectIdentifier.java | 104 +++---- .../edu/harvard/hul/ois/jhove/Property.java | 14 +- .../harvard/hul/ois/jhove/PropertyPath.java | 276 ------------------ .../harvard/hul/ois/jhove/RAFInputStream.java | 7 +- .../edu/harvard/hul/ois/jhove/Rational.java | 1 + .../edu/harvard/hul/ois/jhove/RepInfo.java | 27 +- .../hul/ois/jhove/XMLWrapperStream.java | 7 +- .../edu/harvard/hul/ois/jhove/XMPHandler.java | 41 +-- .../hul/ois/jhove/handler/AuditHandler.java | 75 +++-- .../hul/ois/jhove/handler/TextHandler.java | 36 +-- .../hul/ois/jhove/handler/XmlHandler.java | 32 +- .../ois/jhove/module/BytestreamModule.java | 3 +- 45 files changed, 495 insertions(+), 704 deletions(-) delete mode 100644 jhove-core/src/main/java/edu/harvard/hul/ois/jhove/PropertyPath.java diff --git a/jhove-apps/src/main/java/ADump.java b/jhove-apps/src/main/java/ADump.java index aea25df1b..a2d605d4e 100644 --- a/jhove-apps/src/main/java/ADump.java +++ b/jhove-apps/src/main/java/ADump.java @@ -51,7 +51,6 @@ public static void main (String [] args) FileInputStream file = new FileInputStream (args[0]); BufferedInputStream buffer = new BufferedInputStream (file); DataInputStream stream = new DataInputStream (buffer); - ADump dump = new ADump (); // Just to access contained classes long os = 0; for (int i=0; i<4; i++) { int ch; diff --git a/jhove-apps/src/main/java/GDump.java b/jhove-apps/src/main/java/GDump.java index c73ad5632..1ceac0c2f 100644 --- a/jhove-apps/src/main/java/GDump.java +++ b/jhove-apps/src/main/java/GDump.java @@ -43,10 +43,9 @@ public static void main (String [] args) System.exit (-1); } - try { - FileInputStream file = new FileInputStream (args[0]); - BufferedInputStream buffer = new BufferedInputStream (file); - DataInputStream stream = new DataInputStream (buffer); + try (FileInputStream file = new FileInputStream (args[0]); + BufferedInputStream buffer = new BufferedInputStream (file); + DataInputStream stream = new DataInputStream (buffer)) { boolean bigEndian = false; String signature = readChars (stream, 3); diff --git a/jhove-apps/src/main/java/J2Dump.java b/jhove-apps/src/main/java/J2Dump.java index dc0baaa6f..78517000f 100644 --- a/jhove-apps/src/main/java/J2Dump.java +++ b/jhove-apps/src/main/java/J2Dump.java @@ -65,7 +65,6 @@ public static void main (String [] args) DataInputStream stream = new DataInputStream (buffer); J2Dump dump = new J2Dump (); // Just to access contained classes long os = 0; - boolean bigEndian = true; int i; for (i = 0; i < 12; i++) { int ch; @@ -78,7 +77,7 @@ public static void main (String [] args) os += 12; boolean endOfFile = false; - Stack boxStack = new Stack (); + Stack boxStack = new Stack<>(); while (!endOfFile) { //If there are boxes on the stack, see if there's space //left in the top one. @@ -88,7 +87,7 @@ public static void main (String [] args) if (boxStack.isEmpty ()) { break; } - boxtop = (Box) boxStack.peek (); + boxtop = boxStack.peek (); if (boxtop.bytesLeft > 0) { break; } @@ -135,13 +134,13 @@ public static void main (String [] args) /* Constructs a qualifying prefix to indicate nested boxes. */ - private static String stackPrefix (Stack boxStack) + private static String stackPrefix (Stack boxStack) { StringBuffer retval = new StringBuffer (); // In defiance of gravity, we rummage through the stack // of boxes starting at the bottom. for (int i = 0; i < boxStack.size(); i++) { - Box box = (Box) boxStack.elementAt (i); + Box box = boxStack.elementAt (i); // Remove trailing spaces from types for better readability retval.append (box.type.trim() + "/"); } diff --git a/jhove-apps/src/main/java/JDump.java b/jhove-apps/src/main/java/JDump.java index 9ba750dca..3dbe2d2a8 100644 --- a/jhove-apps/src/main/java/JDump.java +++ b/jhove-apps/src/main/java/JDump.java @@ -43,10 +43,9 @@ public static void main (String [] args) System.exit (-1); } - try { - FileInputStream file = new FileInputStream (args[0]); - BufferedInputStream buffer = new BufferedInputStream (file); - DataInputStream stream = new DataInputStream (buffer); + try (FileInputStream file = new FileInputStream (args[0]); + BufferedInputStream buffer = new BufferedInputStream (file); + DataInputStream stream = new DataInputStream (buffer)) { boolean bigEndian = true; long os = 0; @@ -60,9 +59,7 @@ public static void main (String [] args) if (!readingECS) { if (!haveCode) { code = stream.readUnsignedByte (); - for (int i=0; - (code = stream.readUnsignedByte ()) == 0xff; - i++) { + while(stream.readUnsignedByte () == 0xff) { System.out.println (leading (os, 8) + os + ": fill 0xff"); os++; @@ -115,7 +112,6 @@ else if ((code >= 0xc0 && code <= 0xc3) || int Nf = stream.readUnsignedByte (); int [] Ci = new int [Nf]; int [] Hi = new int [Nf]; - int [] Vi = new int [Nf]; int [] Tqi = new int [Nf]; for (int i=0; i list = new ArrayList (); + List list = new ArrayList<> (); /********************************************************** diff --git a/jhove-apps/src/main/java/TDump.java b/jhove-apps/src/main/java/TDump.java index 7063fda35..0848ceddc 100644 --- a/jhove-apps/src/main/java/TDump.java +++ b/jhove-apps/src/main/java/TDump.java @@ -36,7 +36,7 @@ public class TDump /** Count of IFDs. */ private static int _nIFDs; /** Sorted associative map of tags. */ - private static Map _tags; + private static Map _tags; /****************************************************************** * MAIN ENTRY POINT. @@ -70,14 +70,11 @@ else if (tiff == null) { /* Accumlate all tag definitions in a sorted map. */ - _tags = new TreeMap (); + _tags = new TreeMap<> (); int err = 0; - try { - - /* Read TIFF header. */ - - RandomAccessFile file = new RandomAccessFile (tiff, "r"); + try (/* Read TIFF header. */ + RandomAccessFile file = new RandomAccessFile (tiff, "r")) { boolean bigEndian = true; int b1 = ModuleBase.readUnsignedByte (file); int b2 = ModuleBase.readUnsignedByte (file); @@ -106,10 +103,10 @@ else if (tiff == null) { /* Display all tags in offset-sorted order. */ - Iterator iter = _tags.keySet ().iterator (); + Iterator iter = _tags.keySet ().iterator (); while (iter.hasNext ()) { - String os = (String) iter.next (); - System.out.println (os + ": " + (String) _tags.get (os)); + String os = iter.next (); + System.out.println (os + ": " + _tags.get (os)); } if (err != 0) { System.exit (err); @@ -131,16 +128,15 @@ private static long readIFD (RandomAccessFile file, boolean bigEndian, throws Exception { int nIFD = ++_nIFDs; - List subIFDs = new ArrayList (); - List stripByteCounts = new ArrayList (); - List stripOffsets = new ArrayList (); + List subIFDs = new ArrayList<> (); + List stripByteCounts = new ArrayList<> (); + List stripOffsets = new ArrayList<> (); file.seek (offset); int nEntries = ModuleBase.readUnsignedShort (file, bigEndian); _tags.put (leading (offset, 8) + offset, "IFD " + nIFD + " with " + nEntries + " entries"); - String name = null; for (int i=0; i 0) { } } @@ -347,8 +343,8 @@ else if (type == IFD.SSHORT) { int len = stripOffsets.size (); if (len > 0) { for (int j=0; j modules, File homeDir, File tempDir, String encoding, - int bufferSize) throws IOException + int bufferSize) { writeHead (); @@ -159,7 +159,7 @@ public void writeFile (List modules, } /* Write the fixed lines which begin the config file */ - private void writeHead () throws IOException + private void writeHead () { _confOut.println(""); _confOut.println(""); } diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/DefaultConfigurationBuilder.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/DefaultConfigurationBuilder.java index 5ec174067..951c0bd06 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/DefaultConfigurationBuilder.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/DefaultConfigurationBuilder.java @@ -47,28 +47,15 @@ public DefaultConfigurationBuilder (File location) { public void writeDefaultConfigFile () throws IOException { -// if (TEMP_DEBUG) { -// String configFileName = "null"; -// if (configFile != null) -// configFileName = configFile.getAbsolutePath(); -// System.out.println ("writeDefaultConfigFile: path is " + configFileName); -// } ConfigWriter cw = new ConfigWriter (configFile, null); List modules = getModules(); // TextHandler, XmlHandler, and AuditHandler are loaded by // default, so there are no handlers to put in the config file. - List handlers = new ArrayList (); + List handlers = new ArrayList<> (); File homeDir = new File (JHOVE_DIR); File tempDir = new File (TEMP_DIR); - try { - cw.writeFile(modules, handlers, homeDir, tempDir, - DEFAULT_ENCODING, DEFAULT_BUFFER_SIZE); - } - catch (IOException e) { -// if (TEMP_DEBUG) -// e.printStackTrace(); - throw e; - } + cw.writeFile(modules, handlers, homeDir, tempDir, + DEFAULT_ENCODING, DEFAULT_BUFFER_SIZE); } // public void writeDefaultConfigFile () throws IOException { @@ -90,7 +77,7 @@ public File getConfigFile () { protected List getModules () { int nModules = builtInModules.length; - ArrayList mods = new ArrayList (nModules); + ArrayList mods = new ArrayList<> (nModules); try { for (int i = 0; i < nModules; i++) { Class cls = builtInModules[i]; diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/AppInfoWindow.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/AppInfoWindow.java index c86414f25..5f75a31da 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/AppInfoWindow.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/AppInfoWindow.java @@ -27,6 +27,7 @@ public AppInfoWindow (App app, JhoveBase jbase) super ("Application Info", app, jbase); setSaveActionListener ( new ActionListener() { + @Override public void actionPerformed (ActionEvent e) { saveInfo (); } @@ -86,11 +87,11 @@ private void showApp (App app, JhoveBase jbase) if (saxClass != null) { texta.append ("SAX parser: " + saxClass + eol); } - Iterator iter = jbase.getModuleMap ().keySet ().iterator (); + Iterator iter = jbase.getModuleMap ().keySet ().iterator (); while (iter.hasNext ()) { //Module module = jbase.getModuleMap ((String) iter.next ()); - Map moduleMap = jbase.getModuleMap (); - Module module = (Module) moduleMap.get ((String) iter.next ()); + Map moduleMap = jbase.getModuleMap (); + Module module = moduleMap.get (iter.next ()); texta.append (" Module: " + module.getName () + " " + module.getRelease () + eol); } diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ConfigWindow.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ConfigWindow.java index c91349e01..8d889c90a 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ConfigWindow.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ConfigWindow.java @@ -99,8 +99,8 @@ public ConfigWindow (JFrame parent, File configFile, ConfigHandler handler) } else { // Set up defaults - _modules = new ArrayList (10); - _handlers = new ArrayList (5); + _modules = new ArrayList<> (10); + _handlers = new ArrayList<> (5); _bufferSize = -1; _homeDir = null; _tempDir = null; @@ -147,24 +147,29 @@ private void addModuleTable () _mainBox.add (panel); // Use an anonymous class to implement the TableModel _modTableModel = new AbstractTableModel () { + @Override public int getRowCount () { return _modules.size (); } + @Override public int getColumnCount () { return 2; } + @Override public boolean isCellEditable(int row, int col) { return true; } + @Override public Object getValueAt (int row, int column) { ModuleInfo modInfo = _modules.get (row); String[] tuple = { modInfo.clas, modInfo.init}; return tuple[column]; } + @Override public void setValueAt (Object obj, int row, int column) { ModuleInfo modInfo = _modules.get(row); @@ -199,6 +204,7 @@ public void setValueAt (Object obj, int row, int column) JButton addButton = new JButton ("Add"); addButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { addModule (); @@ -209,6 +215,7 @@ public void actionPerformed (ActionEvent e) JButton delButton = new JButton ("Delete"); delButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { deleteModule (); @@ -239,26 +246,31 @@ private void addHandlerTable () _mainBox.add (panel); // Use an anonymous class to implement the TableModel _hanTableModel = new AbstractTableModel () { + @Override public int getRowCount () { return _handlers.size (); } + @Override public int getColumnCount () { return 1; } + @Override public boolean isCellEditable(int row, int col) { return true; } + @Override public Object getValueAt (int row, int column) { - String[] tuple = (String[]) _handlers.get (row); + String[] tuple = _handlers.get (row); if (tuple != null) { return tuple[0]; } return ""; } + @Override public void setValueAt (Object obj, int row, int column) { if (obj instanceof String) { @@ -288,6 +300,7 @@ public void setValueAt (Object obj, int row, int column) JButton addButton = new JButton ("Add"); addButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { addHandler (); @@ -298,6 +311,7 @@ public void actionPerformed (ActionEvent e) JButton delButton = new JButton ("Delete"); delButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { deleteHandler (); @@ -362,6 +376,7 @@ private void addHomeDir () bpan.add (homeButton); homeButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { chooseHomeDir (); @@ -393,6 +408,7 @@ private void addTempDir () bpan.add (tempDirButton); tempDirButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { chooseTempDir (); @@ -429,6 +445,7 @@ private void addSaveCancel () getRootPane().setDefaultButton (saveButton); saveButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { doSave (); @@ -443,6 +460,7 @@ public void actionPerformed (ActionEvent e) JButton cancelButton = new JButton ("Cancel"); cancelButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { thiscw.dispose (); @@ -525,6 +543,7 @@ private void chooseTempDir () JButton defaultButton = new JButton ("System Default"); defaultButton.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { // Exit the dialog and clear _tempDir diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/InfoWindow.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/InfoWindow.java index ac8603f10..408780478 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/InfoWindow.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/InfoWindow.java @@ -30,8 +30,8 @@ public abstract class InfoWindow extends JFrame private JhoveBase _base; private JMenuItem _saveItem; private JMenuItem _closeItem; - private JComboBox _handlerBox; - private JComboBox _encodingBox; + private JComboBox _handlerBox; + private JComboBox _encodingBox; private static String _lastEncoding; private static String _lastHandler; @@ -75,6 +75,7 @@ public InfoWindow(String title, App app, JhoveBase base) _closeItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); _closeItem.addActionListener (new ActionListener() { + @Override public void actionPerformed (ActionEvent e) { closeFromMenu (); } @@ -131,14 +132,14 @@ protected PrintWriter doSaveDialog () accessory.setPreferredSize(new Dimension (180, 120)); // Build list of handlers into a popup menu - Vector handlerItems = new Vector (10); - java.util.List handlerList = _base.getHandlerList (); - Iterator iter = handlerList.iterator (); + Vector handlerItems = new Vector<> (10); + java.util.List handlerList = _base.getHandlerList (); + Iterator iter = handlerList.iterator (); while (iter.hasNext ()) { OutputHandler han = (OutputHandler) iter.next (); handlerItems.add (han.getName ()); } - _handlerBox = new JComboBox(handlerItems); + _handlerBox = new JComboBox<>(handlerItems); _handlerBox.setSize (120, 20); accessory.add (new JLabel ("Choose output handler")); if (_lastHandler != null) { @@ -148,7 +149,7 @@ protected PrintWriter doSaveDialog () // Build a list of encodings into a popup menu. // The default encoding must be the first. - Vector encItems = new Vector (5); + Vector encItems = new Vector<> (5); String defEnc = _base.getEncoding (); if (defEnc != null) { encItems.add (defEnc); @@ -159,7 +160,7 @@ protected PrintWriter doSaveDialog () encItems.add (enc); } } - _encodingBox = new JComboBox (encItems); + _encodingBox = new JComboBox<> (encItems); if (_lastEncoding != null) { _encodingBox.setSelectedItem (_lastEncoding); } @@ -242,10 +243,9 @@ protected PrintWriter doSaveDialog () */ protected OutputHandler selectHandler () { - int modidx = _handlerBox.getSelectedIndex (); _lastHandler = (String) _handlerBox.getSelectedItem (); OutputHandler handler = - (OutputHandler) _base.getHandlerMap().get (_lastHandler.toLowerCase ()); + _base.getHandlerMap().get (_lastHandler.toLowerCase ()); _lastEncoding = (String) _encodingBox.getSelectedItem (); handler.setEncoding (_lastEncoding); handler.setApp (_app); diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/JhoveWindow.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/JhoveWindow.java index a3a75b76d..5864b6a29 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/JhoveWindow.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/JhoveWindow.java @@ -94,6 +94,7 @@ public JhoveWindow (App app, JhoveBase base) _app = app; _base = base; _moduleMenuListener = new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { _selectedModule = e.getActionCommand (); } @@ -108,9 +109,10 @@ public void actionPerformed (ActionEvent e) { // Define a Comparator function for Modules Comparator modListComparator = new Comparator () { + @Override public int compare (Module o1, Module o2) { - Module m1 = (Module) o1; - Module m2 = (Module) o2; + Module m1 = o1; + Module m2 = o2; String name1 = m1.getName (); String name2 = m2.getName (); return String.CASE_INSENSITIVE_ORDER.compare (name1, name2); @@ -118,11 +120,11 @@ public int compare (Module o1, Module o2) { }; // Build combo box of available modules - Vector moduleItems = new Vector (10); + Vector moduleItems = new Vector<> (10); java.util.List moduleList = base.getModuleList (); // Clone the list so we can display it in sorted order // without munging the app's preferred order - java.util.List menuModuleList = new ArrayList (moduleList.size ()); + java.util.List menuModuleList = new ArrayList<> (moduleList.size ()); menuModuleList.addAll(moduleList); Collections.sort (menuModuleList, modListComparator); Iterator iter = menuModuleList.iterator (); @@ -164,6 +166,7 @@ public int compare (Module o1, Module o2) { // Set up a companion progress window. This will // be hidden and displayed as needed. ActionListener listener = new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { _base.abort (); } @@ -194,7 +197,8 @@ final private void addMenus () _openFileItem.addActionListener ( new ActionListener () { - public void actionPerformed (ActionEvent e) + @Override + public void actionPerformed (ActionEvent e) { pickAndAnalyzeFile (); } @@ -204,7 +208,8 @@ public void actionPerformed (ActionEvent e) fileMenu.add (_openURLItem); _openURLItem.addActionListener ( new ActionListener () { - public void actionPerformed (ActionEvent e) + @Override + public void actionPerformed (ActionEvent e) { pickAndAnalyzeURL (); } @@ -224,7 +229,8 @@ public void actionPerformed (ActionEvent e) Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); quitItem.addActionListener ( new ActionListener () { - public void actionPerformed (ActionEvent e) + @Override + public void actionPerformed (ActionEvent e) { System.exit (0); } @@ -250,6 +256,7 @@ public void actionPerformed (ActionEvent e) editMenu.add (editConfigItem); editConfigItem.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { openConfigWindow (); @@ -261,6 +268,7 @@ public void actionPerformed (ActionEvent e) editMenu.add (prefItem); prefItem.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { if (_prefsWindow == null) { @@ -279,6 +287,7 @@ public void actionPerformed (ActionEvent e) helpMenu.add (aboutModuleItem); aboutModuleItem.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { showModuleInfo (); @@ -289,6 +298,7 @@ public void actionPerformed (ActionEvent e) helpMenu.add (aboutAppItem); aboutAppItem.addActionListener ( new ActionListener () { + @Override public void actionPerformed (ActionEvent e) { showAppInfo (); @@ -376,7 +386,7 @@ public void pickAndAnalyzeFile1 (File file, Module module) // RepInfo info = new RepInfo (name); try { - List files = new ArrayList(1); + List files = new ArrayList<>(1); files.add (file); openAndParse (files, module); } @@ -396,7 +406,7 @@ public void pickAndAnalyzeFileList1 (List files, Module module) return; } // Set up progress window for the first file - File file = (File) files.get (0); + File file = files.get (0); String name = file.getName (); _base.resetAbort (); _progWind.setDocName (name, false); @@ -522,6 +532,7 @@ public void pickAndAnalyzeURL1 (String uri, Module module) * the object being processed. Will be truncated * at the left if longer than 64 characters. */ + @Override public int callback (int selector, Object parm) { switch (selector) { @@ -719,6 +730,7 @@ private void reportError (String title, String msg) * dragged, and changes the background color to give * visual feedback. */ + @Override public void dragEnter (DropTargetDragEvent dtde) { DataFlavor[] flavors = dtde.getCurrentDataFlavors (); @@ -736,6 +748,7 @@ public void dragEnter (DropTargetDragEvent dtde) * Invoked when the drag leaves the component. * Restores the default background color. */ + @Override public void dragExit (DropTargetEvent dte) { setNormalBackground (); @@ -745,6 +758,7 @@ public void dragExit (DropTargetEvent dte) /** * Does nothing. */ + @Override public void dragOver (DropTargetDragEvent dtde) { } @@ -757,6 +771,7 @@ public void dragOver (DropTargetDragEvent dtde) * have happened, but Windows appears to require it be * done here. */ + @Override public void drop (DropTargetDropEvent dtde) { DataFlavor[] flavors = dtde.getCurrentDataFlavors (); @@ -793,6 +808,7 @@ public void drop (DropTargetDropEvent dtde) * (e.g., by changing the modifier keys). Does nothing, * as we treat copy and move identically. */ + @Override public void dropActionChanged (DropTargetDragEvent dtde) { @@ -845,6 +861,7 @@ protected ParseThread (JhoveWindow win) * Analyzes the URI, file, or file list provided * to this thread object. */ + @Override public void run () { _base.resetAbort(); @@ -921,6 +938,7 @@ protected void setModule (Module module) */ protected class InvisibleFilenameFilter implements FilenameFilter { + @Override public boolean accept (File dir, String name) { return (!name.startsWith (".")); diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ModuleInfoWindow.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ModuleInfoWindow.java index 0dadb7d72..9e45ec902 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ModuleInfoWindow.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ModuleInfoWindow.java @@ -9,7 +9,6 @@ import java.awt.Dimension; import java.awt.Rectangle; import java.io.*; -import java.util.*; import javax.swing.*; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; @@ -39,6 +38,7 @@ public ModuleInfoWindow (App app, JhoveBase base, Module module) _module = module; setSaveActionListener ( new ActionListener() { + @Override public void actionPerformed (ActionEvent e) { saveInfo (); } @@ -107,24 +107,15 @@ public void showModule (Module module) }; texta.append (eol); } - java.util.List list = module.getSignature (); - int n = list.size (); - for (int i=0; i iter = null; if (arity == PropertyArity.SET || arity == PropertyArity.LIST || arity == PropertyArity.MAP) { if (arity == PropertyArity.SET) { - Set set = (Set) pProp.getValue (); + Set set = (Set) pProp.getValue (); iter = set.iterator (); } else if (arity == PropertyArity.MAP) { - Map map = (Map) pProp.getValue (); + Map map = (Map) pProp.getValue (); iter = map.values().iterator (); } else { - List list = (List) pProp.getValue (); + List list = (List) pProp.getValue (); iter = list.iterator (); } for (int i = 0;; i++) { @@ -289,26 +286,26 @@ private void snarfRepInfo () ("Status: " + wfStr, false)); // Report modules that said their signatures match - List sigList = _info.getSigMatch(); + List sigList = _info.getSigMatch(); if (sigList != null && sigList.size () > 0) { DefaultMutableTreeNode sigNode = new DefaultMutableTreeNode ("SignatureMatches"); infoNode.add (sigNode); for (int i = 0; i < sigList.size (); i++) { DefaultMutableTreeNode sNode = - new DefaultMutableTreeNode ((String) sigList.get (i)); + new DefaultMutableTreeNode (sigList.get (i)); sigNode.add(sNode); } } // Compile a list of messages and offsets into a subtree - List messageList = _info.getMessage (); + List messageList = _info.getMessage (); if (messageList != null && messageList.size() > 0) { DefaultMutableTreeNode msgNode = new DefaultMutableTreeNode ("Messages"); infoNode.add (msgNode); int i; for (i = 0; i < messageList.size(); i++) { - Message msg = (Message) messageList.get (i); + Message msg = messageList.get (i); String prefix; if (msg instanceof InfoMessage) { prefix = "InfoMessage: "; @@ -352,7 +349,7 @@ else if (subMessage == null) { } // Compile a list of profile strings into a string list - List profileList = _info.getProfile (); + List profileList = _info.getProfile (); if (profileList != null && profileList.size() > 0) { DefaultMutableTreeNode profNode = new DefaultMutableTreeNode ("Profiles"); @@ -360,24 +357,24 @@ else if (subMessage == null) { int i; for (i = 0; i < profileList.size(); i++) { profNode.add (new DefaultMutableTreeNode - ((String) profileList.get (i), false)); + (profileList.get (i), false)); } } // Here we come to the property map. We have to walk // through all the properties recursively, turning // each into a leaf or subtree. - Map map = _info.getProperty (); + Map map = _info.getProperty (); if (map != null) { - Iterator iter = map.keySet ().iterator (); + Iterator iter = map.keySet ().iterator (); while (iter.hasNext ()) { - String key = (String) iter.next (); + String key = iter.next (); Property property = _info.getProperty (key); infoNode.add (propToNode (property)); } } - List cksumList = _info.getChecksum(); + List cksumList = _info.getChecksum(); if (cksumList != null && cksumList.size () > 0) { DefaultMutableTreeNode ckNode = new DefaultMutableTreeNode ("Checksums"); @@ -385,7 +382,7 @@ else if (subMessage == null) { int n = cksumList.size (); //List cPropList = new LinkedList (); for (int i = 0; i < n; i++) { - Checksum cksum = (Checksum) cksumList.get (i); + Checksum cksum = cksumList.get (i); String val = cksum.getValue (); DefaultMutableTreeNode csNode = new DefaultMutableTreeNode ("Checksum"); @@ -504,11 +501,9 @@ else if (typ == PropertyType.OBJECT) { The property must be of arity LIST. */ private void addListMembers (DefaultMutableTreeNode node, Property p) { - List l = (List) p.getValue (); + List l = (List) p.getValue (); PropertyType ptyp = p.getType (); - Iterator iter = l.listIterator (); - while (iter.hasNext ()) { - Object item = iter.next (); + for (Object item : l) { if (ptyp == PropertyType.PROPERTY) { node.add (propToNode ((Property) item)); } @@ -527,9 +522,9 @@ else if (ptyp == PropertyType.NISOIMAGEMETADATA) { The property must be of arity SET. */ private void addSetMembers (DefaultMutableTreeNode node, Property p) { - Set s = (Set) p.getValue (); + Set s = (Set) p.getValue (); PropertyType ptyp = p.getType (); - Iterator iter = s.iterator (); + Iterator iter = s.iterator (); while (iter.hasNext ()) { Object item = iter.next (); if (ptyp == PropertyType.PROPERTY) { @@ -550,10 +545,10 @@ else if (ptyp == PropertyType.NISOIMAGEMETADATA) { The property must be of arity MAP. */ private void addMapMembers (DefaultMutableTreeNode node, Property p) { - Map m = (Map) p.getValue (); + Map m = (Map) p.getValue (); PropertyType ptyp = p.getType (); //Iterator iter = m.values ().iterator (); - Iterator iter = m.keySet ().iterator (); + Iterator iter = m.keySet ().iterator (); while (iter.hasNext ()) { DefaultMutableTreeNode itemNode; String key = (String) iter.next (); @@ -649,7 +644,7 @@ private DefaultMutableTreeNode aesToNode (AESAudioMetadata aes) // Add the face information, which is mostly filler. // In the general case, it can contain multiple Faces; // this isn't supported yet. - List facelist = aes.getFaceList (); + List facelist = aes.getFaceList (); if (!facelist.isEmpty ()) { AESAudioMetadata.Face f = (AESAudioMetadata.Face) facelist.get(0); @@ -693,7 +688,7 @@ private DefaultMutableTreeNode aesToNode (AESAudioMetadata aes) // FormatRegions. This doesn't happen with any of the current // modules; if it's needed in the future, simply set up an // iteration loop on formatList. - List flist = aes.getFormatList (); + List flist = aes.getFormatList (); if (!flist.isEmpty ()) { AESAudioMetadata.FormatRegion rgn = (AESAudioMetadata.FormatRegion) flist.get(0); diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewHandler.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewHandler.java index d4b7ab081..cda87234b 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewHandler.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewHandler.java @@ -70,6 +70,7 @@ public ViewHandler (JhoveWindow jhwin, App app, JhoveBase base) } /** Do the initial output. This needs to set up the window. */ + @Override public void showHeader () { _viewWin = new ViewWindow (_app, _base, _jhwin); @@ -84,26 +85,31 @@ public void showHeader () * I need to break out part of the ViewWindow code to here so * it can produce the output for one file. */ + @Override public void show (RepInfo info) { - _viewWin.addRepInfo (info, _app, _base); + _viewWin.addRepInfo (info, _base); ++nDocs; } + @Override public void show () { } + @Override public void show (App app) { } + @Override public void show (Module module) { } /** Complete the output. Does this have to do anything? */ + @Override public void showFooter () { // If no files were processed, just discard the window. */ @@ -139,6 +145,7 @@ public void showFooter () * Since this never should occur in a normal list of * handlers, it's unnecessary to do anything (I think). */ + @Override public void show (OutputHandler handler) { } diff --git a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewWindow.java b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewWindow.java index fc80ce8eb..ef08b8fdd 100644 --- a/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewWindow.java +++ b/jhove-apps/src/main/java/edu/harvard/hul/ois/jhove/viewer/ViewWindow.java @@ -53,12 +53,13 @@ public ViewWindow (App app, JhoveBase base, JhoveWindow jhwin) super ("RepInfo", app, base); setSaveActionListener ( new ActionListener() { + @Override public void actionPerformed (ActionEvent e) { saveInfo (); } }); - _info = new LinkedList (); + _info = new LinkedList<> (); // The root element should no longer be a // RepTreeRoot, but some other flavor of // DefaultMutableTreeNode. It will have RepTreeRoots @@ -96,6 +97,7 @@ public void actionPerformed (ActionEvent e) { if (jhwin != null) { _closeAllItem = jhwin.getCloseAllItem (); _closeAllListener = new ActionListener() { + @Override public void actionPerformed (ActionEvent e) { closeFromMenu (); } @@ -109,10 +111,10 @@ public void actionPerformed (ActionEvent e) { * tree. The RepInfo object is saved into a list so that * the window contents can be saved to a file later. */ - public void addRepInfo (RepInfo info, App app, JhoveBase base) + public void addRepInfo (RepInfo info, JhoveBase base) { _info.add (info); - RepTreeRoot node = new RepTreeRoot (info, app, base); + RepTreeRoot node = new RepTreeRoot (info, base); _rootNode.add (node); } @@ -143,7 +145,7 @@ private void saveInfo () handler.showHeader (); Iterator iter = _info.iterator (); while (iter.hasNext ()) { - RepInfo info = (RepInfo) iter.next (); + RepInfo info = iter.next (); handler.show (info); } handler.showFooter (); @@ -161,6 +163,7 @@ private void saveInfo () /** Invoked when the "Close" menu item is selected. * Overrides the parent class's method to delete * the window rather than hiding it. */ + @Override protected void closeFromMenu () { super.closeFromMenu (); diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/AESAudioMetadata.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/AESAudioMetadata.java index 6f7bfbad2..e7073ed7b 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/AESAudioMetadata.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/AESAudioMetadata.java @@ -57,10 +57,10 @@ public class AESAudioMetadata private String _audioDataEncoding; private int _byteOrder; private String _disposition; - private List _faceList; + private List _faceList; private long _firstSampleOffset; private String _format; - private List _formatList; + private List _formatList; private int _numChannels; private String _primaryIdentifier; private String _primaryIdentifierType; @@ -95,8 +95,8 @@ public AESAudioMetadata () // We add one format region to get started. In practice, // that one is all we're likely to need. but more can be // added if necessary. - _formatList = new LinkedList (); - _faceList = new LinkedList (); + _formatList = new LinkedList<> (); + _faceList = new LinkedList<> (); addFormatRegion (); addFace (); _numChannels = NULL; @@ -264,6 +264,7 @@ public FormatRegionImpl () { } /** Returns bit depth. */ + @Override public int getBitDepth () { return _bitDepth; @@ -282,18 +283,21 @@ public int getBitDepth () *
  • 6: dataRateMode * */ + @Override public String[] getBitrateReduction () { return _bitrateReduction; } /** Returns sample rate. */ + @Override public double getSampleRate () { return _sampleRate; } /** Returns word size. */ + @Override public int getWordSize () { return _wordSize; @@ -301,6 +305,7 @@ public int getWordSize () /** Returns true if the FormatRegion contains only * default values. */ + @Override public boolean isEmpty () { return _bitDepth == NULL && @@ -309,18 +314,21 @@ public boolean isEmpty () } /** Sets bit depth. */ + @Override public void setBitDepth (int bitDepth) { _bitDepth = bitDepth; } /** Sets the bitrate reduction information to null (no compression). */ + @Override public void clearBitrateReduction () { _bitrateReduction = null; } /** Sets the bitrate reduction (compression type). */ + @Override public void setBitrateReduction (String codecName, String codecNameVersion, String codecCreatorApplication, @@ -340,6 +348,7 @@ public void setBitrateReduction (String codecName, } /** Sets sample rate. */ + @Override public void setSampleRate (double sampleRate) { _sampleRate = sampleRate; @@ -347,6 +356,7 @@ public void setSampleRate (double sampleRate) /** Sets word size. */ + @Override public void setWordSize (int wordSize) { _wordSize = wordSize; @@ -424,34 +434,40 @@ public TimeDescImpl (long samples) } /** Returns the hours component. */ + @Override public long getHours () { return _hours; } /** Returns the minutes component. */ + @Override public long getMinutes () { return _minutes; } /** Returns the seconds component. */ + @Override public long getSeconds () { return _seconds; } /** Returns the frames component of the fraction of a second. * We always consider frames to be thirtieths of a second. */ + @Override public long getFrames () { return _frames; } /** Returns the samples remaining after the frames part of * the fractional second. */ + @Override public long getSamples () { return _samples; } /** Returns the sample rate on which the samples remainder * is based. */ + @Override public double getSampleRate () { return _sampleRate; } @@ -462,7 +478,7 @@ public double getSampleRate () { * in _Java in a Nutshell_. */ class FaceImpl implements Face { - List _regionList; + List _regionList; TimeDesc _startTime; TimeDesc _duration; String _direction; @@ -472,36 +488,41 @@ class FaceImpl implements Face { * to null, indicating unknown value. */ public FaceImpl () { - _regionList = new ArrayList (); + _regionList = new ArrayList<>(); _startTime = new TimeDescImpl (0); _duration = null; } /** Returns an indexed FaceRegion. */ + @Override public FaceRegion getFaceRegion (int i) { - return (FaceRegion) _regionList.get (i); + return _regionList.get (i); } /** Adds a FaceRegion. This may be called repeatedly to * add multiple FaceRegions. */ + @Override public void addFaceRegion () { _regionList.add (new FaceRegionImpl ()); } /** Returns the starting time. Will be zero if not * explicitly specified. */ + @Override public TimeDesc getStartTime () { return _startTime; } /** Returns the duration. May be null if the duration * is unspecified. */ + @Override public TimeDesc getDuration () { return _duration; } /** Returns the direction. */ + @Override public String getDirection () { return _direction; @@ -509,6 +530,7 @@ public String getDirection () /** Sets the starting time. This will be converted * into a TimeDesc. */ + @Override public void setStartTime (long samples) { _startTime = new TimeDescImpl (samples); @@ -516,6 +538,7 @@ public void setStartTime (long samples) /** Sets the duration. This will be converted * into a TimeDesc. */ + @Override public void setDuration (long samples) { _duration = new TimeDescImpl (samples); @@ -525,6 +548,7 @@ public void setDuration (long samples) * directionTypes. FORWARD is recommended for most * or all cases. */ + @Override public void setDirection (String direction) { _direction = direction; @@ -550,17 +574,20 @@ public FaceRegionImpl () } /** Returns the starting time. */ + @Override public TimeDesc getStartTime () { return _startTime; } /** Returns the duration. */ + @Override public TimeDesc getDuration () { return _duration; } /** Returns the channel map locations. The array length * will equal the number of channels. */ + @Override public String[] getMapLocations () { return _mapLocations; @@ -568,12 +595,14 @@ public String[] getMapLocations () /** Sets the duration. This will be converted * into a TimeDesc. */ + @Override public void setStartTime (long samples) { _startTime = new TimeDescImpl (samples); } /** Sets the duration. This will be converted * into a TimeDesc. */ + @Override public void setDuration (long samples) { _duration = new TimeDescImpl (samples); @@ -581,6 +610,7 @@ public void setDuration (long samples) /** Sets the channel map locations. The array length must * equal the number of channels. */ + @Override public void setMapLocations (String[] locations) { _mapLocations = locations; diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/App.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/App.java index f06618850..4a1b504d5 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/App.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/App.java @@ -5,16 +5,9 @@ package edu.harvard.hul.ois.jhove; -// import java.io.*; -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; -import java.util.Properties; - import org.openpreservation.jhove.ReleaseDetails; /** diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ByteArrayXMPSource.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ByteArrayXMPSource.java index 92b96981d..d7e182f95 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ByteArrayXMPSource.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ByteArrayXMPSource.java @@ -27,7 +27,6 @@ public class ByteArrayXMPSource extends XMPSource { * @param instrm ByteArrayInputStream containing the XMP */ public ByteArrayXMPSource (ByteArrayInputStream instrm) - throws IOException { super (new InputStreamReader (new XMLWrapperStream (instrm))); @@ -58,6 +57,7 @@ public ByteArrayXMPSource (ByteArrayInputStream instrm, /* (non-Javadoc) * @see edu.harvard.hul.ois.jhove.XMPSource#resetReader() */ + @Override protected void resetReader() { _instrm.reset (); _reader = new InputStreamReader (_instrm); diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ChecksumInputStream.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ChecksumInputStream.java index 992559698..3fdb7fe14 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ChecksumInputStream.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ChecksumInputStream.java @@ -43,6 +43,7 @@ public ChecksumInputStream(InputStream stream, Checksummer cksummer) { * Reads a byte from the subsumed stream, updating * the byte count and the checksums. */ + @Override public int read() throws IOException { int ch = subsumedStream.read (); if (ch >= 0) { @@ -61,6 +62,7 @@ public int read() throws IOException { * * All bytes read are fed through the checksummer. */ + @Override public int read(byte[] b) throws IOException { int len = subsumedStream.read (b); @@ -83,6 +85,7 @@ public int read(byte[] b) throws IOException * * All bytes read are fed through the checksummer. */ + @Override public int read(byte[] b, int off, int len) throws IOException { len = subsumedStream.read (b, off, len); @@ -100,6 +103,7 @@ public int read(byte[] b, int off, int len) throws IOException * Skips n bytes. * Reads them and feeds them through the checksummer. */ + @Override public long skip (long n) throws IOException { long nret = 0; while (n > 0) { @@ -119,6 +123,7 @@ public long skip (long n) throws IOException { /** * Closes the subsumed stream. */ + @Override public void close () throws IOException { subsumedStream.close(); diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Checksummer.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Checksummer.java index 58dacb462..6aabca240 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Checksummer.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Checksummer.java @@ -43,6 +43,7 @@ public Checksummer () /** Resets all checksums and the byte count to their * initial values. */ + @Override public void reset () { _nByte = 0; @@ -60,6 +61,7 @@ public void reset () * return the CRC32 value, since that's the one which * is guaranteed to be available. */ + @Override public long getValue () { return _crc32.getValue (); @@ -84,6 +86,7 @@ public void update (byte b) * Updates the checksum with the argument. * Called when an unsigned byte is available. */ + @Override public void update (int b) { byte sb; @@ -115,6 +118,7 @@ public void update (byte[] b) * Updates the checksum with the argument. * Called when a byte array is available. */ + @Override public void update (byte[] b, int off, int len) { _crc32.update (b, off, len); @@ -181,7 +185,7 @@ public String getSHA1 () /** Pad a hexadecimal (or other numeric) string out to * the specified length with leading zeroes. */ - private String padLeadingZeroes (String str, int len) + private static String padLeadingZeroes (String str, int len) { // This is optimized for adding just one leading zero // or none, which will be the usual case. diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ConfigHandler.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ConfigHandler.java index c9d9a7020..cc8ecc2f4 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ConfigHandler.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ConfigHandler.java @@ -85,10 +85,10 @@ public class ConfigHandler */ public ConfigHandler () { - _module = new ArrayList (); - _handler = new ArrayList (); - _modParams = new ArrayList> (); - _handlerParams = new ArrayList> (); + _module = new ArrayList<> (); + _handler = new ArrayList<> (); + _modParams = new ArrayList<> (); + _handlerParams = new ArrayList<> (); _isModule = false; _isHandler = false; @@ -100,7 +100,7 @@ public ConfigHandler () _bufferSize = -1; _encoding = null; - _extension = new Hashtable (); + _extension = new Hashtable<> (); _tempDir = null; _mixVsn = null; _sigBytes = 1024; @@ -238,43 +238,43 @@ public String getLogLevel () /** * SAX parser callback method. */ + @Override public void startElement (String namespaceURI, String localName, String rawName, Attributes atts) - throws SAXException { _content = new StringBuffer (); - if (rawName.equals ("module")) { + if ("module".equals (rawName)) { _isModule = true; _init = null; - _param = new ArrayList (1); + _param = new ArrayList<> (1); _class = null; } - else if (rawName.equals ("outputHandler")) { + else if ("outputHandler".equals (rawName)) { _isHandler = true; _init = null; - _param = new ArrayList (1); + _param = new ArrayList<> (1); _class = null; } - else if (rawName.equals ("tempDirectory")) { + else if ("tempDirectory".equals (rawName)) { _isTempDir = true; } - else if (rawName.equals ("mixVersion")) { + else if ("mixVersion".equals (rawName)) { _isMixVsn = true; } - else if (rawName.equals ("defaultEncoding")) { + else if ("defaultEncoding".equals (rawName)) { _isEncoding = true; } - else if (rawName.equals ("bufferSize")) { + else if ("bufferSize".equals (rawName)) { _isBufferSize = true; } - else if (rawName.equals ("jhoveHome")) { + else if ("jhoveHome".equals (rawName)) { _isJhoveHome = true; } - else if (rawName.equals ("logLevel")) { + else if ("logLevel".equals (rawName)) { _isLogLevel = true; } - else if (rawName.equals ("sigBytes")) { + else if ("sigBytes".equals (rawName)) { _isSigBytes = true; } } @@ -282,8 +282,8 @@ else if (rawName.equals ("sigBytes")) { /** * SAX parser callback method. */ + @Override public void characters (char [] ch, int start, int length) - throws SAXException { _content.append (ch, start, length); } @@ -291,21 +291,21 @@ public void characters (char [] ch, int start, int length) /** * SAX parser callback method. */ + @Override public void endElement (String namespaceURI, String localName, String rawName) - throws SAXException { if (_isModule) { - if (rawName.equals ("class")) { + if ("class".equals (rawName)) { _class = _content.toString (); } - else if (rawName.equals ("init")) { + else if ("init".equals (rawName)) { _init = _content.toString (); } - else if (rawName.equals ("param")) { + else if ("param".equals (rawName)) { _param.add (_content.toString ()); } - else if (rawName.equals ("module")) { + else if ("module".equals (rawName)) { ModuleInfo modInfo = new ModuleInfo( _class, _init); _module.add (modInfo); _modParams.add (_param); @@ -313,16 +313,16 @@ else if (rawName.equals ("module")) { } } else if (_isHandler) { - if (rawName.equals ("class")) { + if ("class".equals (rawName)) { _class = _content.toString (); } - else if (rawName.equals ("init")) { + else if ("init".equals (rawName)) { _init = _content.toString (); } - else if (rawName.equals ("param")) { + else if ("param".equals (rawName)) { _param.add (_content.toString ()); } - else if (rawName.equals ("outputHandler")) { + else if ("outputHandler".equals (rawName)) { String [] tuple = { _class, _init }; _handler.add (tuple); _handlerParams.add (_param); @@ -365,7 +365,7 @@ else if (_isBufferSize) { } _isBufferSize = false; } - else if (!rawName.equals ("jhoveConfig")) { + else if (!"jhoveConfig".equals (rawName)) { _extension.put (rawName, _content.toString ().trim ()); } } @@ -379,6 +379,7 @@ else if (!rawName.equals ("jhoveConfig")) { * it will cut down on the burden on the server with the official * schema copy. */ + @Override public InputSource resolveEntity (String publicId, String systemId) throws SAXException, IOException { if (systemId.endsWith (configSchemaName)) { diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/CountedInputStream.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/CountedInputStream.java index 79c8d5b7d..dc7682c77 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/CountedInputStream.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/CountedInputStream.java @@ -31,6 +31,7 @@ public CountedInputStream(InputStream instrm, int count) { /** Reads a single byte from the stream and decrements * the count of remaining bytes. If the count * is exhausted, returns -1 to signify end of file. */ + @Override public int read() throws IOException { if (bytesLeft <= 0) { return -1; @@ -52,6 +53,7 @@ public int read() throws IOException { * of bytes remaining in the count. The count is * decremented by the number of bytes actually read. */ + @Override public int read(byte[] b) throws IOException { int len = b.length; @@ -80,6 +82,7 @@ public int read(byte[] b) throws IOException * of bytes remaining in the count. The count is * decremented by the number of bytes actually read. */ + @Override public int read(byte[] b, int off, int len) throws IOException { int bytesRead; @@ -99,6 +102,7 @@ public int read(byte[] b, int off, int len) throws IOException * Decrements the count by the number of bytes * actually skipped. */ + @Override public long skip (long n) throws IOException { long bytesRead = super.skip (n); if (bytesLeft < bytesRead) { diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Document.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Document.java index 2a8b9921b..bf3e6b46f 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Document.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Document.java @@ -14,14 +14,14 @@ */ public class Document { - private List _author; + private List _author; private String _date; private String _edition; private String _enum; - private List _identifier; + private List _identifier; private String _note; private String _pages; - private List _publisher; + private List _publisher; private String _title; private DocumentType _type; @@ -34,9 +34,9 @@ public Document (String title, DocumentType type) _title = title; _type = type; - _author = new ArrayList (); - _identifier = new ArrayList (); - _publisher = new ArrayList (); + _author = new ArrayList<> (); + _identifier = new ArrayList<> (); + _publisher = new ArrayList<> (); } /** @@ -46,7 +46,7 @@ public Document (String title, DocumentType type) * * @see Agent */ - public List getAuthor () + public List getAuthor () { return _author; } @@ -80,7 +80,7 @@ public String getEnumeration () * Returns the list of formal Identifiers for this Document. * If no Identifiers are given, returns an empty list. */ - public List getIdentifier () + public List getIdentifier () { return _identifier; } @@ -105,7 +105,7 @@ public String getPages () * Returns a List of Agents, each representing a publisher of this * Document. If no publishers are listed, returns an empty list. */ - public List getPublisher () + public List getPublisher () { return _publisher; } diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/EnumerationType.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/EnumerationType.java index 0574c57e4..e031c79d0 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/EnumerationType.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/EnumerationType.java @@ -63,6 +63,7 @@ public boolean equals (EnumerationType enm) * Return enumeration value. * @return Value */ + @Override public String toString () { return _value; diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/HandlerBase.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/HandlerBase.java index 39ca94bfa..01f78cc6f 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/HandlerBase.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/HandlerBase.java @@ -119,7 +119,7 @@ protected HandlerBase (String name, String release, int [] date, _note = note; _rights = rights; - _specification = new ArrayList (); + _specification = new ArrayList<> (); _level = -1; } @@ -133,6 +133,7 @@ protected HandlerBase (String name, String release, int [] date, /** * Reset the handler. This needs to be called before each invocation. */ + @Override public void reset () { _level = -1; } @@ -143,6 +144,7 @@ public void reset () { * @param params A List whose elements are Strings. * May be empty. */ + @Override public void setDefaultParams (List params) { _defaultParams = params; @@ -152,8 +154,8 @@ public void setDefaultParams (List params) * Applies the default parameters. * Calling this clears any prior parameters. */ + @Override public void applyDefaultParams () - throws Exception { resetParams (); Iterator iter = _defaultParams.iterator (); @@ -167,8 +169,8 @@ public void applyDefaultParams () * Returns to a default state without any parameters. * The default method clears the saved parameter. */ + @Override public void resetParams () - throws Exception { _param = null; } @@ -178,8 +180,8 @@ public void resetParams () * Per-instantiation initialization. * The default method does nothing. */ + @Override public void init (String init) - throws Exception { _init = init; } @@ -188,8 +190,8 @@ public void init (String init) * Per-action initialization. * The default method does nothing. */ + @Override public void param (String param) - throws Exception { _param = param; } @@ -202,6 +204,7 @@ public void param (String param) * Return the last modification date of this OutputHandler, as a * Java Date object */ + @Override public final Date getDate () { return _date; @@ -210,6 +213,7 @@ public final Date getDate () /** * Return the OutputHandler name */ + @Override public final String getName () { return _name; @@ -218,6 +222,7 @@ public final String getName () /** * Return the OutputHandler note */ + @Override public final String getNote () { return _note; @@ -226,6 +231,7 @@ public final String getNote () /** * Return the release identifier */ + @Override public final String getRelease () { return _release; @@ -234,6 +240,7 @@ public final String getRelease () /** * Return the copyright information string */ + @Override public final String getRights () { return _rights; @@ -247,6 +254,7 @@ public final String getRights () * * @see Document */ + @Override public final List getSpecification () { return _specification; @@ -255,6 +263,7 @@ public final List getSpecification () /** * Return the vendor information */ + @Override public final Agent getVendor () { return _vendor; @@ -263,6 +272,7 @@ public final Agent getVendor () /** * Returns this handler's encoding. */ + @Override public String getEncoding () { return _encoding; @@ -276,6 +286,7 @@ public String getEncoding () * Pass the associated App object to this Module. * The App makes various services available. */ + @Override public final void setApp (App app) { _app = app; @@ -284,6 +295,7 @@ public final void setApp (App app) /** * Assigns the JHOVE engine object to provide services to this handler */ + @Override public final void setBase (JhoveBase je) { _je = je; @@ -292,6 +304,7 @@ public final void setBase (JhoveBase je) /** * Assigns the encoding to be used by this OutputHandler */ + @Override public void setEncoding (String encoding) { _encoding = encoding; @@ -300,6 +313,7 @@ public void setEncoding (String encoding) /** * Assigns a PrintWriter to do output for this OutputHandler */ + @Override public final void setWriter (PrintWriter writer) { _writer = writer; @@ -314,6 +328,7 @@ public final void setWriter (PrintWriter writer) * representation information. * @param info Object representation information */ + @Override public void analyze (RepInfo info) { /* Do nothing, which is sufficient for most handlers. */ @@ -322,6 +337,7 @@ public void analyze (RepInfo info) /** * Callback indicating a directory is finished being processed. */ + @Override public void endDirectory () { /* Do nothing, which is sufficient for most handlers. */ @@ -332,6 +348,7 @@ public void endDirectory () * not to process a file. Most handlers will always return true. * @param filepath File pathname */ + @Override public boolean okToProcess (String filepath) { return true; @@ -340,22 +357,26 @@ public boolean okToProcess (String filepath) /** * Outputs information about a Module */ + @Override public abstract void show (Module module); /** * Outputs the information contained in a RepInfo object */ + @Override public abstract void show (RepInfo info); /** * Outputs information about the OutputHandler specified * in the parameter */ + @Override public abstract void show (OutputHandler handler); /** * Outputs minimal information about the application */ + @Override public abstract void show (); /** @@ -363,23 +384,27 @@ public boolean okToProcess (String filepath) * including configuration, available modules and handlers, * etc. */ + @Override public abstract void show (App app); /** * Do the initial output. This should be in a suitable format * for including multiple files between the header and the footer. */ + @Override public abstract void showHeader (); /** * Do the final output. This should be in a suitable format * for including multiple files between the header and the footer. */ + @Override public abstract void showFooter (); /** * Close the writer after all output has been done. */ + @Override public void close () { _writer.close (); @@ -389,6 +414,7 @@ public void close () * Callback indicating a new directory is being processed. * @param directory Directory path */ + @Override public void startDirectory (String directory) { /* Do nothing, which is sufficient for most handlers. */ @@ -803,6 +829,7 @@ public static class SynchronizedDateFormat extends SimpleDateFormat public SynchronizedDateFormat(String pattern) { super(pattern); } + @Override public synchronized StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) { return super.format(date, toAppendTo, pos); diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/JhoveBase.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/JhoveBase.java index 8b2bb433d..bbce89277 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/JhoveBase.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/JhoveBase.java @@ -80,10 +80,6 @@ public class JhoveBase { private static final String TEMPDIR_PROPERTY = JHOVE_PROPERTY_PREFIX + "tempDirectory"; - /** MIX schema version property. */ - private static final String MIXVSN_PROPERTY = JHOVE_PROPERTY_PREFIX - + "mixvsn"; - /** Flag for aborting activity. */ protected boolean _abort; /** Buffer size for buffered I/O. */ @@ -157,11 +153,11 @@ public JhoveBase() throws JhoveException { new NaiveHostnameVerifier()); // Initialize the engine. - _moduleList = new ArrayList(20); - _moduleMap = new TreeMap(); + _moduleList = new ArrayList<>(20); + _moduleMap = new TreeMap<>(); - _handlerList = new ArrayList(); - _handlerMap = new TreeMap(); + _handlerList = new ArrayList<>(); + _handlerMap = new TreeMap<>(); _abort = false; _bufferSize = -1; diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/MacStuff.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/MacStuff.java index 106429bf4..3738e0f87 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/MacStuff.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/MacStuff.java @@ -77,8 +77,8 @@ public static boolean fileHasType(File file, String type) if (type == null) { return false; } - Class fmclass = Class.forName ("com.apple.eio.FileManager"); - Class[] params = new Class[1]; + Class fmclass = Class.forName ("com.apple.eio.FileManager"); + Class[] params = new Class[1]; params[0] = Class.forName ("java.io.File"); Object[] args = new Object[1]; args[0] = file; diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ModuleBase.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ModuleBase.java index 139ded422..dafa30c20 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ModuleBase.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ModuleBase.java @@ -142,8 +142,8 @@ protected ModuleBase (String name, String release, int [] date, _format = format; _coverage = coverage; _mimeType = mimeType; - _signature = new ArrayList (); - _specification = new ArrayList (); + _signature = new ArrayList<> (); + _specification = new ArrayList<> (); _wellFormedNote = wellFormedNote; _repInfoNote = repInfoNote; _validityNote = validityNote; @@ -170,7 +170,7 @@ protected ModuleBase (String name, String release, int [] date, */ public void initFeatures () { - _features = new ArrayList (2); + _features = new ArrayList<> (2); _features.add ("edu.harvard.hul.ois.jhove.canValidate"); _features.add ("edu.harvard.hul.ois.jhove.canCharacterize"); } @@ -180,8 +180,8 @@ public void initFeatures () * Per-instantiation initialization. * The default method does nothing but save its parameter. */ + @Override public void init (String init) - throws Exception { _init = init; } @@ -192,6 +192,7 @@ public void init (String init) * @param params A List whose elements are Strings. * May be empty. */ + @Override public void setDefaultParams (List params) { _defaultParams = params; @@ -201,8 +202,8 @@ public void setDefaultParams (List params) * Applies the default parameters. * Calling this clears any prior parameters. */ - public void applyDefaultParams () - throws Exception + @Override + public void applyDefaultParams () throws IOException { resetParams (); Iterator iter = _defaultParams.iterator (); @@ -216,8 +217,8 @@ public void applyDefaultParams () * Returns to a default state without any parameters. * The default method clears the saved parameter. */ - public void resetParams () - throws Exception + @Override + public void resetParams () throws IOException { _param = null; } @@ -226,8 +227,8 @@ public void resetParams () * Per-action initialization. May be called multiple times. * The default method does nothing but save its parameter. */ + @Override public void param (String param) - throws Exception { _param = param; } @@ -282,6 +283,7 @@ public boolean isBigEndian () * Return details as to the specific format versions or * variants that are supported by this module */ + @Override public final String getCoverage () { return _coverage; @@ -291,6 +293,7 @@ public final String getCoverage () * Return the last modification date of this Module, as a * Java Date object */ + @Override public final Date getDate () { return _date; @@ -299,6 +302,7 @@ public final Date getDate () /** * Return the array of format names supported by this Module */ + @Override public final String [] getFormat () { return _format; @@ -308,6 +312,7 @@ public final Date getDate () * Return the array of MIME type strings for formats supported * by this Module */ + @Override public final String [] getMimeType () { return _mimeType; @@ -316,6 +321,7 @@ public final Date getDate () /** * Return the module name */ + @Override public final String getName () { return _name; @@ -324,6 +330,7 @@ public final String getName () /** * Return the module note */ + @Override public final String getNote () { return _note; @@ -332,6 +339,7 @@ public final String getNote () /** * Return the release identifier */ + @Override public final String getRelease () { return _release; @@ -340,6 +348,7 @@ public final String getRelease () /** * Return the RepInfo note */ + @Override public final String getRepInfoNote () { return _repInfoNote; @@ -348,6 +357,7 @@ public final String getRepInfoNote () /** * Return the copyright information string */ + @Override public final String getRights () { return _rights; @@ -356,6 +366,7 @@ public final String getRights () /** * Return the List of Signatures recognized by this Module */ + @Override public final List getSignature () { return _signature; @@ -369,6 +380,7 @@ public final List getSignature () * * @see Document */ + @Override public final List getSpecification () { return _specification; @@ -377,6 +389,7 @@ public final List getSpecification () /** * Return the vendor information */ + @Override public final Agent getVendor () { return _vendor; @@ -385,6 +398,7 @@ public final Agent getVendor () /** * Return the string describing well-formedness criteria */ + @Override public final String getWellFormedNote () { return _wellFormedNote; @@ -393,6 +407,7 @@ public final String getWellFormedNote () /** * Return the string describing validity criteria */ + @Override public final String getValidityNote () { return _validityNote; @@ -402,6 +417,7 @@ public final String getValidityNote () * Return the random access flag (true if the module operates * on random access files, false if it operates on streams) */ + @Override public final boolean isRandomAccess () { return _isRandomAccess; @@ -421,6 +437,7 @@ public final boolean isRandomAccess () *
  • edu.harvard.hul.ois.canIdentify * */ + @Override public boolean hasFeature (String feature) { if (_features == null) { @@ -440,6 +457,7 @@ public boolean hasFeature (String feature) /** * Returns the full list of features. */ + @Override public List getFeatures () { return _features; @@ -448,6 +466,7 @@ public List getFeatures () /** * Returns the list of default parameters. */ + @Override public List getDefaultParams () { return _defaultParams; @@ -462,6 +481,7 @@ public List getDefaultParams () * Pass the associated App object to this Module. * The App makes various services available. */ + @Override public final void setApp (App app) { _app = app; @@ -470,6 +490,7 @@ public final void setApp (App app) /** * Pass the JHOVE engine object to this Module. */ + @Override public final void setBase (JhoveBase je) { _je = je; @@ -512,6 +533,7 @@ public final void setCRC32 (CRC32 crc32) * modules should treat MAXIMUM_VERBOSITY as a request for * all the data available from the module. */ + @Override public void setVerbosity (int verbosity) { _verbosity = verbosity; @@ -576,8 +598,8 @@ public final void setSHA1 (MessageDigest sha1) * called again with parseIndex * equal to that return value. */ - public int parse (InputStream stream, RepInfo info, int parseIndex) - throws IOException + @Override + public int parse (InputStream stream, RepInfo info, int parseIndex) throws IOException { return 0; } @@ -593,8 +615,8 @@ public int parse (InputStream stream, RepInfo info, int parseIndex) * @param info A fresh RepInfo object which will be modified * to reflect the results of the parsing */ - public void parse (RandomAccessFile file, RepInfo info) - throws IOException + @Override + public void parse (RandomAccessFile file, RepInfo info) throws IOException { } @@ -614,6 +636,7 @@ public void parse (RandomAccessFile file, RepInfo info) * @param info A fresh RepInfo object which will be modified * to reflect the results of the test */ + @Override public void checkSignatures (File file, InputStream stream, RepInfo info) @@ -632,7 +655,7 @@ public void checkSignatures (File file, stream.close(); ListIterator iter = _signature.listIterator(); while (iter.hasNext ()) { - Signature sig = ((Signature) iter.next ()); + Signature sig = (iter.next ()); if (sig instanceof InternalSignature) { InternalSignature isig = (InternalSignature) sig; int[] sigValue = isig.getValue (); @@ -686,10 +709,10 @@ else if (info.getWellFormed() == RepInfo.TRUE) { * @param info A fresh RepInfo object which will be modified * to reflect the results of the test */ + @Override public void checkSignatures (File file, RandomAccessFile raf, - RepInfo info) - throws IOException + RepInfo info) throws IOException { info.setFormat (_format[0]); info.setMimeType (_mimeType[0]); @@ -700,7 +723,7 @@ public void checkSignatures (File file, ListIterator iter = _signature.listIterator(); try { while (iter.hasNext ()) { - Signature sig = ((Signature) iter.next ()); + Signature sig = (iter.next ()); if (sig instanceof InternalSignature) { InternalSignature isig = (InternalSignature) sig; /* What about non-fixed offset? */ @@ -806,6 +829,7 @@ protected void setChecksums (Checksummer ckSummer, RepInfo info) * Generates information about this Module. * The format of the output depends on the OutputHandler. */ + @Override public void show (OutputHandler handler) { handler.show (this); @@ -1046,7 +1070,7 @@ public static long readUnsignedInt (DataInputStream stream, n = stream.readInt(); /* This is a signed value. */ if (n < 0) { //n = 2147483648L + n; - n = (long) n & 0XFFFFFFFFL; + n = n & 0XFFFFFFFFL; } } else { @@ -1080,7 +1104,7 @@ public static long readUnsignedInt (RandomAccessFile file, n = file.readInt(); /* This is a signed value. */ if (n < 0) { //n = 2147483648L + n; - n = (long) n & 0XFFFFFFFFL; + n = n & 0XFFFFFFFFL; } } else { @@ -1338,14 +1362,14 @@ public static double readDouble (DataInputStream stream, boolean endian, f = stream.readDouble (); } else { - long b7 = (long) stream.readUnsignedByte (); - long b6 = (long) stream.readUnsignedByte (); - long b5 = (long) stream.readUnsignedByte (); - long b4 = (long) stream.readUnsignedByte (); - long b3 = (long) stream.readUnsignedByte (); - long b2 = (long) stream.readUnsignedByte (); - long b1 = (long) stream.readUnsignedByte (); - long b0 = (long) stream.readUnsignedByte (); + long b7 = stream.readUnsignedByte (); + long b6 = stream.readUnsignedByte (); + long b5 = stream.readUnsignedByte (); + long b4 = stream.readUnsignedByte (); + long b3 = stream.readUnsignedByte (); + long b2 = stream.readUnsignedByte (); + long b1 = stream.readUnsignedByte (); + long b0 = stream.readUnsignedByte (); f = Double.longBitsToDouble (b0<<56 | b1<<48 | b2<<40 | b3<<32 | b4<<24 | b5<<16 | b6<< 8 | b7); diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ObjectIdentifier.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ObjectIdentifier.java index 83dd0cf75..009eb9878 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ObjectIdentifier.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/ObjectIdentifier.java @@ -20,12 +20,12 @@ public class ObjectIdentifier * PRIVATE INSTANCE FIELDS. ******************************************************************/ - private List _moduleList; + private List _moduleList; /****************************************************************** * CLASS CONSTRUCTOR. ******************************************************************/ - public ObjectIdentifier (List moduleList) + public ObjectIdentifier (List moduleList) { _moduleList = moduleList; } @@ -48,7 +48,6 @@ public ObjectIdentifier (List moduleList) public void identify (File file, RepInfo info, String parm, boolean verbose, boolean shortCheck) - throws IOException { /****************************************************** * Go through all modules, in the order in the config @@ -56,63 +55,64 @@ public void identify (File file, RepInfo info, * which matches. ******************************************************/ - ListIterator modIter = _moduleList.listIterator(); + ListIterator modIter = _moduleList.listIterator(); while (modIter.hasNext ()) { - /* We need clean RepInfo for each run */ - RepInfo info1; - info1 = (RepInfo) info.clone (); + /* We need clean RepInfo for each run */ + RepInfo info1; + info1 = (RepInfo) info.clone (); - Module mod = (Module) modIter.next (); - try { - if (!mod.hasFeature("edu.harvard.hul.ois.jhove.canValidate")) { - continue; - } - if (mod.isRandomAccess ()) { - RandomAccessFile raf = + Module mod = modIter.next (); + try { + if (!mod.hasFeature("edu.harvard.hul.ois.jhove.canValidate")) { + continue; + } + if (mod.isRandomAccess ()) { + RandomAccessFile raf = new RandomAccessFile (file, "r"); - mod.param (parm); - if (verbose) { - mod.setVerbosity (Module.MAXIMUM_VERBOSITY); - } - if (shortCheck) { - mod.checkSignatures (file, raf, info1); - } - else { - mod.parse (raf, info1); - } - raf.close (); + mod.param (parm); + if (verbose) { + mod.setVerbosity (Module.MAXIMUM_VERBOSITY); + } + if (shortCheck) { + mod.checkSignatures (file, raf, info1); + } + else { + mod.parse (raf, info1); + } + raf.close (); + } + else { + mod.param (parm); + if (shortCheck) { + try (InputStream stream = new FileInputStream (file)) { + mod.checkSignatures (file, stream, info1); + } } - else { - InputStream stream = new FileInputStream (file); - mod.param (parm); - if (shortCheck) { - mod.checkSignatures (file, stream, info1); - } - else { - int parseIndex = mod.parse (stream, info1, 0); - while (parseIndex != 0) { - stream.close (); - stream = new FileInputStream (file); + else { + int parseIndex = 0; + try (InputStream stream = new FileInputStream (file)) { + parseIndex = mod.parse (stream, info1, 0); + } + while (parseIndex != 0) { + try (InputStream stream = new FileInputStream (file)) { parseIndex = mod.parse (stream, info1, parseIndex); } - } - stream.close (); - } - } - catch (Exception e) { - /* The assumption is that in trying to analyze - the wrong type of file, the module may go - off its track and throw an exception, so we - just continue on to the next module. - */ + } + } + } + } + catch (Exception e) { + /* The assumption is that in trying to analyze + the wrong type of file, the module may go + off its track and throw an exception, so we + just continue on to the next module. + */ continue; - } + } if (info1.getWellFormed () == RepInfo.TRUE) { - info.copy (info1); - break; + info.copy (info1); + break; } - } } - - + } } diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Property.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Property.java index 73b2cacaf..61ea9ee40 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Property.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Property.java @@ -153,29 +153,29 @@ public Property getByName (String name) } } else if (_arity.equals (PropertyArity.LIST)) { - List list = (List) _value; + List list = (List) _value; int len = list.size (); for (int i=0; i coll = ((Map) _value).values (); + Iterator iter = coll.iterator (); while (iter.hasNext ()) { - Property prop = ((Property) iter.next ()).getByName (name); + Property prop = iter.next ().getByName (name); if (prop != null) { return prop; } } } else if (_arity.equals (PropertyArity.SET)) { - Iterator iter = ((Set) _value).iterator (); + Iterator iter = ((Set) _value).iterator (); while (iter.hasNext ()) { - Property prop = ((Property) iter.next ()).getByName (name); + Property prop = iter.next ().getByName (name); if (prop != null) { return prop; } diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/PropertyPath.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/PropertyPath.java deleted file mode 100644 index d96e4c7f8..000000000 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/PropertyPath.java +++ /dev/null @@ -1,276 +0,0 @@ -/********************************************************************** - * Jhove - JSTOR/Harvard Object Validation Environment - * Copyright 2004 by JSTOR and the President and Fellows of Harvard College - **********************************************************************/ - -package edu.harvard.hul.ois.jhove; - - -import java.util.*; - -/** - * A description of the location of a Property in a - * RepInfo object. Properties can be nested under other - * properties, in lists, maps, or subproperties. This class - * provides a general way to specify their location. - * - * For the moment, only paths by name are fully supported. - * - * @author Gary McGath - * - */ -public class PropertyPath { - - private List pathInfo; - - /** - * No-argument constructor. - * Creates an empty path. - */ - public PropertyPath () - { - pathInfo = new LinkedList (); - } - - /** - * Cloning constructor. - * This creates a new pathInfo list, whose elements - * are shared with the original PropertyPath's list. - */ - public PropertyPath (PropertyPath path) - { - pathInfo = new LinkedList (); - pathInfo.addAll (path.pathInfo); - } - - /** - * String array constructor. - * This allows creation of a path in a common and simple - * case: a hierarchy of named subproperties. It's the - * equivalent of creating an empty PropertyPath and then - * calling addElement successively with each of the strings - * in the array. - */ - public PropertyPath (String[] pathArray) - { - pathInfo = new LinkedList (); - for (int i = 0; i < pathArray.length; i++) { - pathInfo.add (pathArray[i]); - } - } - - /** - * Adds a property name to the path. - */ - public void addPropertyName (String str) - { - pathInfo.add (str); - // Now -- how do we add a key and distinguish it from a - // property name? We could define an internal type for - // keys. Do that for the moment and see what that leads - // to in retrieval. Alternatively, it isn't needed because - // we can see that a property has arity Map. - } - - /** - * Adds a key to the path, for a property map. - */ - public void addPropertyKey (Object obj) - { - pathInfo.add (new PropertyKey (obj)); - } - - /** - * Adds an index to the path, for an indexed property. - */ - public void addPropertyIndex (int idx) - { - pathInfo.add (new Integer (idx)); - } - - /** - * Walk down the path and return the specified Property. - * - * @param info The RepInfo object to search - * - * @return The specified Property if found, otherwise null. - */ - public Property locateProperty (RepInfo info) - { - return locateProperty (info, false); - } - - - /** - * Walk down the path and return the specified Property. - * - * @param info The RepInfo object to search - * @param trace If true, write debugging information - * to standard output. - * - * @return The specified Property if found, otherwise null. - */ - public Property locateProperty (RepInfo info, boolean trace) - { - if (pathInfo.isEmpty ()) { - // An empty path can't reach any property - if (trace) { - System.out.println ("Empty property path"); - } - return null; - } - Object obj = pathInfo.get(0); - if (!(obj instanceof String)) { - // The initial qualifier must be a property name - if (trace) { - System.out.println ("Not a property name"); - } - return null; - } - String top = (String) obj; - if (trace) { - System.out.println ("Getting proprerty " + top); - } - Property prop = info.getProperty (top); - if (prop == null) { - // No property of that name in RepInfo - if (trace) { - System.out.println ("Property is null"); - } - return null; - } - int pathLen = pathInfo.size (); - // Pass the CDR of the list to locateSubProperty. - return locateSubProperty (prop, pathInfo.subList (1, pathLen), trace); - } - - /* Recursive function for extracting a subproperty of a property. */ - private Property locateSubProperty (Property property, List path, boolean trace) - { - // If there's nothing left of the path, we're done. - if (path.isEmpty ()) { - return property; - } - List cdr = path.subList (1, path.size()); - PropertyArity arity = property.getArity (); - PropertyType type = property.getType (); - Object val = property.getValue (); - if (trace) { - System.out.println ("Property arity = " + arity + ", type = " + type); - } - // If the type isn't PROPERTY, then there are no subproperties. - if (type != PropertyType.PROPERTY) { - if (trace) { - System.out.println ("Not a property, type is " + type.toString ()); - } - return null; - } - Object obj = path.get (0); - - if (obj instanceof String) { - Iterator iter; - // Iterate through the property and see if any of the elements - // are Properties that match the name. - String name = (String) obj; - if (trace) { - System.out.println ("Looking for subproperty " + name + - " arity= " + arity.toString ()); - } - if (arity.equals (PropertyArity.SCALAR)) { - // There's just one shot at matching a scalar. - Property p = (Property) property.getValue (); - if (p.getName().equals (name)) { - return locateSubProperty (p, cdr, trace); - } - return null; - } - else if (arity.equals (PropertyArity.ARRAY)) { - // We know it's an array of Properties, which saves much - // hair-tearing. - Property[] parray = (Property []) val; - for (int i = 0; i < parray.length; i++) { - Property p = parray[i]; - if (p.getName ().equals (name)) { - return locateSubProperty (p, cdr, trace); - } - } - return null; - } - else if (arity.equals (PropertyArity.LIST)) { - iter = ((List) val).listIterator (); - return getIteratedSubProperty (iter, name, cdr, trace); - } - else if (arity.equals (PropertyArity.SET)) { - iter = ((Set) val).iterator (); - return getIteratedSubProperty (iter, name, cdr, trace); - } - else if (arity.equals (PropertyArity.MAP)) { - iter = ((Map) val).values().iterator(); - return getIteratedSubProperty (iter, name, cdr, trace); - } - else { - // Should never happen, but keep compiler happy - //System.out.println ("Unknown arity"); - return null; - } - } - else if (obj instanceof Integer) { - int idx = ((Integer) obj).intValue(); - //System.out.println ("Property index = " + idx + ", arity= " + arity.toString ()); - if (arity.equals (PropertyArity.LIST)) { - List propList = (List) val; - return locateSubProperty - ((Property) propList.get (idx), cdr, trace); - } - else if (arity.equals (PropertyArity.ARRAY)) { - Property[] propArr = (Property []) val; - return locateSubProperty (propArr[idx], cdr, trace); - } - else { - // Other arities are not indexable - return null; - } - } - else if (obj instanceof PropertyKey) { - // This is applicable only to a Map. - if (arity != PropertyArity.MAP) { - return null; - } - return null; // I'm not sure this case is even meaningful - } - else { - // We should never get here - return null; - } - } - - /* Walk through an Iterator, whose elements are Properties, - * and return the subproperty by path of the first element - * whose name matches name. - */ - private Property getIteratedSubProperty (Iterator iter, - String name, - List path, - boolean trace) - { - while (iter.hasNext ()) { - Property p = (Property) iter.next (); - if (p.getName ().equals (name)) { - return locateSubProperty (p, path, trace); - } - } - return null; - } - - - - private class PropertyKey - { - public Object key; - - public PropertyKey (Object obj) - { - key = obj; - } - } -} diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RAFInputStream.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RAFInputStream.java index 99577b3fb..f0bf11092 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RAFInputStream.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RAFInputStream.java @@ -111,6 +111,7 @@ private void fillFileBuffer() throws IOException /** * Reads a single byte from the file. */ + @Override public int read() throws IOException { if (eof) { @@ -123,7 +124,7 @@ public int read() throws IOException return -1; } } - return ((int) fileBuf[fileBufPos++] & 0xFF); + return (fileBuf[fileBufPos++] & 0xFF); } /** @@ -131,6 +132,7 @@ public int read() throws IOException * stores them into the buffer array b. The number of * bytes actually read is returned as an integer. */ + @Override public int read(byte[] b) throws IOException { int bytesToRead = b.length; @@ -168,6 +170,7 @@ public int read(byte[] b) throws IOException * possibly zero. The number of bytes actually read is * returned as an integer. */ + @Override public int read(byte[] b, int off, int len) throws IOException { int bytesToRead = len; @@ -203,6 +206,7 @@ public int read(byte[] b, int off, int len) throws IOException * * @return the number of bytes actually skipped. */ + @Override public long skip(long n) throws IOException { // If the range of the skip lies within the current buffer, @@ -234,6 +238,7 @@ public long skip(long n) throws IOException * over) from this input stream without blocking, or 0 * when it reaches the end of the input stream. */ + @Override public int available() throws IOException { if (eof) return 0; diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Rational.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Rational.java index 609dc7976..b9203765c 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Rational.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/Rational.java @@ -92,6 +92,7 @@ public long toLong () * Represents the Rational as a String in the form of * "numerator/denominator". */ + @Override public String toString () { return Long.toString (_numerator) + "/" + diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RepInfo.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RepInfo.java index 7baa8ce38..682530c0e 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RepInfo.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/RepInfo.java @@ -122,11 +122,11 @@ private void init (String uri) _urlFlag = false; _valid = TRUE; - _checksum = new ArrayList (); - _message = new ArrayList (); - _profile = new ArrayList (); - _property = new TreeMap (); - _sigMatch = new ArrayList (); + _checksum = new ArrayList<> (); + _message = new ArrayList<> (); + _profile = new ArrayList<> (); + _property = new TreeMap<> (); + _sigMatch = new ArrayList<> (); } /****************************************************************** @@ -140,6 +140,7 @@ private void init (String uri) * The external RepInfo (if any) is not cloned, but * is attached directly to the clone. */ + @Override public Object clone () { RepInfo newri; @@ -150,13 +151,13 @@ public Object clone () return null; // should never happen } - newri._checksum = new ArrayList (_checksum); - newri._message = new ArrayList(_message); - newri._profile = new ArrayList (_profile); - newri._sigMatch = new ArrayList (_sigMatch); - newri._property = new TreeMap (_property); + newri._checksum = new ArrayList<> (_checksum); + newri._message = new ArrayList<>(_message); + newri._profile = new ArrayList<> (_profile); + newri._sigMatch = new ArrayList<> (_sigMatch); + newri._property = new TreeMap<> (_property); - return (Object) newri; + return newri; } /** @@ -279,7 +280,7 @@ public Property getProperty (String name) { Property property = null; if (_property.size () > 0) { - property = (Property) _property.get (name); + property = _property.get (name); } return property; @@ -377,7 +378,7 @@ public Property getByName (String name) Collection coll = _property.values (); Iterator iter = coll.iterator (); while (iter.hasNext ()) { - prop = (Property) iter.next (); + prop = iter.next (); if ((prop = prop.getByName (name)) != null) { break; } diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMLWrapperStream.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMLWrapperStream.java index 5628460d3..dfa3942b7 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMLWrapperStream.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMLWrapperStream.java @@ -107,6 +107,7 @@ public XMLWrapperStream (InputStream wrappedStream, String rootName) * * @see java.io.InputStream#read() */ + @Override public int read() throws IOException { int retval; @@ -118,7 +119,7 @@ public int read() throws IOException } else { // We haven't finished returning the declaration string. - return (int) xmlDecl.charAt(strIndex++); + return xmlDecl.charAt(strIndex++); } } @@ -130,7 +131,7 @@ public int read() throws IOException state = CONTENT; } else { - return (int) rootStart.charAt(strIndex++); + return rootStart.charAt(strIndex++); } } @@ -152,7 +153,7 @@ public int read() throws IOException // We have finished the root element end and the document now. return -1; } - return (int) rootEnd.charAt(strIndex++); + return rootEnd.charAt(strIndex++); } diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMPHandler.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMPHandler.java index 984cc09a7..0e09e6aae 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMPHandler.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/XMPHandler.java @@ -39,14 +39,6 @@ public class XMPHandler extends org.xml.sax.helpers.DefaultHandler { // private final static String photoshopSchema = // "http://ns.adobe.com/photoshop/1.0/"; - private int curStructType; - /* Values which may be assigned to curStructType */ - private final static int - UNASSIGNED = 0, - BAG = 1, - ALT = 2, - SEQ = 3; - private boolean pdfaCompliant; public XMPHandler () @@ -63,6 +55,7 @@ public boolean isPdfaCompliant () { } + @Override public void processingInstruction (String target, String data) throws SAXException { @@ -77,8 +70,8 @@ public void processingInstruction (String target, String data) int idx = data.indexOf ("begin="); idx = data.indexOf ('"', idx + 1); if (data.length () >= idx + 2) { - int char1 = (int) data.charAt (idx + 1); - int char2 = (int) data.charAt (idx + 2); + int char1 = data.charAt (idx + 1); + int char2 = data.charAt (idx + 2); if (char1 == 0XFF && char2 == 0XFE) { noEndian = false; bigEndian = false; @@ -124,42 +117,18 @@ else if (bigEndian) { } - /** - * Catches the start of an element and, if it's one we care - * about, sets state information. - */ - public void startElement (String namespaceURI, String localName, - String rawName, Attributes atts) - throws SAXException - { - //System.out.println (namespaceURI); // Just for debugging and placeholding - if (xmpBasicSchema.equals (namespaceURI)) { - if ("Bag".equals (rawName)) { - curStructType = BAG; - } - else if ("Seq".equals (rawName)) { - curStructType = SEQ; - } - else if ("Alt".equals (rawName)) { - curStructType = ALT; - } - } - } - - /** * Catches the end of an element. */ + @Override public void endElement (String namespaceURI, String localName, String rawName) - throws SAXException { if (xmpBasicSchema.equals (namespaceURI)) { // Check for the end of an XMP structure if ("Bag".equals (rawName)|| "Seq".equals (rawName) || "Alt".equals (rawName)) { - curStructType = UNASSIGNED; } } } @@ -168,8 +137,8 @@ public void endElement (String namespaceURI, String localName, * behavior is to report a "fatal error" to standard output, * which is harmless but scary. */ + @Override public void fatalError(SAXParseException exception) - throws SAXException { } } diff --git a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/AuditHandler.java b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/AuditHandler.java index 0a1f469f8..f2649fe30 100644 --- a/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/AuditHandler.java +++ b/jhove-core/src/main/java/edu/harvard/hul/ois/jhove/handler/AuditHandler.java @@ -67,13 +67,13 @@ public class AuditHandler protected String _home; /** Number of files processed by MIME type. */ - protected Map _mimeType; + protected Map _mimeType; /** State map. */ - protected Map _stateMap; + protected Map _stateMap; /** State stack. */ - protected Stack _stateStack; + protected Stack _stateStack; /** Initial time. */ protected long _t0; @@ -104,9 +104,9 @@ public AuditHandler () /* Initialize the handler. */ - _mimeType = new TreeMap (); - _stateMap = new TreeMap (); - _stateStack = new Stack (); + _mimeType = new TreeMap<> (); + _stateMap = new TreeMap<> (); + _stateStack = new Stack<> (); _nAudit = 0; } @@ -119,12 +119,13 @@ public AuditHandler () * Prop the state stack and place the current directory file count * into the directory hash. */ + @Override public final void endDirectory () { - AuditState state = (AuditState) _stateStack.pop (); + AuditState state = _stateStack.pop (); _stateMap.put (state.getDirectory (), state); - endDirectoryImpl (state); + endDirectoryImpl (); } /** @@ -132,7 +133,7 @@ public final void endDirectory () * finished being processed. * @param state Audit handler state */ - public void endDirectoryImpl (AuditState state) + public void endDirectoryImpl () { } @@ -140,11 +141,12 @@ public void endDirectoryImpl (AuditState state) * Determine whether or not to process the file. * @param filepath File pathname */ + @Override public final boolean okToProcess (String filepath) { - AuditState state = (AuditState) _stateStack.peek (); + AuditState state = _stateStack.peek (); - boolean ok = okToProcessImpl (filepath, state); + boolean ok = true; if (!ok) { state.setNotProcessed (state.getNotProcessed () + 1); } @@ -152,24 +154,14 @@ public final boolean okToProcess (String filepath) return ok; } - /** - * Local extension to standard callback that determines whether or not - * to process the file. - * @param filepath File pathname - * @param state Audit handler state - */ - public boolean okToProcessImpl (String filepath, AuditState state) - { - return true; - } - /** * Outputs the information contained in a RepInfo object * @param info Object representation information */ + @Override public void show (RepInfo info) { - AuditState state = (AuditState) _stateStack.peek (); + AuditState state = _stateStack.peek (); /* If the file is not found, then no module is assigned in the * RepInfo object. @@ -182,7 +174,7 @@ public void show (RepInfo info) } else { String mime = info.getMimeType (); - AuditCount count = (AuditCount) _mimeType.get (mime); + AuditCount count = _mimeType.get (mime); if (count == null) { count = new AuditCount (); } @@ -199,7 +191,7 @@ public void show (RepInfo info) _mimeType.put (mime, count); } - showImpl (info, state); + showImpl (info); } /** @@ -208,7 +200,7 @@ public void show (RepInfo info) * @param info Object representation information * @param state Audit handler state */ - public void showImpl (RepInfo info, AuditState state) + public void showImpl (RepInfo info) { String status = null; String mime = info.getMimeType (); @@ -232,7 +224,7 @@ public void showImpl (RepInfo info, AuditState state) /* Retrieve the MD5 checksum, if available. */ String md5 = null; - List list = info.getChecksum (); + List list = info.getChecksum (); int len = list.size (); for (int i=0; i 0 || state.getNotFound () > 0) { _stateMap.put (state.getDirectory (), state); } - showFooterImpl (state); + showFooterImpl (); // super.showFooter (); _writer.println ("