Bug 59748

Summary: [PATCH] Remove use of obsolete Hashtable class
Product: POI Reporter: Axel Howind <axel>
Component: POI OverallAssignee: POI Developers List <dev>
Severity: enhancement CC: axel
Priority: P2    
Version: 3.15-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Replace Hashtable by HashMap, LinkedHashMap

Description Axel Howind 2016-06-23 21:27:51 UTC
Created attachment 33981 [details]
Replace Hashtable by HashMap, LinkedHashMap

Current development version still uses Hashtable in a number of places. The attached patch replaces instaniaions of Hashtable with HashMap. he only example is ContentType.java where LinkedHashMap is used instead because a unit test implicitly relies on the order entries are retrieved from a map.

See the discussion on poidev http://thread.gmane.org/gmane.comp.jakarta.poi.devel/33069/focus=33070 for details.
Comment 1 Javen O'Neal 2016-06-24 02:14:04 UTC
Looks okay to me.

We should add key-value generic type when missing.
Public methods should return a new map or wrap the map with Collections.unmodifiableMap.
Comment 2 Javen O'Neal 2016-06-24 21:42:48 UTC
Applied in r1750168.

This commit made no attempt to keep public API's available (but deprecated).

I fixed TestContentType to not rely on the Map ordering and used a HashMap instead of a LinkedHashMap.
Comment 3 Javen O'Neal 2016-06-25 05:27:00 UTC
(In reply to Javen O'Neal from comment #2)
> This commit made no attempt to keep public API's available (but deprecated).

Any implementation that relied on method arguments being Hashtable will also work with Map method arguments, so no need to add deprecated Hashtable methods.

Replaced Hashtable usage in contrib/poi-ruby in r1750182.