aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2014-10-25 21:32:03 +0000
committerAndreas Beeker <kiwiwings@apache.org>2014-10-25 21:32:03 +0000
commitc828d44a84b1407179014a49fd391b82023e70c5 (patch)
tree4debb5e7df8a838ef5d534c24a7ed7451b609a05
parent1499778fddf4134b429bf346efc6e67998dc8c2e (diff)
downloadpoi-c828d44a84b1407179014a49fd391b82023e70c5.tar.gz
poi-c828d44a84b1407179014a49fd391b82023e70c5.zip
house keeping - fixes for sonarqube blockers
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1634255 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/examples/src/org/apache/poi/hwpf/Word2Forrest.java21
-rw-r--r--src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java3
-rw-r--r--src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java6
-rw-r--r--src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java2
-rw-r--r--src/java/org/apache/poi/hpsf/CustomProperty.java4
-rw-r--r--src/java/org/apache/poi/hssf/model/WorkbookRecordList.java16
-rw-r--r--src/java/org/apache/poi/hssf/record/FontRecord.java10
-rw-r--r--src/java/org/apache/poi/poifs/property/DirectoryProperty.java20
-rw-r--r--src/ooxml/java/org/apache/poi/util/OOXMLLite.java2
-rw-r--r--src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java17
-rw-r--r--src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java8
-rw-r--r--src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java85
-rw-r--r--src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java23
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java9
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java2
15 files changed, 149 insertions, 79 deletions
diff --git a/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java b/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java
index 82d3a8a230..0b8570226a 100644
--- a/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java
+++ b/src/examples/src/org/apache/poi/hwpf/Word2Forrest.java
@@ -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();
}
diff --git a/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java b/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
index 7dc487db85..7624ed2125 100644
--- a/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
+++ b/src/examples/src/org/apache/poi/poifs/poibrowser/POIBrowser.java
@@ -41,6 +41,7 @@ import org.apache.poi.poifs.eventfilesystem.POIFSReader;
* @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 + "\":");
diff --git a/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java b/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java
index 34b59eb458..a5435c0ce3 100644
--- a/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java
+++ b/src/examples/src/org/apache/poi/poifs/poibrowser/TreeReaderListener.java
@@ -70,7 +70,7 @@ public class TreeReaderListener implements POIFSReaderListener
* <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 implements POIFSReaderListener
{
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 implements POIFSReaderListener
d = new DocumentDescriptor(event.getName(), event.getPath(),
is, nrOfBytes);
}
- catch (Throwable t)
+ catch (Exception t)
{
System.err.println
("Unexpected exception while processing " +
diff --git a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
index 23798e499e..4224969887 100644
--- a/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
+++ b/src/excelant/java/org/apache/poi/ss/excelant/ExcelAntTask.java
@@ -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 " +
diff --git a/src/java/org/apache/poi/hpsf/CustomProperty.java b/src/java/org/apache/poi/hpsf/CustomProperty.java
index 0b6d0f17e8..7c58e8f748 100644
--- a/src/java/org/apache/poi/hpsf/CustomProperty.java
+++ b/src/java/org/apache/poi/hpsf/CustomProperty.java
@@ -120,4 +120,8 @@ public class CustomProperty extends MutableProperty
return (int) this.getID();
}
+ @Override
+ public boolean equals(Object o) {
+ return (o instanceof CustomProperty) ? equalsContents(o) : false;
+ }
}
diff --git a/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java b/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java
index fd905a4a04..e02f8ba84a 100644
--- a/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java
+++ b/src/java/org/apache/poi/hssf/model/WorkbookRecordList.java
@@ -72,9 +72,21 @@ public final class WorkbookRecordList implements Iterable<Record> {
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 )
diff --git a/src/java/org/apache/poi/hssf/record/FontRecord.java b/src/java/org/apache/poi/hssf/record/FontRecord.java
index b4a9e267b1..47d33ab0ec 100644
--- a/src/java/org/apache/poi/hssf/record/FontRecord.java
+++ b/src/java/org/apache/poi/hssf/record/FontRecord.java
@@ -475,7 +475,15 @@ public final class FontRecord extends StandardRecord {
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)));
+ }
}
diff --git a/src/java/org/apache/poi/poifs/property/DirectoryProperty.java b/src/java/org/apache/poi/poifs/property/DirectoryProperty.java
index f263419910..a73221af24 100644
--- a/src/java/org/apache/poi/poifs/property/DirectoryProperty.java
+++ b/src/java/org/apache/poi/poifs/property/DirectoryProperty.java
@@ -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 Property implements Parent { // TODO - fi
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
diff --git a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java b/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
index f6d809dc83..2144470bbd 100644
--- a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
+++ b/src/ooxml/java/org/apache/poi/util/OOXMLLite.java
@@ -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);
}
}
diff --git a/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java b/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java
index 857b52ddbd..09d6d6b047 100644
--- a/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java
+++ b/src/scratchpad/src/org/apache/poi/hdf/extractor/NewOleFile.java
@@ -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 RandomAccessFile
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 RandomAccessFile
{
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 RandomAccessFile
initializePropertySets(rootChain);
}
+ @SuppressWarnings("unused")
public static void main(String args[])
{
try
diff --git a/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java b/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java
index ff737f298e..f020fa7269 100644
--- a/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java
+++ b/src/scratchpad/src/org/apache/poi/hdf/extractor/TableRow.java
@@ -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;
}
diff --git a/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java b/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
index a779b6fc44..c122d31c05 100644
--- a/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
+++ b/src/scratchpad/src/org/apache/poi/hdf/extractor/WordDocument.java
@@ -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)
{
diff --git a/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java b/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
index 3df1b5d586..ce9dcb3976 100644
--- a/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
+++ b/src/scratchpad/src/org/apache/poi/hdf/model/HDFObjectFactory.java
@@ -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()
{
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java b/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java
index 5aba80c606..09e1b9342b 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/QuickTest.java
@@ -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();
}
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
index 3549e363bf..50d00b735b 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToTextConverter.java
@@ -368,7 +368,7 @@ public class WordToTextConverter extends AbstractWordConverter
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 '",