From c828d44a84b1407179014a49fd391b82023e70c5 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Sat, 25 Oct 2014 21:32:03 +0000 Subject: [PATCH] house keeping - fixes for sonarqube blockers git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1634255 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hwpf/Word2Forrest.java | 21 +++-- .../poi/poifs/poibrowser/POIBrowser.java | 3 +- .../poifs/poibrowser/TreeReaderListener.java | 6 +- .../apache/poi/ss/excelant/ExcelAntTask.java | 2 +- .../org/apache/poi/hpsf/CustomProperty.java | 4 + .../poi/hssf/model/WorkbookRecordList.java | 16 +++- .../apache/poi/hssf/record/FontRecord.java | 10 ++- .../poi/poifs/property/DirectoryProperty.java | 20 ++--- .../java/org/apache/poi/util/OOXMLLite.java | 2 +- .../apache/poi/hdf/extractor/NewOleFile.java | 17 ++-- .../apache/poi/hdf/extractor/TableRow.java | 8 +- .../poi/hdf/extractor/WordDocument.java | 85 +++++++++++-------- .../poi/hdf/model/HDFObjectFactory.java | 23 ++++- .../src/org/apache/poi/hwpf/QuickTest.java | 9 +- .../hwpf/converter/WordToTextConverter.java | 2 +- 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 <klute@rainer-klute.de> */ +@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 *

Maps filenames and POI document paths to their associated * tree nodes.

*/ - protected Map pathToNode; + protected Map pathToNode; /** *

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(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 for 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 { 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 @@ -117,18 +123,6 @@ public class DirectoryProperty extends Property implements Parent { // TODO - fi public static class PropertyComparator implements Comparator { - /** - * 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 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 _propertySetsHT = new HashMap(); + List _propertySetsV = new ArrayList(); 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 _cells; - public TableRow(ArrayList cells, TAP descriptor) + public TableRow(ArrayList cells, TAP descriptor) { _cells = cells; _descriptor = descriptor; @@ -39,7 +39,7 @@ public final class TableRow { return _descriptor; } - public ArrayList getCells() + public ArrayList 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 _cells; /** used for XSL-FO table conversion*/ - ArrayList _table; + ArrayList _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 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 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 paragraphs = findProperties(start, end, _paragraphTable.root); int size = paragraphs.size(); - ArrayList lineHeights = new ArrayList(); + ArrayList lineHeights = new ArrayList(); //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 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 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 ""; @@ -859,7 +873,7 @@ public final class WordDocument { { BTreeSet.BTreeNode root = paragraphTable.root; - ArrayList pars = findProperties(start, end, root); + ArrayList 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(); } 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 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 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 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 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(); } 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 findProperties(int start, int end, BTreeSet.BTreeNode root) { - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList(); 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 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 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 afterItems = findProperties(start, end, child); results.addAll(afterItems); } } @@ -1358,9 +1373,10 @@ public final class WordDocument { { buf.append("\r\n"); } - private ArrayList findPAPProperties(int start, int end, BTreeSet.BTreeNode root) + @SuppressWarnings("unused") + private ArrayList findPAPProperties(int start, int end, BTreeSet.BTreeNode root) { - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList(); 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 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 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 afterItems = findPAPProperties(start, end, child); results.addAll(afterItems); } } @@ -1468,6 +1484,7 @@ public final class WordDocument { _headerBuffer.append("\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 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 getTypes(InputStream istream) throws IOException { - List results = new ArrayList(1); + List results = new ArrayList(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 '", -- 2.39.5