Browse Source

fix generic warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144920 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_8_BETA4
Sergey Vladimirov 13 years ago
parent
commit
5a8d3144c2

+ 1
- 2
src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java View File

@@ -37,7 +37,6 @@ import org.apache.poi.hwpf.model.FontTable;
import org.apache.poi.hwpf.model.ListTables;
import org.apache.poi.hwpf.model.PAPBinTable;
import org.apache.poi.hwpf.model.PicturesTable;
import org.apache.poi.hwpf.model.PropertyNode;
import org.apache.poi.hwpf.model.RevisionMarkAuthorTable;
import org.apache.poi.hwpf.model.SavedByTable;
import org.apache.poi.hwpf.model.SectionTable;
@@ -286,7 +285,7 @@ public final class HWPFDocument extends HWPFDocumentCore

public Range getOverallRange() {
// hack to get the ending cp of the document, Have to revisit this.
PropertyNode p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1);
TextPiece p = _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1);

return new Range(0, p.getEnd(), this);
}

+ 3
- 3
src/scratchpad/src/org/apache/poi/hwpf/model/CHPBinTable.java View File

@@ -229,7 +229,7 @@ public class CHPBinTable
int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE;

// get the ending fc
PropertyNode lastRun = (PropertyNode)_textRuns.get(_textRuns.size() - 1);
CHPX lastRun = _textRuns.get(_textRuns.size() - 1);
int endingFc = lastRun.getEnd();
endingFc += fcMin;

@@ -237,7 +237,7 @@ public class CHPBinTable
ArrayList<CHPX> overflow = _textRuns;
do
{
PropertyNode startingProp = (PropertyNode)overflow.get(0);
CHPX startingProp = overflow.get(0);
int start = startingProp.getStart() + fcMin;

CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage();
@@ -250,7 +250,7 @@ public class CHPBinTable
int end = endingFc;
if (overflow != null)
{
end = ((PropertyNode)overflow.get(0)).getStart() + fcMin;
end = overflow.get(0).getStart() + fcMin;
}

byte[] intHolder = new byte[4];

+ 1
- 1
src/scratchpad/src/org/apache/poi/hwpf/model/CHPFormattedDiskPage.java View File

@@ -178,7 +178,7 @@ public final class CHPFormattedDiskPage extends FormattedDiskPage
CHPX chpx = null;
for (int x = 0; x < index; x++)
{
chpx = (CHPX)_chpxList.get(x);
chpx = _chpxList.get(x);
byte[] grpprl = chpx.getGrpprl();

LittleEndian.putInt( buf, fcOffset,

+ 2
- 2
src/scratchpad/src/org/apache/poi/hwpf/model/CachedPropertyNode.java View File

@@ -24,7 +24,7 @@ import org.apache.poi.hwpf.sprm.SprmBuffer;
public final class CachedPropertyNode
extends PropertyNode<CachedPropertyNode>
{
protected SoftReference _propCache;
protected SoftReference<Object> _propCache;

public CachedPropertyNode(int start, int end, SprmBuffer buf)
{
@@ -33,7 +33,7 @@ public final class CachedPropertyNode

protected void fillCache(Object ref)
{
_propCache = new SoftReference(ref);
_propCache = new SoftReference<Object>(ref);
}

protected Object getCacheContents()

+ 7
- 7
src/scratchpad/src/org/apache/poi/hwpf/model/FIBFieldHandler.java View File

@@ -17,13 +17,13 @@

package org.apache.poi.hwpf.model;

import java.util.HashSet;
import java.util.HashMap;
import java.util.Arrays;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import org.apache.poi.hwpf.model.io.HWPFOutputStream;

import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -128,12 +128,12 @@ public final class FIBFieldHandler

private static final int FIELD_SIZE = LittleEndian.INT_SIZE * 2;

private HashMap _unknownMap = new HashMap();
private Map<Integer, UnhandledDataStructure> _unknownMap = new HashMap<Integer, UnhandledDataStructure>();
private int[] _fields;


public FIBFieldHandler(byte[] mainStream, int offset, byte[] tableStream,
HashSet offsetList, boolean areKnown)
HashSet<Integer> offsetList, boolean areKnown)
{
int numFields = LittleEndian.getShort(mainStream, offset);
offset += LittleEndian.SHORT_SIZE;
@@ -208,7 +208,7 @@ public final class FIBFieldHandler

for (int x = 0; x < length; x++)
{
UnhandledDataStructure ds = (UnhandledDataStructure)_unknownMap.get(Integer.valueOf(x));
UnhandledDataStructure ds = _unknownMap.get(Integer.valueOf(x));
if (ds != null)
{
LittleEndian.putInt(mainStream, offset, tableStream.getOffset());

+ 10
- 11
src/scratchpad/src/org/apache/poi/hwpf/model/FSPATable.java View File

@@ -19,7 +19,6 @@ package org.apache.poi.hwpf.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

@@ -30,11 +29,11 @@ import java.util.Map;
*/
public final class FSPATable
{
private final List _shapes = new ArrayList();
private final Map _shapeIndexesByPropertyStart = new HashMap();
private final List _text;
private final List<FSPA> _shapes = new ArrayList<FSPA>();
private final Map<Integer, Integer> _shapeIndexesByPropertyStart = new HashMap<Integer, Integer>();
private final List<TextPiece> _text;

public FSPATable(byte[] tableStream, int fcPlcspa, int lcbPlcspa, List tpt)
public FSPATable(byte[] tableStream, int fcPlcspa, int lcbPlcspa, List<TextPiece> tpt)
{
_text = tpt;
// Will be 0 if no drawing objects in document
@@ -54,11 +53,11 @@ public final class FSPATable

public FSPA getFspaFromCp(int cp)
{
Integer idx = (Integer)_shapeIndexesByPropertyStart.get(Integer.valueOf(cp));
Integer idx = _shapeIndexesByPropertyStart.get(Integer.valueOf(cp));
if (idx == null) {
return null;
}
return (FSPA)_shapes.get(idx.intValue());
return _shapes.get(idx.intValue());
}

public FSPA[] getShapes()
@@ -72,10 +71,10 @@ public final class FSPATable
{
StringBuffer buf = new StringBuffer();
buf.append("[FPSA PLC size=").append(_shapes.size()).append("]\n");
for (Iterator it = _shapeIndexesByPropertyStart.keySet().iterator(); it.hasNext(); )
{
Integer i = (Integer) it.next();
FSPA fspa = (FSPA) _shapes.get(((Integer)_shapeIndexesByPropertyStart.get(i)).intValue());
for (Map.Entry<Integer, Integer> entry: _shapeIndexesByPropertyStart.entrySet()) {
Integer i = entry.getKey();
FSPA fspa = _shapes.get((entry.getValue()).intValue());
buf.append(" [FC: ").append(i.toString()).append("] ");
buf.append(fspa.toString());
buf.append("\n");

+ 3
- 5
src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java View File

@@ -17,12 +17,10 @@

package org.apache.poi.hwpf.model;

import java.util.HashSet;
import java.io.IOException;
import java.util.HashSet;

import org.apache.poi.hwpf.model.io.*;


import org.apache.poi.hwpf.model.io.HWPFOutputStream;
import org.apache.poi.hwpf.model.types.FIBAbstractType;

/**
@@ -57,7 +55,7 @@ public final class FileInformationBlock extends FIBAbstractType

public void fillVariableFields(byte[] mainDocument, byte[] tableStream)
{
HashSet fieldSet = new HashSet();
HashSet<Integer> fieldSet = new HashSet<Integer>();
fieldSet.add(Integer.valueOf(FIBFieldHandler.STSHF));
fieldSet.add(Integer.valueOf(FIBFieldHandler.CLX));
fieldSet.add(Integer.valueOf(FIBFieldHandler.DOP));

+ 5
- 5
src/scratchpad/src/org/apache/poi/hwpf/model/PAPBinTable.java View File

@@ -186,12 +186,12 @@ public class PAPBinTable
public void adjustForInsert(int listIndex, int length)
{
int size = _paragraphs.size();
PAPX papx = (PAPX)_paragraphs.get(listIndex);
PAPX papx = _paragraphs.get(listIndex);
papx.setEnd(papx.getEnd() + length);

for (int x = listIndex + 1; x < size; x++)
{
papx = (PAPX)_paragraphs.get(x);
papx = _paragraphs.get(x);
papx.setStart(papx.getStart() + length);
papx.setEnd(papx.getEnd() + length);
}
@@ -226,14 +226,14 @@ public class PAPBinTable
int pageNum = docOffset/POIFSConstants.SMALLER_BIG_BLOCK_SIZE;

// get the ending fc
int endingFc = ((PropertyNode)_paragraphs.get(_paragraphs.size() - 1)).getEnd();
int endingFc = _paragraphs.get(_paragraphs.size() - 1).getEnd();
endingFc += fcMin;


ArrayList<PAPX> overflow = _paragraphs;
do
{
PropertyNode startingProp = (PropertyNode)overflow.get(0);
PAPX startingProp = overflow.get(0);
int start = startingProp.getStart() + fcMin;

PAPFormattedDiskPage pfkp = new PAPFormattedDiskPage(_dataStream);
@@ -246,7 +246,7 @@ public class PAPBinTable
int end = endingFc;
if (overflow != null)
{
end = ((PropertyNode)overflow.get(0)).getStart() + fcMin;
end = overflow.get(0).getStart() + fcMin;
}

byte[] intHolder = new byte[4];

+ 2
- 3
src/scratchpad/src/org/apache/poi/hwpf/model/SavedByTable.java View File

@@ -22,11 +22,10 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.apache.poi.hwpf.model.io.HWPFOutputStream;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.util.StringUtil;

import org.apache.poi.hwpf.model.io.HWPFOutputStream;

/**
* String table containing the history of the last few revisions ("saves") of the document.
* Read-only for the time being.
@@ -83,7 +82,7 @@ public final class SavedByTable
*
* @return the list of entries.
*/
public List getEntries()
public List<SavedByEntry> getEntries()
{
return Collections.unmodifiableList(Arrays.asList(entries));
}

+ 6
- 6
src/scratchpad/src/org/apache/poi/hwpf/model/ShapesTable.java View File

@@ -23,15 +23,15 @@ import java.util.List;
import org.apache.poi.hwpf.usermodel.Shape;

public final class ShapesTable {
private List _shapes;
private List _shapesVisibili; //holds visible shapes
private List<Shape> _shapes;
private List<Shape> _shapesVisibili; //holds visible shapes

public ShapesTable(byte [] tblStream, FileInformationBlock fib) {
PlexOfCps binTable = new PlexOfCps(tblStream,
fib.getFcPlcspaMom(), fib.getLcbPlcspaMom(), 26);

_shapes = new ArrayList();
_shapesVisibili = new ArrayList();
_shapes = new ArrayList<Shape>();
_shapesVisibili = new ArrayList<Shape>();


for(int i = 0; i < binTable.length(); i++) {
@@ -44,11 +44,11 @@ public final class ShapesTable {
}
}

public List getAllShapes() {
public List<Shape> getAllShapes() {
return _shapes;
}

public List getVisibleShapes() {
public List<Shape> getVisibleShapes() {
return _shapesVisibili;
}
}

+ 2
- 2
src/scratchpad/src/org/apache/poi/hwpf/model/TextPieceTable.java View File

@@ -70,7 +70,7 @@ public class TextPieceTable implements CharIndexTranslator {
// using the PieceDescriptors, build our list of TextPieces.
for (int x = 0; x < pieces.length; x++) {
int start = pieces[x].getFilePosition();
PropertyNode node = pieceTable.getProperty(x);
GenericPropertyNode node = pieceTable.getProperty(x);

// Grab the start and end, which are in characters
int nodeStartChars = node.getStart();
@@ -173,7 +173,7 @@ public class TextPieceTable implements CharIndexTranslator {

// Now change all subsequent ones
for (int x = listIndex + 1; x < size; x++) {
tp = (TextPiece) _textPieces.get(x);
tp = _textPieces.get(x);
tp.setStart(tp.getStart() + length);
tp.setEnd(tp.getEnd() + length);
}

+ 3
- 2
src/scratchpad/src/org/apache/poi/hwpf/model/io/HWPFFileSystem.java View File

@@ -19,10 +19,11 @@ package org.apache.poi.hwpf.model.io;


import java.util.HashMap;
import java.util.Map;

public final class HWPFFileSystem
{
HashMap _streams = new HashMap();
Map<String, HWPFOutputStream> _streams = new HashMap<String, HWPFOutputStream>();

public HWPFFileSystem()
{
@@ -33,7 +34,7 @@ public final class HWPFFileSystem

public HWPFOutputStream getStream(String name)
{
return (HWPFOutputStream)_streams.get(name);
return _streams.get(name);
}

}

+ 2
- 1
src/scratchpad/src/org/apache/poi/hwpf/sprm/CharacterSprmCompressor.java View File

@@ -18,6 +18,7 @@
package org.apache.poi.hwpf.sprm;

import java.util.ArrayList;
import java.util.List;

import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.util.LittleEndian;
@@ -29,7 +30,7 @@ public final class CharacterSprmCompressor
}
public static byte[] compressCharacterProperty(CharacterProperties newCHP, CharacterProperties oldCHP)
{
ArrayList sprmList = new ArrayList();
List<byte[]> sprmList = new ArrayList<byte[]>();
int size = 0;

if (newCHP.isFRMarkDel() != oldCHP.isFRMarkDel())

+ 1
- 1
src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmCompressor.java View File

@@ -35,7 +35,7 @@ public final class ParagraphSprmCompressor
{
// page numbers links to Word97-2007BinaryFileFormat(doc)Specification.pdf, accessible from microsoft.com

List sprmList = new ArrayList();
List<byte[]> sprmList = new ArrayList<byte[]>();
int size = 0;

// Page 50 of public specification begins

+ 7
- 11
src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java View File

@@ -20,7 +20,8 @@ package org.apache.poi.hwpf.sprm;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.DateAndTime;
@@ -426,7 +427,7 @@ public final class ParagraphSprmUncompressor
int[] tabPositions = pap.getRgdxaTab();
byte[] tabDescriptors = pap.getRgtbd();

HashMap tabMap = new HashMap();
Map<Integer, Byte> tabMap = new HashMap<Integer, Byte>();
for (int x = 0; x < tabPositions.length; x++)
{
tabMap.put(Integer.valueOf(tabPositions[x]), Byte.valueOf(tabDescriptors[x]));
@@ -450,20 +451,15 @@ public final class ParagraphSprmUncompressor

tabPositions = new int[tabMap.size()];
tabDescriptors = new byte[tabPositions.length];
ArrayList list = new ArrayList();

Iterator keyIT = tabMap.keySet().iterator();
while (keyIT.hasNext())
{
list.add(keyIT.next());
}
List<Integer> list = new ArrayList<Integer>(tabMap.keySet());
Collections.sort(list);

for (int x = 0; x < tabPositions.length; x++)
{
Integer key = ((Integer)list.get(x));
Integer key = list.get(x);
tabPositions[x] = key.intValue();
tabDescriptors[x] = ((Byte)tabMap.get(key)).byteValue();
tabDescriptors[x] = tabMap.get(key).byteValue();
}

pap.setRgdxaTab(tabPositions);

+ 2
- 1
src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java View File

@@ -19,6 +19,7 @@ package org.apache.poi.hwpf.sprm;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.poi.hwpf.usermodel.SectionProperties;
import org.apache.poi.util.LittleEndian;
@@ -33,7 +34,7 @@ public final class SectionSprmCompressor
public static byte[] compressSectionProperty(SectionProperties newSEP)
{
int size = 0;
ArrayList sprmList = new ArrayList();
List<byte[]> sprmList = new ArrayList<byte[]>();

if (newSEP.getCnsPgn() != DEFAULT_SEP.getCnsPgn())
{

+ 4
- 4
src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java View File

@@ -40,7 +40,7 @@ public final class SprmUtils
return buf;
}

public static int addSpecialSprm(short instruction, byte[] varParam, List list)
public static int addSpecialSprm(short instruction, byte[] varParam, List<byte[]> list)
{
byte[] sprm = new byte[varParam.length + 4];
System.arraycopy(varParam, 0, sprm, 4, varParam.length);
@@ -50,7 +50,7 @@ public final class SprmUtils
return sprm.length;
}

public static int addSprm(short instruction, int param, byte[] varParam, List list)
public static int addSprm(short instruction, int param, byte[] varParam, List<byte[]> list)
{
int type = (instruction & 0xe000) >> 13;

@@ -96,7 +96,7 @@ public final class SprmUtils
return sprm.length;
}

public static byte[] getGrpprl(List sprmList, int size)
public static byte[] getGrpprl(List<byte[]> sprmList, int size)
{
// spit out the final grpprl
byte[] grpprl = new byte[size];
@@ -104,7 +104,7 @@ public final class SprmUtils
int index = 0;
for (; listSize >= 0; listSize--)
{
byte[] sprm = (byte[])sprmList.remove(0);
byte[] sprm = sprmList.remove(0);
System.arraycopy(sprm, 0, grpprl, index, sprm.length);
index += sprm.length;
}

+ 2
- 1
src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java View File

@@ -19,6 +19,7 @@ package org.apache.poi.hwpf.sprm;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.TableAutoformatLookSpecifier;
@@ -34,7 +35,7 @@ public final class TableSprmCompressor
public static byte[] compressTableProperty(TableProperties newTAP)
{
int size = 0;
ArrayList sprmList = new ArrayList();
List<byte[]> sprmList = new ArrayList<byte[]>();

if (newTAP.getJc() != 0)
{

+ 2
- 2
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java View File

@@ -998,13 +998,13 @@ public class Range { // TODO -instantiable superclass
* @return An int array of length 2. The first int is the start index and
* the second int is the end index.
*/
private int[] findRange(List<? extends PropertyNode> rpl, int min, int start, int end) {
private int[] findRange(List<? extends PropertyNode<?>> rpl, int min, int start, int end) {
int x = min;

if ( rpl.size() == min )
return new int[] { min, min };

PropertyNode node = rpl.get( x );
PropertyNode<?> node = rpl.get( x );

while (node==null || (node.getEnd() <= start && x < rpl.size() - 1)) {
x++;

Loading…
Cancel
Save