You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2014/10/25 23:32:04 UTC

svn commit: r1634255 - in /poi/trunk/src: examples/src/org/apache/poi/hwpf/ examples/src/org/apache/poi/poifs/poibrowser/ excelant/java/org/apache/poi/ss/excelant/ java/org/apache/poi/hpsf/ java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/recor...

Author: kiwiwings
Date: Sat Oct 25 21:32:03 2014
New Revision: 1634255

URL: http://svn.apache.org/r1634255
Log:
house keeping - fixes for sonarqube blockers

Modified:
    poi/trunk/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java
    poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
    poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java
    poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
    poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java
    poi/trunk/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java
    poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java
    poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java
    poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java

Modified: poi/trunk/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java Sat Oct 25 21:32:03 2014
@@ -17,17 +17,26 @@
 
 package org.apache.poi.hwpf;
 
-import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.usermodel.*;
-import org.apache.poi.hwpf.model.*;
-
-import java.io.*;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import org.apache.poi.hwpf.model.StyleDescription;
+import org.apache.poi.hwpf.model.StyleSheet;
+import org.apache.poi.hwpf.usermodel.CharacterRun;
+import org.apache.poi.hwpf.usermodel.Paragraph;
+import org.apache.poi.hwpf.usermodel.Range;
 
 public final class Word2Forrest
 {
   Writer _out;
   HWPFDocument _doc;
 
+  @SuppressWarnings("unused")
   public Word2Forrest(HWPFDocument doc, OutputStream stream)
     throws IOException, UnsupportedEncodingException
   {
@@ -216,7 +225,7 @@ public final class Word2Forrest
       new Word2Forrest(new HWPFDocument(new FileInputStream(args[0])), out);
       out.close();
     }
-    catch (Throwable t)
+    catch (Exception t)
     {
       t.printStackTrace();
     }

Modified: poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java Sat Oct 25 21:32:03 2014
@@ -41,6 +41,7 @@ import org.apache.poi.poifs.eventfilesys
  * @author Rainer Klute <a
  * href="mailto:klute@rainer-klute.de">&lt;klute@rainer-klute.de&gt;</a>
  */
+@SuppressWarnings("serial")
 public class POIBrowser extends JFrame
 {
 
@@ -99,7 +100,7 @@ public class POIBrowser extends JFrame
             {
                 System.err.println(filename + ": " + ex);
             }
-            catch (Throwable t)
+            catch (Exception t)
             {
                 System.err.println("Unexpected exception while reading \"" +
                                    filename + "\":");

Modified: poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java Sat Oct 25 21:32:03 2014
@@ -70,7 +70,7 @@ public class TreeReaderListener implemen
      * <p>Maps filenames and POI document paths to their associated
      * tree nodes.</p>
      */
-    protected Map pathToNode;
+    protected Map<Object,MutableTreeNode> pathToNode;
 
     /**
      * <p>The name of the file this {@link TreeReaderListener}
@@ -99,7 +99,7 @@ public class TreeReaderListener implemen
     {
         this.filename = filename;
         this.rootNode = rootNode;
-        pathToNode = new HashMap(15); // Should be a reasonable guess.
+        pathToNode = new HashMap<Object,MutableTreeNode>(15); // Should be a reasonable guess.
     }
 
 
@@ -146,7 +146,7 @@ public class TreeReaderListener implemen
             d = new DocumentDescriptor(event.getName(), event.getPath(),
                                        is, nrOfBytes);
         }
-        catch (Throwable t)
+        catch (Exception t)
         {
             System.err.println
                 ("Unexpected exception while processing " +

Modified: poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java (original)
+++ poi/trunk/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java Sat Oct 25 21:32:03 2014
@@ -175,7 +175,7 @@ public class ExcelAntTask extends Task {
         try {
             Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook");
             Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory");
-        } catch (Throwable e) {
+        } catch (Exception e) {
             throw new BuildException(
                     "The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " +
                     "if not in Ant's own classpath. Processing .xlsx spreadsheets requires " +

Modified: poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java (original)
+++ poi/trunk/src/java/org/apache/poi/hpsf/CustomProperty.java Sat Oct 25 21:32:03 2014
@@ -120,4 +120,8 @@ public class CustomProperty extends Muta
         return (int) this.getID();
     }
 
+    @Override
+    public boolean equals(Object o) {
+        return (o instanceof CustomProperty) ? equalsContents(o) : false;
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java Sat Oct 25 21:32:03 2014
@@ -72,9 +72,21 @@ public final class WorkbookRecordList im
 		return records.iterator();
 	}
 
+	/**
+	 * Find the given record in the record list by identity and removes it
+	 *
+	 * @param record the identical record to be searched for
+	 */
 	public void remove( Object record ) {
-	   int i = records.indexOf(record);
-	   this.remove(i);
+	   // can't use List.indexOf here because it checks the records for equality and not identity
+	   int i = 0;
+	   for (Record r : records) {
+	       if (r == record) {
+	           remove(i);
+	           break;
+	       }
+	       i++;
+	   }
 	}
 
 	public void remove( int pos )

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/FontRecord.java Sat Oct 25 21:32:03 2014
@@ -475,7 +475,15 @@ public final class FontRecord extends St
 		field_7_family              == other.field_7_family &&
 		field_8_charset             == other.field_8_charset &&
 		field_9_zero                == other.field_9_zero &&
-		field_11_font_name.equals(other.field_11_font_name)
+        stringEquals(this.field_11_font_name, other.field_11_font_name)
 		;
 	}
+
+    public boolean equals(Object o) {
+        return (o instanceof FontRecord) ? sameProperties((FontRecord)o) : false;
+    }
+    
+    private static boolean stringEquals(String s1, String s2) {
+        return (s1 == s2 || (s1 != null && s1.equals(s2)));
+    }
 }

Modified: poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java (original)
+++ poi/trunk/src/java/org/apache/poi/poifs/property/DirectoryProperty.java Sat Oct 25 21:32:03 2014
@@ -18,7 +18,13 @@
 package org.apache.poi.poifs.property;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 /**
  * Directory property
@@ -118,18 +124,6 @@ public class DirectoryProperty extends P
     public static class PropertyComparator implements Comparator<Property> {
 
         /**
-         * Object equality, implemented as object identity
-         *
-         * @param o Object we're being compared to
-         *
-         * @return true if identical, else false
-         */
-        public boolean equals(Object o)
-        {
-            return this == o;
-        }
-
-        /**
          * compare method. Assumes both parameters are non-null
          * instances of Property. One property is less than another if
          * its name is shorter than the other property's name. If the

Modified: poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/util/OOXMLLite.java Sat Oct 25 21:32:03 2014
@@ -52,7 +52,7 @@ public final class OOXMLLite {
         try {
             _classes = ClassLoader.class.getDeclaredField("classes");
             _classes.setAccessible(true);
-        } catch (Throwable e) {
+        } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java Sat Oct 25 21:32:03 2014
@@ -17,8 +17,13 @@
 
 package org.apache.poi.hdf.extractor;
 
-import java.io.*;
-import java.util.*;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Comment me
@@ -38,8 +43,8 @@ public final class NewOleFile extends Ra
     private int[] _bbd_list;
     protected int[] _big_block_depot;
     protected int[] _small_block_depot;
-    Hashtable _propertySetsHT = new Hashtable();
-    Vector _propertySetsV = new Vector();
+    Map<String,PropertySet> _propertySetsHT = new HashMap<String,PropertySet>();
+    List<PropertySet> _propertySetsV = new ArrayList<PropertySet>();
 
     public NewOleFile(String fileName, String mode) throws FileNotFoundException
     {
@@ -48,12 +53,13 @@ public final class NewOleFile extends Ra
         {
             init();
         }
-        catch(Throwable e)
+        catch(Exception e)
         {
             e.printStackTrace();
         }
     }
 
+    @SuppressWarnings("unused")
     private void init() throws IOException
     {
 
@@ -101,6 +107,7 @@ public final class NewOleFile extends Ra
         initializePropertySets(rootChain);
 
     }
+    @SuppressWarnings("unused")
     public static void main(String args[])
     {
       try

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java Sat Oct 25 21:32:03 2014
@@ -17,7 +17,7 @@
 
 package org.apache.poi.hdf.extractor;
 
-import java.util.*;
+import java.util.ArrayList;
 
 /**
  * Comment me
@@ -28,9 +28,9 @@ import java.util.*;
 public final class TableRow
 {
   TAP _descriptor;
-  ArrayList _cells;
+  ArrayList<String> _cells;
 
-  public TableRow(ArrayList cells, TAP descriptor)
+  public TableRow(ArrayList<String> cells, TAP descriptor)
   {
     _cells = cells;
     _descriptor = descriptor;
@@ -39,7 +39,7 @@ public final class TableRow
   {
     return _descriptor;
   }
-  public ArrayList getCells()
+  public ArrayList<String> getCells()
   {
     return _cells;
   }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java Sat Oct 25 21:32:03 2014
@@ -18,14 +18,25 @@
 package org.apache.poi.hdf.extractor;
 
 
-import org.apache.poi.hdf.extractor.util.*;
-import org.apache.poi.hdf.extractor.data.*;
-import java.util.*;
-import java.io.*;
-
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+
+import org.apache.poi.hdf.extractor.data.DOP;
+import org.apache.poi.hdf.extractor.data.LVL;
+import org.apache.poi.hdf.extractor.data.ListTables;
+import org.apache.poi.hdf.extractor.util.BTreeSet;
+import org.apache.poi.hdf.extractor.util.ChpxNode;
+import org.apache.poi.hdf.extractor.util.NumberFormatter;
+import org.apache.poi.hdf.extractor.util.PapxNode;
+import org.apache.poi.hdf.extractor.util.PropertyNode;
+import org.apache.poi.hdf.extractor.util.SepxNode;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
-
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.LittleEndian;
 
 /**
@@ -70,9 +81,9 @@ public final class WordDocument {
   /** used for XSL-FO table conversion*/
   StringBuffer _cellBuffer;
   /** used for XSL-FO table conversion*/
-  ArrayList _cells;
+  ArrayList<String> _cells;
   /** used for XSL-FO table conversion*/
-  ArrayList _table;
+  ArrayList<TableRow> _table;
 
   /** document's header and footer information*/
   byte[] _plcfHdd;
@@ -141,7 +152,7 @@ public final class WordDocument {
   {
     int textStart = Utils.convertBytesToInt(_header, 0x18);
     int textEnd = Utils.convertBytesToInt(_header, 0x1c);
-    ArrayList textPieces = findProperties(textStart, textEnd, _text.root);
+    ArrayList<PropertyNode> textPieces = findProperties(textStart, textEnd, _text.root);
     int size = textPieces.size();
 
     for(int x = 0; x < size; x++)
@@ -192,7 +203,7 @@ public final class WordDocument {
         readFIB();
 
         //get the SEPS for the main document text
-        ArrayList sections = findProperties(_fcMin, _fcMin + _ccpText, _sectionTable.root);
+        ArrayList<PropertyNode> sections = findProperties(_fcMin, _fcMin + _ccpText, _sectionTable.root);
 
         //iterate through sections, paragraphs, and character runs doing what
         //you will with the data.
@@ -674,11 +685,12 @@ public final class WordDocument {
     _sectionCounter++;
   }
 
+  @SuppressWarnings("unused")
   private int calculateHeaderHeight(int start, int end, int pageWidth)
   {
-    ArrayList paragraphs = findProperties(start, end, _paragraphTable.root);
+    ArrayList<PropertyNode> paragraphs = findProperties(start, end, _paragraphTable.root);
     int size = paragraphs.size();
-    ArrayList lineHeights = new ArrayList();
+    ArrayList<Integer> lineHeights = new ArrayList<Integer>();
     //StyleContext context = StyleContext.getDefaultStyleContext();
 
     for(int x = 0; x < size; x++)
@@ -690,7 +702,7 @@ public final class WordDocument {
       int lineWidth = 0;
       int maxHeight = 0;
 
-      ArrayList textRuns = findProperties(parStart, parEnd, _characterTable.root);
+      ArrayList<PropertyNode> textRuns = findProperties(parStart, parEnd, _characterTable.root);
       int charSize = textRuns.size();
 
       //StringBuffer lineBuffer = new StringBuffer();
@@ -710,7 +722,7 @@ public final class WordDocument {
         int charStart = Math.max(parStart, charNode.getStart());
         int charEnd = Math.min(parEnd, charNode.getEnd());
 
-        ArrayList text = findProperties(charStart, charEnd, _text.root);
+        ArrayList<PropertyNode> text = findProperties(charStart, charEnd, _text.root);
 
         int textSize = text.size();
         StringBuffer buf = new StringBuffer();
@@ -770,6 +782,7 @@ public final class WordDocument {
 
     return context.getFontMetrics(font);
   }*/
+  @SuppressWarnings("unused")
   private String createRegion(boolean before, HeaderFooter header, SEP sep, String name)
   {
     if(header.isEmpty())
@@ -818,6 +831,7 @@ public final class WordDocument {
 //             marginBottom + "pt\" " + region + "/>";
 
   }
+  @SuppressWarnings("unused")
   private String createRegion(String where, String name)
   {
     return "<fo:region-" + where + " overflow=\"scroll\" region-name=\"" + name + "\"/>";
@@ -859,7 +873,7 @@ public final class WordDocument {
   {
 
     BTreeSet.BTreeNode root = paragraphTable.root;
-    ArrayList pars = findProperties(start, end, root);
+    ArrayList<PropertyNode> pars = findProperties(start, end, root);
     //root = characterTable.root;
     int size = pars.size();
 
@@ -910,7 +924,7 @@ public final class WordDocument {
       {
         if(_table == null)
         {
-          _table = new ArrayList();
+          _table = new ArrayList<TableRow>();
         }
         TAP tap = (TAP)StyleSheet.uncompressProperty(papx, new TAP(), _styleSheet);
         TableRow nextRow = new TableRow(_cells, tap);
@@ -937,6 +951,7 @@ public final class WordDocument {
 
   }
 
+  @SuppressWarnings("unused")
   private void addListParagraphContent(LVL lvl, StringBuffer blockBuffer, PAP pap,
                                        PapxNode currentNode, int start, int end,
                                        StyleDescription std)
@@ -945,7 +960,7 @@ public final class WordDocument {
 
     addParagraphProperties(pap, blockBuffer);
 
-    ArrayList charRuns = findProperties(Math.max(currentNode.getStart(), start),
+    ArrayList<PropertyNode> charRuns = findProperties(Math.max(currentNode.getStart(), start),
                                      Math.min(currentNode.getEnd(), end),
                                      _characterTable.root);
     int len = charRuns.size();
@@ -1003,7 +1018,7 @@ public final class WordDocument {
 
       int charStart = Math.max(charNode.getStart(), currentNode.getStart());
       int charEnd = Math.min(charNode.getEnd(), currentNode.getEnd());
-      ArrayList textRuns = findProperties(charStart, charEnd, _text.root);
+      ArrayList<PropertyNode> textRuns = findProperties(charStart, charEnd, _text.root);
       int textRunLen = textRuns.size();
       for(int y = 0; y < textRunLen; y++)
       {
@@ -1031,7 +1046,7 @@ public final class WordDocument {
   {
     addParagraphProperties(pap, blockBuffer);
 
-    ArrayList charRuns = findProperties(Math.max(currentNode.getStart(), start),
+    ArrayList<PropertyNode> charRuns = findProperties(Math.max(currentNode.getStart(), start),
                                      Math.min(currentNode.getEnd(), end),
                                      _characterTable.root);
     int len = charRuns.size();
@@ -1046,7 +1061,7 @@ public final class WordDocument {
 
       int charStart = Math.max(charNode.getStart(), currentNode.getStart());
       int charEnd = Math.min(charNode.getEnd(), currentNode.getEnd());
-      ArrayList textRuns = findProperties(charStart, charEnd, _text.root);
+      ArrayList<PropertyNode> textRuns = findProperties(charStart, charEnd, _text.root);
       int textRunLen = textRuns.size();
       for(int y = 0; y < textRunLen; y++)
       {
@@ -1092,7 +1107,7 @@ public final class WordDocument {
 
       if(_cells == null)
       {
-        _cells = new ArrayList();
+        _cells = new ArrayList<String>();
       }
       closeLine(_cellBuffer);
       closeBlock(_cellBuffer);
@@ -1279,9 +1294,9 @@ public final class WordDocument {
   /**
    * finds all chpx's that are between start and end
    */
-  private ArrayList findProperties(int start, int end, BTreeSet.BTreeNode root)
+  private ArrayList<PropertyNode> findProperties(int start, int end, BTreeSet.BTreeNode root)
   {
-    ArrayList results = new ArrayList();
+    ArrayList<PropertyNode> results = new ArrayList<PropertyNode>();
     BTreeSet.Entry[] entries = root._entries;
 
     for(int x = 0; x < entries.length; x++)
@@ -1300,7 +1315,7 @@ public final class WordDocument {
             {
               if(child != null)
               {
-                ArrayList beforeItems = findProperties(start, end, child);
+                ArrayList<PropertyNode> beforeItems = findProperties(start, end, child);
                 results.addAll(beforeItems);
               }
               results.add(xNode);
@@ -1315,7 +1330,7 @@ public final class WordDocument {
           {
             if(child != null)
             {
-              ArrayList beforeItems = findProperties(start, end, child);
+              ArrayList<PropertyNode> beforeItems = findProperties(start, end, child);
               results.addAll(beforeItems);
             }
             break;
@@ -1323,7 +1338,7 @@ public final class WordDocument {
         }
         else if(child != null)
         {
-          ArrayList afterItems = findProperties(start, end, child);
+          ArrayList<PropertyNode> afterItems = findProperties(start, end, child);
           results.addAll(afterItems);
         }
       }
@@ -1358,9 +1373,10 @@ public final class WordDocument {
   {
     buf.append("</fo:block>\r\n");
   }
-  private ArrayList findPAPProperties(int start, int end, BTreeSet.BTreeNode root)
+  @SuppressWarnings("unused")
+  private ArrayList<PropertyNode> findPAPProperties(int start, int end, BTreeSet.BTreeNode root)
   {
-    ArrayList results = new ArrayList();
+    ArrayList<PropertyNode> results = new ArrayList<PropertyNode>();
     BTreeSet.Entry[] entries = root._entries;
 
     for(int x = 0; x < entries.length; x++)
@@ -1378,7 +1394,7 @@ public final class WordDocument {
             {
               if(child != null)
               {
-                ArrayList beforeItems = findPAPProperties(start, end, child);
+                ArrayList<PropertyNode> beforeItems = findPAPProperties(start, end, child);
                 results.addAll(beforeItems);
               }
               results.add(papxNode);
@@ -1388,7 +1404,7 @@ public final class WordDocument {
           {
             if(child != null)
             {
-              ArrayList beforeItems = findPAPProperties(start, end, child);
+              ArrayList<PropertyNode> beforeItems = findPAPProperties(start, end, child);
               results.addAll(beforeItems);
             }
             break;
@@ -1396,7 +1412,7 @@ public final class WordDocument {
         }
         else if(child != null)
         {
-          ArrayList afterItems = findPAPProperties(start, end, child);
+          ArrayList<PropertyNode> afterItems = findPAPProperties(start, end, child);
           results.addAll(afterItems);
         }
       }
@@ -1468,6 +1484,7 @@ public final class WordDocument {
     _headerBuffer.append("</fo:simple-page-master>\r\n");
     return thisPage;
   }
+  @SuppressWarnings("unused")
   private void addBorder(StringBuffer buf, short[] brc, String where)
   {
     if((brc[0] & 0xff00) != 0 && brc[0] != -1)
@@ -1497,7 +1514,7 @@ public final class WordDocument {
       test.flush();
       test.close();
     }
-    catch(Throwable t)
+    catch(Exception t)
     {
       t.printStackTrace();
     }
@@ -1750,7 +1767,7 @@ public final class WordDocument {
         StringBuffer rowBuffer = tableBodyBuffer;
         TableRow row = (TableRow)_table.get(x);
         TAP tap = row.getTAP();
-        ArrayList cells = row.getCells();
+        ArrayList<String> cells = row.getCells();
 
         if(tap._fTableHeader)
         {

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java Sat Oct 25 21:32:03 2014
@@ -24,7 +24,19 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.poi.hdf.event.HDFLowLevelParsingListener;
-import org.apache.poi.hdf.model.hdftypes.*;
+import org.apache.poi.hdf.model.hdftypes.CHPFormattedDiskPage;
+import org.apache.poi.hdf.model.hdftypes.ChpxNode;
+import org.apache.poi.hdf.model.hdftypes.DocumentProperties;
+import org.apache.poi.hdf.model.hdftypes.FileInformationBlock;
+import org.apache.poi.hdf.model.hdftypes.FontTable;
+import org.apache.poi.hdf.model.hdftypes.FormattedDiskPage;
+import org.apache.poi.hdf.model.hdftypes.ListTables;
+import org.apache.poi.hdf.model.hdftypes.PAPFormattedDiskPage;
+import org.apache.poi.hdf.model.hdftypes.PapxNode;
+import org.apache.poi.hdf.model.hdftypes.PlexOfCps;
+import org.apache.poi.hdf.model.hdftypes.SepxNode;
+import org.apache.poi.hdf.model.hdftypes.StyleSheet;
+import org.apache.poi.hdf.model.hdftypes.TextPiece;
 import org.apache.poi.hdf.model.util.ParsingState;
 import org.apache.poi.poifs.filesystem.DocumentEntry;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@@ -56,6 +68,7 @@ public final class HDFObjectFactory {
     byte[] _tableBuffer;
 
 
+    @SuppressWarnings("unused")
     public static void main(String args[])
     {
       try
@@ -63,7 +76,7 @@ public final class HDFObjectFactory {
         HDFObjectFactory f = new HDFObjectFactory(new FileInputStream("c:\\test.doc"));
         int k = 0;
       }
-      catch(Throwable t)
+      catch(Exception t)
       {
         t.printStackTrace();
       }
@@ -115,9 +128,9 @@ public final class HDFObjectFactory {
         this(istream, null);
     }
 
-    public static List getTypes(InputStream istream) throws IOException
+    public static List<FileInformationBlock> getTypes(InputStream istream) throws IOException
     {
-        List results = new ArrayList(1);
+        List<FileInformationBlock> results = new ArrayList<FileInformationBlock>(1);
 
         //do Ole stuff
         POIFSFileSystem filesystem = new POIFSFileSystem(istream);
@@ -355,6 +368,7 @@ public final class HDFObjectFactory {
     /**
      * intializes the Paragraph Properties BTree
      */
+    @SuppressWarnings("unused")
     private void initParagraphProperties()
     {
         //paragraphs
@@ -458,6 +472,7 @@ public final class HDFObjectFactory {
     /**
      * initializes the SectionProperties BTree
      */
+    @SuppressWarnings("unused")
     private void initSectionProperties()
     {
 

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java Sat Oct 25 21:32:03 2014
@@ -17,9 +17,12 @@
 
 package org.apache.poi.hwpf;
 
-import java.io.*;
+import java.io.FileInputStream;
 
-import org.apache.poi.hwpf.usermodel.*;
+import org.apache.poi.hwpf.usermodel.CharacterRun;
+import org.apache.poi.hwpf.usermodel.Paragraph;
+import org.apache.poi.hwpf.usermodel.Range;
+import org.apache.poi.hwpf.usermodel.Section;
 
 public final class QuickTest
 {
@@ -80,7 +83,7 @@ public final class QuickTest
 //      }
 
     }
-    catch (Throwable t)
+    catch (Exception t)
     {
       t.printStackTrace();
     }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java?rev=1634255&r1=1634254&r2=1634255&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java Sat Oct 25 21:32:03 2014
@@ -368,7 +368,7 @@ public class WordToTextConverter extends
                     DirectoryNode.class );
             extractor = createExtractor.invoke( null, directoryNode );
         }
-        catch ( Error exc )
+        catch ( Exception exc )
         {
             // no extractor in classpath
             logger.log( POILogger.WARN, "There is an OLE object entry '",



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org