diff --git a/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java b/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java index 074c294..3547a58 100644 --- a/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java +++ b/src/java/org/apache/poi/hssf/eventusermodel/FormatTrackingHSSFListener.java @@ -18,7 +18,7 @@ package org.apache.poi.hssf.eventusermodel; import java.text.NumberFormat; import java.util.ArrayList; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -45,7 +45,7 @@ public class FormatTrackingHSSFListener implements HSSFListener { private final HSSFListener _childListener; private final HSSFDataFormatter _formatter; private final NumberFormat _defaultFormat; - private final Map _customFormatRecords = new Hashtable(); + private final Map _customFormatRecords = new HashMap(); private final List _xfRecords = new ArrayList(); /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java index d35aa4b..32cf222 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java @@ -33,9 +33,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -155,7 +154,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss * this holds the HSSFFont objects attached to this workbook. * We only create these from the low level records as required. */ - private Hashtable fonts; + private Map fonts; /** * holds whether or not to preserve other nodes in the POIFS. Used @@ -1204,7 +1203,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss */ @Override public HSSFFont getFontAt(short idx) { - if(fonts == null) fonts = new Hashtable(); + if(fonts == null) fonts = new HashMap(); // So we don't confuse users, give them back // the same object every time, but create @@ -1228,7 +1227,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss * and that's not something you should normally do */ protected void resetFontCache() { - fonts = new Hashtable(); + fonts = new HashMap(); } /** diff --git a/src/java/org/apache/poi/hssf/util/HSSFColor.java b/src/java/org/apache/poi/hssf/util/HSSFColor.java index ea4b3e2..55ff46b 100644 --- a/src/java/org/apache/poi/hssf/util/HSSFColor.java +++ b/src/java/org/apache/poi/hssf/util/HSSFColor.java @@ -19,7 +19,7 @@ package org.apache.poi.hssf.util; import java.lang.reflect.Field; import java.util.Collections; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Map; import org.apache.poi.ss.usermodel.Color; @@ -57,18 +57,18 @@ public class HSSFColor implements Color { return indexHash; } /** - * This function returns all the Colours, stored in a Hashtable that + * This function returns all the Colours, stored in a Map that * can be edited. No caching is performed. If you don't need to edit * the table, then call {@link #getIndexHash()} which returns a * statically cached imuatable map of colours. */ - public final static Hashtable getMutableIndexHash() { + public final static Map getMutableIndexHash() { return createColorsByIndexMap(); } - private static Hashtable createColorsByIndexMap() { + private static Map createColorsByIndexMap() { HSSFColor[] colors = getAllColors(); - Hashtable result = new Hashtable(colors.length * 3 / 2); + Map result = new HashMap(colors.length * 3 / 2); for (int i = 0; i < colors.length; i++) { HSSFColor color = colors[i]; @@ -148,16 +148,16 @@ public class HSSFColor implements Color { * it takes to create it once per request but you will not hold onto it * if you have none of those requests. * - * @return a hashtable containing all colors keyed by String gnumeric-like triplets + * @return a Map containing all colors keyed by String gnumeric-like triplets */ - public final static Hashtable getTripletHash() + public final static Map getTripletHash() { return createColorsByHexStringMap(); } - private static Hashtable createColorsByHexStringMap() { + private static Map createColorsByHexStringMap() { HSSFColor[] colors = getAllColors(); - Hashtable result = new Hashtable(colors.length * 3 / 2); + Map result = new HashMap(colors.length * 3 / 2); for (int i = 0; i < colors.length; i++) { HSSFColor color = colors[i]; @@ -1683,7 +1683,7 @@ public class HSSFColor implements Color { /** * Special Default/Normal/Automatic color. - *

Note: This class is NOT in the default HashTables returned by HSSFColor. + *

Note: This class is NOT in the default Map returned by HSSFColor. * The index is a special case which is interpreted in the various setXXXColor calls. * * @author Jason diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java index 1b15c40..c70e496 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java @@ -30,7 +30,7 @@ import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -145,8 +145,8 @@ public abstract class OPCPackage implements RelationshipSource, Closeable { * Initialize the package instance. */ private void init() { - this.partMarshallers = new Hashtable(5); - this.partUnmarshallers = new Hashtable(2); + this.partMarshallers = new HashMap(5); + this.partUnmarshallers = new HashMap(2); try { // Add 'default' unmarshaller diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java index 24afccb..c386d9d 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentType.java @@ -17,7 +17,7 @@ package org.apache.poi.openxml4j.opc.internal; -import java.util.Hashtable; +import java.util.LinkedHashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -63,7 +63,7 @@ public final class ContentType { /** * Parameters */ - private Hashtable parameters; + private Map parameters; /** * Media type compiled pattern, without parameters @@ -160,7 +160,7 @@ public final class ContentType { this.subType = mMediaType.group(2); // Parameters - this.parameters = new Hashtable(1); + this.parameters = new LinkedHashMap(); // Java RegExps are unhelpful, and won't do multiple group captures // See http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#cg if (mMediaType.groupCount() >= 5) { diff --git a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java index 819051f..4b69576 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java @@ -22,7 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; @@ -44,7 +44,7 @@ public final class ChunkFactory { * Key is a Chunk's type, value is an array of its CommandDefinitions */ private final Map chunkCommandDefinitions = - new Hashtable(); + new HashMap(); /** * What the name is of the chunk table definitions file? * This file comes from the scratchpad resources directory. @@ -105,7 +105,7 @@ public final class ChunkFactory { CommandDefinition[] defs = defsL.toArray(new CommandDefinition[defsL.size()]); - // Add to the hashtable + // Add to the map chunkCommandDefinitions.put(Integer.valueOf(chunkType), defs); } } finally { diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java index fa2f6d5..99c6c68 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/DocumentEncryptionAtom.java @@ -20,7 +20,7 @@ package org.apache.poi.hslf.record; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.Hashtable; +import java.util.Map; import org.apache.poi.poifs.crypt.CipherAlgorithm; import org.apache.poi.poifs.crypt.EncryptionInfo; @@ -123,7 +123,7 @@ public final class DocumentEncryptionAtom extends PositionDependentRecordAtom { out.write(data, 0, bos.getWriteIndex()); } - public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) { + public void updateOtherRecordReferences(Map oldToNewReferencesLookup) { } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java b/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java index b78ccdc..5ef5231 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java @@ -22,7 +22,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.Hashtable; +import java.util.Map; import java.util.zip.DeflaterOutputStream; import java.util.zip.InflaterInputStream; @@ -184,7 +184,7 @@ public class ExOleObjStg extends RecordAtom implements PositionDependentRecord, myLastOnDiskOffset = offset; } - public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) { + public void updateOtherRecordReferences(Map oldToNewReferencesLookup) { return; } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java b/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java index 32b36a2..4cca059 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PersistPtrHolder.java @@ -20,7 +20,7 @@ package org.apache.poi.hslf.record; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Map; import java.util.TreeMap; @@ -52,7 +52,7 @@ public final class PersistPtrHolder extends PositionDependentRecordAtom * You always need to check the most recent PersistPtrHolder * that knows about a given slide to find the right location */ - private Hashtable _slideLocations; + private Map _slideLocations; private static final BitField persistIdFld = new BitField(0X000FFFFF); private static final BitField cntPersistFld = new BitField(0XFFF00000); @@ -64,7 +64,7 @@ public final class PersistPtrHolder extends PositionDependentRecordAtom /** * Get the list of slides that this PersistPtrHolder knows about. - * (They will be the keys in the hashtable for looking up the positions + * (They will be the keys in the map for looking up the positions * of these slides) */ public int[] getKnownSlideIDs() { @@ -80,7 +80,7 @@ public final class PersistPtrHolder extends PositionDependentRecordAtom * Get the lookup from slide numbers to byte offsets, for the slides * known about by this PersistPtrHolder. */ - public Hashtable getSlideLocationsLookup() { + public Map getSlideLocationsLookup() { return _slideLocations; } @@ -104,7 +104,7 @@ public final class PersistPtrHolder extends PositionDependentRecordAtom // base number for these entries // count * 32 bit offsets // Repeat as many times as you have data - _slideLocations = new Hashtable(); + _slideLocations = new HashMap(); _ptrData = new byte[len-8]; System.arraycopy(source,start+8,_ptrData,0,_ptrData.length); @@ -157,7 +157,7 @@ public final class PersistPtrHolder extends PositionDependentRecordAtom * At write-out time, update the references to the sheets to their * new positions */ - public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) { + public void updateOtherRecordReferences(Map oldToNewReferencesLookup) { // Loop over all the slides we know about // Find where they used to live, and where they now live for (Map.Entry me : _slideLocations.entrySet()) { diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecord.java b/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecord.java index e73323c..844c14d 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecord.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecord.java @@ -16,7 +16,7 @@ ==================================================================== */ package org.apache.poi.hslf.record; -import java.util.Hashtable; +import java.util.Map; /** * Records which either care about where they are on disk, or have other @@ -47,5 +47,5 @@ public interface PositionDependentRecord * Offer the record the list of records that have changed their * location as part of the writeout. */ - public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup); + public void updateOtherRecordReferences(Map oldToNewReferencesLookup); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordAtom.java index 28228ea..76d8f49 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordAtom.java @@ -16,7 +16,7 @@ ==================================================================== */ package org.apache.poi.hslf.record; -import java.util.Hashtable; +import java.util.Map; /** * A special (and dangerous) kind of Record Atom that cares about where @@ -48,5 +48,5 @@ public abstract class PositionDependentRecordAtom extends RecordAtom implements * Allows records to update their internal pointers to other records * locations */ - public abstract void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup); + public abstract void updateOtherRecordReferences(Map oldToNewReferencesLookup); } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordContainer.java b/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordContainer.java index a297f30..14b1932 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordContainer.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/PositionDependentRecordContainer.java @@ -16,7 +16,7 @@ ==================================================================== */ package org.apache.poi.hslf.record; -import java.util.Hashtable; +import java.util.Map; /** * A special (and dangerous) kind of Record Container, for which other @@ -60,7 +60,7 @@ public abstract class PositionDependentRecordContainer extends RecordContainer i * Since we're a container, we don't mind if other records move about. * If we're told they have, just return straight off. */ - public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) { + public void updateOtherRecordReferences(Map oldToNewReferencesLookup) { return; } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java index d0c8b56..b1bd6bb 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/UserEditAtom.java @@ -22,7 +22,7 @@ import org.apache.poi.util.LittleEndianConsts; import java.io.IOException; import java.io.OutputStream; -import java.util.Hashtable; +import java.util.Map; /** * A UserEdit Atom (type 4085). Holds information which bits of the file @@ -146,7 +146,7 @@ public final class UserEditAtom extends PositionDependentRecordAtom * At write-out time, update the references to PersistPtrs and * other UserEditAtoms to point to their new positions */ - public void updateOtherRecordReferences(Hashtable oldToNewReferencesLookup) { + public void updateOtherRecordReferences(Map oldToNewReferencesLookup) { // Look up the new positions of our preceding UserEditAtomOffset if(lastUserEditAtomOffset != 0) { Integer newLocation = oldToNewReferencesLookup.get(Integer.valueOf(lastUserEditAtomOffset)); diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java index d878182..b316a0e 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java @@ -28,7 +28,7 @@ import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.Hashtable; +import java.util.Map; import java.util.List; import java.util.Map; import java.util.NavigableMap; @@ -464,7 +464,7 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable { // For position dependent records, hold where they were and now are // As we go along, update, and hand over, to any Position Dependent // records we happen across - Hashtable oldToNewPositions = new Hashtable(); + Map oldToNewPositions = new HashMap(); // First pass - figure out where all the position dependent // records are going to end up, in the new scheme diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java b/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java index fefa202..8de67e5 100644 --- a/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/TestReWriteSanity.java @@ -60,8 +60,8 @@ public final class TestReWriteSanity extends TestCase { // Find the location of the PersistPtrIncrementalBlocks and // UserEditAtoms Record[] r = wss.getRecords(); - Map pp = new Hashtable(); - Map ue = new Hashtable(); + Map pp = new HashMap(); + Map ue = new HashMap(); ue.put(Integer.valueOf(0),Integer.valueOf(0)); // Will show 0 if first int pos = 0; int lastUEPos = -1; diff --git a/src/testcases/org/apache/poi/hssf/util/TestHSSFColor.java b/src/testcases/org/apache/poi/hssf/util/TestHSSFColor.java index d93f5d7..25e2307 100644 --- a/src/testcases/org/apache/poi/hssf/util/TestHSSFColor.java +++ b/src/testcases/org/apache/poi/hssf/util/TestHSSFColor.java @@ -17,7 +17,7 @@ package org.apache.poi.hssf.util; -import java.util.Hashtable; +import java.util.Map; import junit.framework.TestCase; /** @@ -40,7 +40,7 @@ public final class TestHSSFColor extends TestCase { } public void testTrippletHash() { - Hashtable tripplets = HSSFColor.getTripletHash(); + Map tripplets = HSSFColor.getTripletHash(); assertEquals( HSSFColor.MAROON.class,