findbugs fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749238 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e08786d49e
commit
3a4754de98
@ -60,7 +60,7 @@ public interface IconMultiStateFormatting {
|
||||
protected static final IconSet DEFAULT_ICONSET = IconSet.GYR_3_TRAFFIC_LIGHTS;
|
||||
|
||||
/** Numeric ID of the icon set */
|
||||
public int id;
|
||||
public final int id;
|
||||
/** How many icons in the set */
|
||||
public final int num;
|
||||
/** Name (system) of the set */
|
||||
|
@ -79,7 +79,9 @@ final class XSSFEvaluationSheet implements EvaluationSheet {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
if (!(obj instanceof CellKey)) {
|
||||
return false;
|
||||
}
|
||||
// assumes other object is one of us, otherwise ClassCastException is thrown
|
||||
final CellKey oKey = (CellKey) obj;
|
||||
return _row == oKey._row && _col == oKey._col;
|
||||
|
@ -221,16 +221,17 @@ public final class HWPFDocument extends HWPFDocumentCore
|
||||
_fib.fillVariableFields(_mainStream, _tableStream);
|
||||
|
||||
// read in the data stream.
|
||||
try
|
||||
{
|
||||
DocumentEntry dataProps =
|
||||
(DocumentEntry)directory.getEntry(STREAM_DATA);
|
||||
_dataStream = new byte[dataProps.getSize()];
|
||||
directory.createDocumentInputStream(STREAM_DATA).read(_dataStream);
|
||||
}
|
||||
catch(java.io.FileNotFoundException e)
|
||||
{
|
||||
InputStream dis = null;
|
||||
try {
|
||||
DocumentEntry dataProps = (DocumentEntry)directory.getEntry(STREAM_DATA);
|
||||
dis = directory.createDocumentInputStream(STREAM_DATA);
|
||||
_dataStream = IOUtils.toByteArray(dis, dataProps.getSize());
|
||||
} catch(IOException e) {
|
||||
_dataStream = new byte[0];
|
||||
} finally {
|
||||
if (dis != null) {
|
||||
dis.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Get the cp of the start of text in the main stream
|
||||
|
@ -37,6 +37,7 @@ import org.apache.poi.hwpf.usermodel.Range;
|
||||
import org.apache.poi.poifs.filesystem.DirectoryEntry;
|
||||
import org.apache.poi.poifs.filesystem.DirectoryNode;
|
||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
||||
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.Internal;
|
||||
@ -147,11 +148,16 @@ public abstract class HWPFDocumentCore extends POIDocument
|
||||
super(directory);
|
||||
|
||||
// read in the main stream.
|
||||
DocumentEntry documentProps = (DocumentEntry)
|
||||
directory.getEntry("WordDocument");
|
||||
_mainStream = new byte[documentProps.getSize()];
|
||||
|
||||
directory.createDocumentInputStream(STREAM_WORD_DOCUMENT).read(_mainStream);
|
||||
DocumentEntry documentProps = (DocumentEntry)directory.getEntry("WordDocument");
|
||||
DocumentInputStream dis = null;
|
||||
try {
|
||||
dis = directory.createDocumentInputStream(STREAM_WORD_DOCUMENT);
|
||||
_mainStream = IOUtils.toByteArray(dis, documentProps.getSize());
|
||||
} finally {
|
||||
if (dis != null) {
|
||||
dis.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Create our FIB, and check for the doc being encrypted
|
||||
_fib = new FileInformationBlock(_mainStream);
|
||||
|
Loading…
Reference in New Issue
Block a user