Bug 59748 - [PATCH] Remove use of obsolete Hashtable class
Summary: [PATCH] Remove use of obsolete Hashtable class
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.15-dev
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-23 21:27 UTC by Axel Howind
Modified: 2016-06-25 05:27 UTC (History)
1 user (show)



Attachments
Replace Hashtable by HashMap, LinkedHashMap (20.99 KB, patch)
2016-06-23 21:27 UTC, Axel Howind
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.