house keeping - fixes for sonarqube blockers

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1634255 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2014-10-25 21:32:03 +00:00
parent e409054f89
commit f818d1fdb7
15 changed files with 147 additions and 77 deletions

View File

@ -17,17 +17,26 @@
package org.apache.poi.hwpf; package org.apache.poi.hwpf;
import org.apache.poi.hwpf.HWPFDocument; import java.io.FileInputStream;
import org.apache.poi.hwpf.usermodel.*; import java.io.FileOutputStream;
import org.apache.poi.hwpf.model.*; import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.io.*; 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 public final class Word2Forrest
{ {
Writer _out; Writer _out;
HWPFDocument _doc; HWPFDocument _doc;
@SuppressWarnings("unused")
public Word2Forrest(HWPFDocument doc, OutputStream stream) public Word2Forrest(HWPFDocument doc, OutputStream stream)
throws IOException, UnsupportedEncodingException throws IOException, UnsupportedEncodingException
{ {
@ -216,7 +225,7 @@ public final class Word2Forrest
new Word2Forrest(new HWPFDocument(new FileInputStream(args[0])), out); new Word2Forrest(new HWPFDocument(new FileInputStream(args[0])), out);
out.close(); out.close();
} }
catch (Throwable t) catch (Exception t)
{ {
t.printStackTrace(); t.printStackTrace();
} }

View File

@ -41,6 +41,7 @@ import org.apache.poi.poifs.eventfilesystem.POIFSReader;
* @author Rainer Klute <a * @author Rainer Klute <a
* href="mailto:klute@rainer-klute.de">&lt;klute@rainer-klute.de&gt;</a> * href="mailto:klute@rainer-klute.de">&lt;klute@rainer-klute.de&gt;</a>
*/ */
@SuppressWarnings("serial")
public class POIBrowser extends JFrame public class POIBrowser extends JFrame
{ {
@ -99,7 +100,7 @@ public class POIBrowser extends JFrame
{ {
System.err.println(filename + ": " + ex); System.err.println(filename + ": " + ex);
} }
catch (Throwable t) catch (Exception t)
{ {
System.err.println("Unexpected exception while reading \"" + System.err.println("Unexpected exception while reading \"" +
filename + "\":"); filename + "\":");

View File

@ -70,7 +70,7 @@ public class TreeReaderListener implements POIFSReaderListener
* <p>Maps filenames and POI document paths to their associated * <p>Maps filenames and POI document paths to their associated
* tree nodes.</p> * tree nodes.</p>
*/ */
protected Map pathToNode; protected Map<Object,MutableTreeNode> pathToNode;
/** /**
* <p>The name of the file this {@link TreeReaderListener} * <p>The name of the file this {@link TreeReaderListener}
@ -99,7 +99,7 @@ public class TreeReaderListener implements POIFSReaderListener
{ {
this.filename = filename; this.filename = filename;
this.rootNode = rootNode; 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(), d = new DocumentDescriptor(event.getName(), event.getPath(),
is, nrOfBytes); is, nrOfBytes);
} }
catch (Throwable t) catch (Exception t)
{ {
System.err.println System.err.println
("Unexpected exception while processing " + ("Unexpected exception while processing " +

View File

@ -175,7 +175,7 @@ public class ExcelAntTask extends Task {
try { try {
Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook"); Class.forName("org.apache.poi.hssf.usermodel.HSSFWorkbook");
Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory"); Class.forName("org.apache.poi.ss.usermodel.WorkbookFactory");
} catch (Throwable e) { } catch (Exception e) {
throw new BuildException( throw new BuildException(
"The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " + "The <classpath> for <excelant> must include poi.jar and poi-ooxml.jar " +
"if not in Ant's own classpath. Processing .xlsx spreadsheets requires " + "if not in Ant's own classpath. Processing .xlsx spreadsheets requires " +

View File

@ -120,4 +120,8 @@ public class CustomProperty extends MutableProperty
return (int) this.getID(); return (int) this.getID();
} }
@Override
public boolean equals(Object o) {
return (o instanceof CustomProperty) ? equalsContents(o) : false;
}
} }

View File

@ -72,9 +72,21 @@ public final class WorkbookRecordList implements Iterable<Record> {
return records.iterator(); 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 ) { public void remove( Object record ) {
int i = records.indexOf(record); // can't use List.indexOf here because it checks the records for equality and not identity
this.remove(i); int i = 0;
for (Record r : records) {
if (r == record) {
remove(i);
break;
}
i++;
}
} }
public void remove( int pos ) public void remove( int pos )

View File

@ -475,7 +475,15 @@ public final class FontRecord extends StandardRecord {
field_7_family == other.field_7_family && field_7_family == other.field_7_family &&
field_8_charset == other.field_8_charset && field_8_charset == other.field_8_charset &&
field_9_zero == other.field_9_zero && 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)));
}
} }

View File

@ -18,7 +18,13 @@
package org.apache.poi.poifs.property; package org.apache.poi.poifs.property;
import java.io.IOException; 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 * Directory property
@ -117,18 +123,6 @@ public class DirectoryProperty extends Property implements Parent { // TODO - fi
public static class PropertyComparator implements Comparator<Property> { 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 * compare method. Assumes both parameters are non-null
* instances of Property. One property is less than another if * instances of Property. One property is less than another if

View File

@ -52,7 +52,7 @@ public final class OOXMLLite {
try { try {
_classes = ClassLoader.class.getDeclaredField("classes"); _classes = ClassLoader.class.getDeclaredField("classes");
_classes.setAccessible(true); _classes.setAccessible(true);
} catch (Throwable e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }

View File

@ -17,8 +17,13 @@
package org.apache.poi.hdf.extractor; package org.apache.poi.hdf.extractor;
import java.io.*; import java.io.FileNotFoundException;
import java.util.*; 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 * Comment me
@ -38,8 +43,8 @@ public final class NewOleFile extends RandomAccessFile
private int[] _bbd_list; private int[] _bbd_list;
protected int[] _big_block_depot; protected int[] _big_block_depot;
protected int[] _small_block_depot; protected int[] _small_block_depot;
Hashtable _propertySetsHT = new Hashtable(); Map<String,PropertySet> _propertySetsHT = new HashMap<String,PropertySet>();
Vector _propertySetsV = new Vector(); List<PropertySet> _propertySetsV = new ArrayList<PropertySet>();
public NewOleFile(String fileName, String mode) throws FileNotFoundException public NewOleFile(String fileName, String mode) throws FileNotFoundException
{ {
@ -48,12 +53,13 @@ public final class NewOleFile extends RandomAccessFile
{ {
init(); init();
} }
catch(Throwable e) catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
@SuppressWarnings("unused")
private void init() throws IOException private void init() throws IOException
{ {
@ -101,6 +107,7 @@ public final class NewOleFile extends RandomAccessFile
initializePropertySets(rootChain); initializePropertySets(rootChain);
} }
@SuppressWarnings("unused")
public static void main(String args[]) public static void main(String args[])
{ {
try try

View File

@ -17,7 +17,7 @@
package org.apache.poi.hdf.extractor; package org.apache.poi.hdf.extractor;
import java.util.*; import java.util.ArrayList;
/** /**
* Comment me * Comment me
@ -28,9 +28,9 @@ import java.util.*;
public final class TableRow public final class TableRow
{ {
TAP _descriptor; TAP _descriptor;
ArrayList _cells; ArrayList<String> _cells;
public TableRow(ArrayList cells, TAP descriptor) public TableRow(ArrayList<String> cells, TAP descriptor)
{ {
_cells = cells; _cells = cells;
_descriptor = descriptor; _descriptor = descriptor;
@ -39,7 +39,7 @@ public final class TableRow
{ {
return _descriptor; return _descriptor;
} }
public ArrayList getCells() public ArrayList<String> getCells()
{ {
return _cells; return _cells;
} }

View File

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

View File

@ -24,7 +24,19 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.poi.hdf.event.HDFLowLevelParsingListener; 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.hdf.model.util.ParsingState;
import org.apache.poi.poifs.filesystem.DocumentEntry; import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@ -56,6 +68,7 @@ public final class HDFObjectFactory {
byte[] _tableBuffer; byte[] _tableBuffer;
@SuppressWarnings("unused")
public static void main(String args[]) public static void main(String args[])
{ {
try try
@ -63,7 +76,7 @@ public final class HDFObjectFactory {
HDFObjectFactory f = new HDFObjectFactory(new FileInputStream("c:\\test.doc")); HDFObjectFactory f = new HDFObjectFactory(new FileInputStream("c:\\test.doc"));
int k = 0; int k = 0;
} }
catch(Throwable t) catch(Exception t)
{ {
t.printStackTrace(); t.printStackTrace();
} }
@ -115,9 +128,9 @@ public final class HDFObjectFactory {
this(istream, null); 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 //do Ole stuff
POIFSFileSystem filesystem = new POIFSFileSystem(istream); POIFSFileSystem filesystem = new POIFSFileSystem(istream);
@ -355,6 +368,7 @@ public final class HDFObjectFactory {
/** /**
* intializes the Paragraph Properties BTree * intializes the Paragraph Properties BTree
*/ */
@SuppressWarnings("unused")
private void initParagraphProperties() private void initParagraphProperties()
{ {
//paragraphs //paragraphs
@ -458,6 +472,7 @@ public final class HDFObjectFactory {
/** /**
* initializes the SectionProperties BTree * initializes the SectionProperties BTree
*/ */
@SuppressWarnings("unused")
private void initSectionProperties() private void initSectionProperties()
{ {

View File

@ -17,9 +17,12 @@
package org.apache.poi.hwpf; 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 public final class QuickTest
{ {
@ -80,7 +83,7 @@ public final class QuickTest
// } // }
} }
catch (Throwable t) catch (Exception t)
{ {
t.printStackTrace(); t.printStackTrace();
} }

View File

@ -368,7 +368,7 @@ public class WordToTextConverter extends AbstractWordConverter
DirectoryNode.class ); DirectoryNode.class );
extractor = createExtractor.invoke( null, directoryNode ); extractor = createExtractor.invoke( null, directoryNode );
} }
catch ( Error exc ) catch ( Exception exc )
{ {
// no extractor in classpath // no extractor in classpath
logger.log( POILogger.WARN, "There is an OLE object entry '", logger.log( POILogger.WARN, "There is an OLE object entry '",