FindBugs - DLS_DEAD_LOCAL_STORE

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1696038 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2015-08-15 11:57:57 +00:00
parent 2df37edbae
commit 05c92b7a19
34 changed files with 139 additions and 1551 deletions

View File

@ -135,7 +135,6 @@ public class EscherComplexProperty extends EscherProperty {
}
public String toXml(String tab){
String dataStr = HexDump.toHex( _complexData, 32);
StringBuilder builder = new StringBuilder();
builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId()))
.append("\" name=\"").append(getName()).append("\" blipId=\"")

View File

@ -73,14 +73,12 @@ public final class EscherDump {
short options; // 4 bits for the version and 12 bits for the instance
short recordId;
int recordBytesRemaining; // including enclosing records
StringBuffer stringBuf = new StringBuffer();
short nDumpSize;
String recordName;
boolean atEOF = false;
while (!atEOF && (remainingBytes > 0)) {
stringBuf = new StringBuffer();
options = LittleEndian.readShort( in );
recordId = LittleEndian.readShort( in );
recordBytesRemaining = LittleEndian.readInt( in );
@ -194,6 +192,7 @@ public final class EscherDump {
recordName = "UNKNOWN ID";
}
StringBuilder stringBuf = new StringBuilder();
stringBuf.append( " " );
stringBuf.append( HexDump.toHex( recordId ) );
stringBuf.append( " " ).append( recordName ).append( " [" );
@ -203,6 +202,7 @@ public final class EscherDump {
stringBuf.append( "] instance: " );
stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) );
out.println( stringBuf.toString() );
stringBuf.setLength(0);
if ( recordId == (short) 0xF007 && 36 <= remainingBytes && 36 <= recordBytesRemaining )
@ -213,7 +213,7 @@ public final class EscherDump {
// short n16;
// int n32;
stringBuf = new StringBuffer( " btWin32: " );
stringBuf = stringBuf.append( " btWin32: " );
n8 = (byte) in.read();
stringBuf.append( HexDump.toHex( n8 ) );
stringBuf.append( getBlipType( n8 ) );

View File

@ -55,7 +55,6 @@ public class LineShape
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherRecord anchor = new EscherClientAnchorRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
spContainer.setRecordId( EscherContainerRecord.SP_CONTAINER );
@ -74,7 +73,7 @@ public class LineShape
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
if (userAnchor.isVerticallyFlipped())
sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
anchor = createAnchor(userAnchor);
EscherRecord anchor = createAnchor(userAnchor);
clientData.setRecordId( EscherClientDataRecord.RECORD_ID );
clientData.setOptions( (short) 0x0000 );

View File

@ -130,8 +130,6 @@ public class PolygonShape
*/
private ObjRecord createObjRecord( HSSFShape hssfShape, int shapeId )
{
HSSFShape shape = hssfShape;
ObjRecord obj = new ObjRecord();
CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
c.setObjectType( OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING );

View File

@ -84,7 +84,6 @@ public class TextboxShape
EscherContainerRecord spContainer = new EscherContainerRecord();
EscherSpRecord sp = new EscherSpRecord();
EscherOptRecord opt = new EscherOptRecord();
EscherRecord anchor = new EscherClientAnchorRecord();
EscherClientDataRecord clientData = new EscherClientDataRecord();
escherTextbox = new EscherTextboxRecord();
@ -113,7 +112,7 @@ public class TextboxShape
// sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPHORIZ);
// if (userAnchor.isVerticallyFlipped())
// sp.setFlags(sp.getFlags() | EscherSpRecord.FLAG_FLIPVERT);
anchor = createAnchor( userAnchor );
EscherRecord anchor = createAnchor( userAnchor );
clientData.setRecordId( EscherClientDataRecord.RECORD_ID );
clientData.setOptions( (short) 0x0000 );
escherTextbox.setRecordId( EscherTextboxRecord.RECORD_ID );

View File

@ -507,7 +507,7 @@ public final class HyperlinkRecord extends StandardRecord {
//From the spec: An optional unsigned integer that MUST be 3 if present
// but some files has 4
int usKeyValue = in.readUShort();
/*int usKeyValue = */ in.readUShort();
_address = StringUtil.readUnicodeLE(in, charDataSize/2);
} else {

View File

@ -72,21 +72,12 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
private HSSFFontFormatting getFontFormatting(boolean create) {
FontFormatting fontFormatting = cfRuleRecord.getFontFormatting();
if ( fontFormatting != null)
{
cfRuleRecord.setFontFormatting(fontFormatting);
return new HSSFFontFormatting(cfRuleRecord, workbook);
}
else if( create )
{
if (fontFormatting == null) {
if (!create) return null;
fontFormatting = new FontFormatting();
cfRuleRecord.setFontFormatting(fontFormatting);
return new HSSFFontFormatting(cfRuleRecord, workbook);
}
else
{
return null;
}
return new HSSFFontFormatting(cfRuleRecord, workbook);
}
/**
@ -106,22 +97,14 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
private HSSFBorderFormatting getBorderFormatting(boolean create) {
BorderFormatting borderFormatting = cfRuleRecord.getBorderFormatting();
if ( borderFormatting != null)
{
cfRuleRecord.setBorderFormatting(borderFormatting);
return new HSSFBorderFormatting(cfRuleRecord, workbook);
}
else if( create )
{
if (borderFormatting == null) {
if (!create) return null;
borderFormatting = new BorderFormatting();
cfRuleRecord.setBorderFormatting(borderFormatting);
return new HSSFBorderFormatting(cfRuleRecord, workbook);
}
else
{
return null;
}
return new HSSFBorderFormatting(cfRuleRecord, workbook);
}
/**
* @return - border formatting object if defined, <code>null</code> otherwise
*/
@ -137,24 +120,14 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
return getBorderFormatting(true);
}
private HSSFPatternFormatting getPatternFormatting(boolean create)
{
private HSSFPatternFormatting getPatternFormatting(boolean create) {
PatternFormatting patternFormatting = cfRuleRecord.getPatternFormatting();
if ( patternFormatting != null)
{
cfRuleRecord.setPatternFormatting(patternFormatting);
return new HSSFPatternFormatting(cfRuleRecord, workbook);
}
else if( create )
{
if (patternFormatting == null) {
if (!create) return null;
patternFormatting = new PatternFormatting();
cfRuleRecord.setPatternFormatting(patternFormatting);
return new HSSFPatternFormatting(cfRuleRecord, workbook);
}
else
{
return null;
}
return new HSSFPatternFormatting(cfRuleRecord, workbook);
}
/**
@ -176,21 +149,17 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
private HSSFDataBarFormatting getDataBarFormatting(boolean create) {
CFRule12Record cfRule12Record = getCFRule12Record(create);
if (cfRule12Record == null) return null;
DataBarFormatting databarFormatting = cfRule12Record.getDataBarFormatting();
if (databarFormatting != null)
{
return new HSSFDataBarFormatting(cfRule12Record, sheet);
}
else if( create )
{
databarFormatting = cfRule12Record.createDataBarFormatting();
return new HSSFDataBarFormatting(cfRule12Record, sheet);
}
else
{
return null;
if (databarFormatting == null) {
if (!create) return null;
cfRule12Record.createDataBarFormatting();
}
return new HSSFDataBarFormatting(cfRule12Record, sheet);
}
/**
* @return databar / data-bar formatting object if defined, <code>null</code> otherwise
*/
@ -207,21 +176,16 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
private HSSFIconMultiStateFormatting getMultiStateFormatting(boolean create) {
CFRule12Record cfRule12Record = getCFRule12Record(create);
if (cfRule12Record == null) return null;
IconMultiStateFormatting iconFormatting = cfRule12Record.getMultiStateFormatting();
if (iconFormatting != null)
{
return new HSSFIconMultiStateFormatting(cfRule12Record, sheet);
}
else if( create )
{
iconFormatting = cfRule12Record.createMultiStateFormatting();
return new HSSFIconMultiStateFormatting(cfRule12Record, sheet);
}
else
{
return null;
if (iconFormatting == null) {
if (!create) return null;
cfRule12Record.createMultiStateFormatting();
}
return new HSSFIconMultiStateFormatting(cfRule12Record, sheet);
}
/**
* @return icon / multi-state formatting object if defined, <code>null</code> otherwise
*/
@ -238,21 +202,17 @@ public final class HSSFConditionalFormattingRule implements ConditionalFormattin
private HSSFColorScaleFormatting getColorScaleFormatting(boolean create) {
CFRule12Record cfRule12Record = getCFRule12Record(create);
if (cfRule12Record == null) return null;
ColorGradientFormatting colorFormatting = cfRule12Record.getColorGradientFormatting();
if (colorFormatting != null)
{
return new HSSFColorScaleFormatting(cfRule12Record, sheet);
}
else if( create )
{
colorFormatting = cfRule12Record.createColorGradientFormatting();
return new HSSFColorScaleFormatting(cfRule12Record, sheet);
}
else
{
return null;
if (colorFormatting == null) {
if (!create) return null;
cfRule12Record.createColorGradientFormatting();
}
return new HSSFColorScaleFormatting(cfRule12Record, sheet);
}
/**
* @return color scale / gradient formatting object if defined, <code>null</code> otherwise
*/

View File

@ -148,7 +148,6 @@ public final class HSSFName implements Name {
// Update our comment, if there is one
if(_commentRec != null) {
String oldName = _commentRec.getNameText();
_commentRec.setNameText(nameName);
_book.getWorkbook().updateNameCommentRecordCache(_commentRec);
}

View File

@ -36,7 +36,6 @@ import org.apache.poi.hssf.record.DrawingRecord;
import org.apache.poi.hssf.record.EscherAggregate;
import org.apache.poi.hssf.record.ExtendedFormatRecord;
import org.apache.poi.hssf.record.NameRecord;
import org.apache.poi.hssf.record.NoteRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.RowRecord;
import org.apache.poi.hssf.record.SCLRecord;
@ -1448,11 +1447,8 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
return;
}
NoteRecord[] noteRecs;
if (moveComments) {
noteRecs = _sheet.getNoteRecords();
} else {
noteRecs = NoteRecord.EMPTY_ARRAY;
_sheet.getNoteRecords();
}
shiftMerged(startRow, endRow, n, true);

View File

@ -95,8 +95,7 @@ public class DataSpaceMapUtils {
}
public DataSpaceMap(LittleEndianInput is) {
@SuppressWarnings("unused")
int length = is.readInt();
/*int length = */ is.readInt();
int entryCount = is.readInt();
entries = new DataSpaceMapEntry[entryCount];
for (int i=0; i<entryCount; i++) {
@ -125,8 +124,7 @@ public class DataSpaceMapUtils {
}
public DataSpaceMapEntry(LittleEndianInput is) {
@SuppressWarnings("unused")
int length = is.readInt();
/*int length = */ is.readInt();
int referenceComponentCount = is.readInt();
referenceComponentType = new int[referenceComponentCount];
referenceComponent = new String[referenceComponentCount];
@ -158,8 +156,7 @@ public class DataSpaceMapUtils {
}
public DataSpaceDefinition(LittleEndianInput is) {
@SuppressWarnings("unused")
int headerLength = is.readInt();
/* int headerLength = */ is.readInt();
int transformReferenceCount = is.readInt();
transformer = new String[transformReferenceCount];
for (int i=0; i<transformReferenceCount; i++) {
@ -230,8 +227,7 @@ public class DataSpaceMapUtils {
}
public TransformInfoHeader(LittleEndianInput is) {
@SuppressWarnings("unused")
int length = is.readInt();
/* int length = */ is.readInt();
transformType = is.readInt();
transformerId = readUnicodeLPP4(is);
transformerName = readUnicodeLPP4(is);

View File

@ -197,7 +197,6 @@ public class CryptoAPIDecryptor extends Decryptor {
*
* @see <a href="http://msdn.microsoft.com/en-us/library/dd943321(v=office.12).aspx">2.3.5.4 RC4 CryptoAPI Encrypted Summary Stream</a>
*/
@SuppressWarnings("unused")
public InputStream getDataStream(DirectoryNode dir)
throws IOException, GeneralSecurityException {
NPOIFSFileSystem fsOut = new NPOIFSFileSystem();
@ -209,7 +208,7 @@ public class CryptoAPIDecryptor extends Decryptor {
SeekableByteArrayInputStream sbis = new SeekableByteArrayInputStream(bos.toByteArray());
LittleEndianInputStream leis = new LittleEndianInputStream(sbis);
int streamDescriptorArrayOffset = (int) leis.readUInt();
int streamDescriptorArraySize = (int) leis.readUInt();
/* int streamDescriptorArraySize = (int) */ leis.readUInt();
sbis.skip(streamDescriptorArrayOffset - 8);
sbis.setBlock(0);
int encryptedStreamDescriptorCount = (int) leis.readUInt();
@ -222,7 +221,7 @@ public class CryptoAPIDecryptor extends Decryptor {
entry.block = leis.readUShort();
int nameSize = leis.readUByte();
entry.flags = leis.readUByte();
boolean isStream = StreamDescriptorEntry.flagStream.isSet(entry.flags);
// boolean isStream = StreamDescriptorEntry.flagStream.isSet(entry.flags);
entry.reserved2 = leis.readInt();
entry.streamName = StringUtil.readUnicodeLE(leis, nameSize);
leis.readShort();

View File

@ -35,11 +35,10 @@ public class CryptoAPIEncryptionInfoBuilder implements EncryptionInfoBuilder {
/**
* initialize the builder from a stream
*/
@SuppressWarnings("unused")
public void initialize(EncryptionInfo info, LittleEndianInput dis)
throws IOException {
this.info = info;
int hSize = dis.readInt();
/* int hSize = */ dis.readInt();
header = new CryptoAPIEncryptionHeader(dis);
verifier = new CryptoAPIEncryptionVerifier(dis, header);
decryptor = new CryptoAPIDecryptor(this);

View File

@ -40,8 +40,7 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder {
public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {
this.info = info;
@SuppressWarnings("unused")
int hSize = dis.readInt();
/* int hSize = */ dis.readInt();
header = new StandardEncryptionHeader(dis);
verifier = new StandardEncryptionVerifier(dis, header);

View File

@ -101,10 +101,10 @@ public class DrawTextParagraph<T extends TextRun> implements Drawable {
indent -= leftMargin;
}
Double rightMargin = paragraph.getRightMargin();
if (rightMargin == null) {
rightMargin = 0d;
}
// Double rightMargin = paragraph.getRightMargin();
// if (rightMargin == null) {
// rightMargin = 0d;
// }
//The vertical line spacing
Double spacing = paragraph.getLineSpacing();

View File

@ -63,7 +63,7 @@ public class PresetGeometries extends LinkedHashMap<String, CustomGeometry> {
XMLEventReader staxReader = staxFactory.createXMLEventReader(is);
XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter);
// ignore StartElement:
XMLEvent evDoc = staxFiltRd.nextEvent();
/* XMLEvent evDoc = */ staxFiltRd.nextEvent();
// JAXB:
JAXBContext jaxbContext = JAXBContext.newInstance(BINDING_PACKAGE);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

View File

@ -69,14 +69,14 @@ public class Address implements Function {
throw new EvaluationException(ErrorEval.VALUE_INVALID);
}
boolean a1;
if(args.length > 3){
ValueEval ve = OperandResolver.getSingleValue(args[3], srcRowIndex, srcColumnIndex);
// TODO R1C1 style is not yet supported
a1 = ve == MissingArgEval.instance ? true : OperandResolver.coerceValueToBoolean(ve, false);
} else {
a1 = true;
}
// boolean a1;
// if(args.length > 3){
// ValueEval ve = OperandResolver.getSingleValue(args[3], srcRowIndex, srcColumnIndex);
// // TODO R1C1 style is not yet supported
// a1 = ve == MissingArgEval.instance ? true : OperandResolver.coerceValueToBoolean(ve, false);
// } else {
// a1 = true;
// }
String sheetName;
if(args.length == 5){

View File

@ -68,7 +68,7 @@ public class Office2010SignatureFacet extends SignatureFacet {
}
UnsignedSignaturePropertiesType unsignedSigProps = unsignedProps.getUnsignedSignatureProperties();
if (unsignedSigProps == null) {
unsignedSigProps = unsignedProps.addNewUnsignedSignatureProperties();
/* unsignedSigProps = */ unsignedProps.addNewUnsignedSignatureProperties();
}
Node n = document.importNode(qualProps.getDomNode().getFirstChild(), true);

File diff suppressed because it is too large Load Diff

View File

@ -187,7 +187,7 @@ public final class XmlSort
* The constructor accepts an argument indicating whether the comparison order is the same as
* the lexicographic order of the strings or the reverse.
*/
public static final class QNameComparator implements Comparator
public static final class QNameComparator implements Comparator<XmlCursor>
{
public static final int ASCENDING = 1;
public static final int DESCENDING = 2;
@ -202,10 +202,7 @@ public final class XmlSort
"comparison orders");
}
public int compare(Object o, Object o1)
{
XmlCursor cursor1 = (XmlCursor) o;
XmlCursor cursor2 = (XmlCursor) o1;
public int compare(XmlCursor cursor1, XmlCursor cursor2) {
QName qname1 = cursor1.getName();
QName qname2 = cursor2.getName();
int qnameComparisonRes = qname1.getNamespaceURI().compareTo(qname2.getNamespaceURI());

View File

@ -21,7 +21,6 @@ package org.apache.poi.xslf.usermodel;
import org.apache.poi.sl.usermodel.ConnectorShape;
import org.apache.poi.util.Beta;
import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
@ -44,7 +43,6 @@ public class XSLFConnectorShape extends XSLFSimpleShape implements ConnectorShap
/**
* @param shapeId 1-based shapeId
*/
@SuppressWarnings("unused")
static CTConnector prototype(int shapeId) {
CTConnector ct = CTConnector.Factory.newInstance();
CTConnectorNonVisual nvSpPr = ct.addNewNvCxnSpPr();
@ -57,7 +55,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape implements ConnectorShap
CTPresetGeometry2D prst = spPr.addNewPrstGeom();
prst.setPrst(STShapeType.LINE);
prst.addNewAvLst();
CTLineProperties ln = spPr.addNewLn();
/* CTLineProperties ln = */ spPr.addNewLn();
return ct;
}

View File

@ -23,7 +23,12 @@ import javax.xml.namespace.QName;
import org.apache.poi.util.Internal;
import org.apache.xmlbeans.XmlCursor;
import org.openxmlformats.schemas.drawingml.x2006.main.*;
import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData;
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrame;
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTGraphicalObjectFrameNonVisual;
import org.openxmlformats.schemas.officeDocument.x2006.relationships.STRelationshipId;
@ -79,7 +84,7 @@ public final class XSSFGraphicFrame extends XSSFShape {
offPoint.setX(0);
offPoint.setY(0);
CTGraphicalObject graphic = graphicFrame.addNewGraphic();
/* CTGraphicalObject graphic = */ graphicFrame.addNewGraphic();
prototype = graphicFrame;
}

View File

@ -94,7 +94,6 @@ public final class NewOleFile extends RandomAccessFile
int counter = 0;
for(int x = 0; x < _num_bbd_blocks; x++)
{
byte[] bigBlock = new byte[512];
int offset = (_bbd_list[x] + 1) * 512;
seek(offset);
for(int y = 0; y < 128; y++)
@ -107,17 +106,12 @@ public final class NewOleFile extends RandomAccessFile
initializePropertySets(rootChain);
}
@SuppressWarnings("unused")
public static void main(String args[])
{
try
{
NewOleFile file = new NewOleFile(args[0], "r");
}
catch(Exception e)
{
}
public static void main(String args[]) throws Exception {
NewOleFile nof = new NewOleFile(args[0], "r");
nof.close();
}
protected int[] readChain(int[] blockChain, int startBlock) {
int[] tempChain = new int[blockChain.length];

View File

@ -784,7 +784,6 @@ public final class WordDocument {
return context.getFontMetrics(font);
}*/
@SuppressWarnings("unused")
private String createRegion(boolean before, HeaderFooter header, SEP sep, String name)
{
if(header.isEmpty())
@ -820,8 +819,8 @@ public final class WordDocument {
sep._dyaBottom = Math.max(extent*20, sep._dyaBottom);
}
int marginLeft = sep._dxaLeft/20;
int marginRight = sep._dxaRight/20;
//int marginLeft = sep._dxaLeft/20;
//int marginRight = sep._dxaRight/20;
return "<fo:region-" + where + " display-align=\"" + align + "\" extent=\""
+ extent + "pt\" "+region+"/>";

View File

@ -33,11 +33,11 @@ public final class HDFDocument
public HDFDocument(InputStream in, HDFParsingListener listener) throws IOException
{
EventBridge eb = new EventBridge(listener);
HDFObjectFactory factory = new HDFObjectFactory(in, eb);
/* HDFObjectFactory factory = */ new HDFObjectFactory(in, eb);
}
public HDFDocument(InputStream in) throws IOException
{
_model = new HDFObjectModel();
HDFObjectFactory factory = new HDFObjectFactory(in, _model);
/* HDFObjectFactory factory = */ new HDFObjectFactory(in, _model);
}
}

View File

@ -68,19 +68,10 @@ public final class HDFObjectFactory {
byte[] _tableBuffer;
@SuppressWarnings("unused")
public static void main(String args[])
{
try
{
HDFObjectFactory f = new HDFObjectFactory(new FileInputStream("c:\\test.doc"));
int k = 0;
}
catch(Exception t)
{
t.printStackTrace();
}
public static void main(String args[]) throws Exception {
new HDFObjectFactory(new FileInputStream("c:\\test.doc"));
}
/** Creates a new instance of HDFObjectFactory
*
* @param istream The InputStream that is the Word document
@ -133,19 +124,23 @@ public final class HDFObjectFactory {
List<FileInformationBlock> results = new ArrayList<FileInformationBlock>(1);
//do Ole stuff
POIFSFileSystem filesystem = new POIFSFileSystem(istream);
DocumentEntry headerProps =
(DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
byte[] mainDocument = new byte[headerProps.getSize()];
filesystem.createDocumentInputStream("WordDocument").read(mainDocument);
FileInformationBlock fib = new FileInformationBlock(mainDocument);
results.add(fib);
return results;
POIFSFileSystem filesystem = null;
try {
filesystem = new POIFSFileSystem(istream);
DocumentEntry headerProps =
(DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
byte[] mainDocument = new byte[headerProps.getSize()];
filesystem.createDocumentInputStream("WordDocument").read(mainDocument);
FileInformationBlock fib = new FileInformationBlock(mainDocument);
results.add(fib);
return results;
} finally {
if (filesystem != null) filesystem.close();
}
}
@ -477,7 +472,7 @@ public final class HDFObjectFactory {
{
int ccpText = _fib.getCcpText();
int ccpFtn = _fib.getCcpFtn();
// int ccpFtn = _fib.getCcpFtn();
//sections
int fcMin = _fib.getFcMin();

View File

@ -329,15 +329,14 @@ public final class StyleSheet implements HDFType {
newCHP.setIco((byte)0);
break;
case 0x33:
try
{
newCHP = (CharacterProperties)oldCHP.clone();
}
catch(CloneNotSupportedException e)
{
//do nothing
}
return;
// ... this code has no effect ...
// try {
// newCHP = (CharacterProperties)oldCHP.clone();
// }
// catch(CloneNotSupportedException e) {
// //do nothing
// }
break;
case 0x34:
break;
case 0x35:

View File

@ -73,8 +73,7 @@ public final class CompressedRTF extends LZWDecompresser {
compressedSize = LittleEndian.readInt(src);
decompressedSize = LittleEndian.readInt(src);
int compressionType = LittleEndian.readInt(src);
@SuppressWarnings("unused")
int dataCRC = LittleEndian.readInt(src);
/* int dataCRC = */ LittleEndian.readInt(src);
// TODO - Handle CRC checking on the output side

View File

@ -301,11 +301,8 @@ public final class HSLFSlideShow implements SlideShow {
// Slides or Notes, and possibly even other odd stuff....
// About the only thing you can say is that the master details are in
// the first SLWT.
SlideAtomsSet[] masterSets = new SlideAtomsSet[0];
if (masterSLWT != null) {
masterSets = masterSLWT.getSlideAtomsSets();
for (SlideAtomsSet sas : masterSets) {
for (SlideAtomsSet sas : masterSLWT.getSlideAtomsSets()) {
Record r = getCoreRecordForSAS(sas);
int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
if (r instanceof org.apache.poi.hslf.record.Slide) {
@ -327,27 +324,27 @@ public final class HSLFSlideShow implements SlideShow {
// Start by finding the notes records to go with the entries in
// notesSLWT
org.apache.poi.hslf.record.Notes[] notesRecords;
SlideAtomsSet[] notesSets = new SlideAtomsSet[0];
Map<Integer,Integer> slideIdToNotes = new HashMap<Integer,Integer>();
if (notesSLWT == null) {
// None
notesRecords = new org.apache.poi.hslf.record.Notes[0];
} else {
// Match up the records and the SlideAtomSets
notesSets = notesSLWT.getSlideAtomsSets();
List<org.apache.poi.hslf.record.Notes> notesRecordsL =
new ArrayList<org.apache.poi.hslf.record.Notes>();
for (int i = 0; i < notesSets.length; i++) {
int idx = -1;
for (SlideAtomsSet notesSet : notesSLWT.getSlideAtomsSets()) {
idx++;
// Get the right core record
Record r = getCoreRecordForSAS(notesSets[i]);
Record r = getCoreRecordForSAS(notesSet);
SlidePersistAtom spa = notesSet.getSlidePersistAtom();
String loggerLoc = "A Notes SlideAtomSet at "+idx+" said its record was at refID "+spa.getRefID();
// Ensure it really is a notes record
if (r == null || r instanceof org.apache.poi.hslf.record.Notes) {
if (r == null) {
logger.log(POILogger.WARN, "A Notes SlideAtomSet at " + i
+ " said its record was at refID "
+ notesSets[i].getSlidePersistAtom().getRefID()
+ ", but that record didn't exist - record ignored.");
logger.log(POILogger.WARN, loggerLoc+", but that record didn't exist - record ignored.");
}
// we need to add also null-records, otherwise the index references to other existing
// don't work anymore
@ -355,14 +352,10 @@ public final class HSLFSlideShow implements SlideShow {
notesRecordsL.add(notesRecord);
// Record the match between slide id and these notes
SlidePersistAtom spa = notesSets[i].getSlidePersistAtom();
int slideId = spa.getSlideIdentifier();
slideIdToNotes.put(slideId, i);
slideIdToNotes.put(slideId, idx);
} else {
logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i
+ " said its record was at refID "
+ notesSets[i].getSlidePersistAtom().getRefID()
+ ", but that was actually a " + r);
logger.log(POILogger.ERROR, loggerLoc+", but that was actually a " + r);
}
}
notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];

View File

@ -221,7 +221,7 @@ public class HSLFSlideShowEncrypted {
cipher.doFinal(pictstream, offset, 8, pictstream, offset);
recInst = fieldRecInst.getValue(LittleEndian.getUShort(pictstream, offset));
recType = LittleEndian.getUShort(pictstream, offset+2);
rlen = (int)LittleEndian.getUInt(pictstream, offset+4);
// rlen = (int)LittleEndian.getUInt(pictstream, offset+4);
offset += 8;
}
@ -299,7 +299,7 @@ public class HSLFSlideShowEncrypted {
// update header data
recInst = fieldRecInst.getValue(LittleEndian.getUShort(pictstream, offset));
recType = LittleEndian.getUShort(pictstream, offset+2);
rlen = (int)LittleEndian.getUInt(pictstream, offset+4);
// rlen = (int) LittleEndian.getUInt(pictstream, offset+4);
cipher.doFinal(pictstream, offset, 8, pictstream, offset);
offset += 8;
}

View File

@ -752,10 +752,10 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFTextRun> {
RecordContainer _txtbox = headerAtom.getParentRecord();
Record[] cr = _txtbox.getChildRecords();
int headerIdx = -1, textIdx = -1, styleIdx = -1;
int /* headerIdx = -1, */ textIdx = -1, styleIdx = -1;
for (int i = 0; i < cr.length; i++) {
Record r = cr[i];
if (r == headerAtom) headerIdx = i;
if (r == headerAtom) ; // headerIdx = i;
else if (r == oldRecord || r == newRecord) textIdx = i;
else if (r == styleAtom) styleIdx = i;
}
@ -763,7 +763,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFTextRun> {
if (textIdx == -1) {
// the old record was never registered, ignore it
_txtbox.addChildAfter(newRecord, headerAtom);
textIdx = headerIdx + 1;
// textIdx = headerIdx + 1;
} else {
// swap not appropriated records - noop if unchanged
cr[textIdx] = newRecord;

View File

@ -112,7 +112,7 @@ public abstract class PropertiesChunk extends Chunk {
return null;
}
if (val instanceof ChunkBasedPropertyValue) {
ChunkBasedPropertyValue cval = (ChunkBasedPropertyValue)val;
// ChunkBasedPropertyValue cval = (ChunkBasedPropertyValue)val;
// TODO Lookup
return Collections.emptyList();
} else {

View File

@ -347,7 +347,7 @@ public final class HWPFDocument extends HWPFDocumentCore
_ft = new FontTable(_tableStream, _fib.getFcSttbfffn(), _fib.getLcbSttbfffn());
int listOffset = _fib.getFcPlfLst();
int lfoOffset = _fib.getFcPlfLfo();
// int lfoOffset = _fib.getFcPlfLfo();
if ( listOffset != 0 && _fib.getLcbPlfLst() != 0 )
{
_lt = new ListTables( _tableStream, listOffset, _fib.getFcPlfLfo(),

View File

@ -40,8 +40,8 @@ public final class StyleDescription implements HDFType
private final static int PARAGRAPH_STYLE = 1;
private final static int CHARACTER_STYLE = 2;
private final static int TABLE_STYLE = 3;
private final static int NUMBERING_STYLE = 4;
// private final static int TABLE_STYLE = 3;
// private final static int NUMBERING_STYLE = 4;
private int _baseLength;
private StdfBase _stdfBase;
@ -86,7 +86,7 @@ public final class StyleDescription implements HDFType
if ( readStdfPost2000 )
{
_stdfPost2000 = new StdfPost2000( std, offset );
offset += StdfPost2000.getSize();
// offset += StdfPost2000.getSize();
}
//first byte(s) of variable length section of std is the length of the

View File

@ -42,10 +42,10 @@ import org.apache.poi.util.LittleEndian;
public final class StyleSheet implements HDFType {
public static final int NIL_STYLE = 4095;
private static final int PAP_TYPE = 1;
private static final int CHP_TYPE = 2;
private static final int SEP_TYPE = 4;
private static final int TAP_TYPE = 5;
// private static final int PAP_TYPE = 1;
// private static final int CHP_TYPE = 2;
// private static final int SEP_TYPE = 4;
// private static final int TAP_TYPE = 5;
@Deprecated
private final static ParagraphProperties NIL_PAP = new ParagraphProperties();
@ -144,7 +144,7 @@ public final class StyleSheet implements HDFType {
_stshif.setCstd( _styleDescriptions.length );
_stshif.serialize( buf, offset );
offset += Stshif.getSize();
// offset += Stshif.getSize();
out.write(buf);
@ -156,7 +156,7 @@ public final class StyleSheet implements HDFType {
byte[] std = _styleDescriptions[x].toByteArray();
// adjust the size so it is always on a word boundary
LittleEndian.putShort(sizeHolder, (short)((std.length) + (std.length % 2)));
LittleEndian.putShort(sizeHolder, 0, (short)((std.length) + (std.length % 2)));
out.write(sizeHolder);
out.write(std);