On Wed, 22 Jun 2016, Axel Howind wrote:
When looking at the current source, I noticed Hashtable still being used
in a number of places. Is there any reason for not replacing all these
hashtable instances with HashMap (besides TestContentType.java failing,
see below)?
I suspect just history! The only place I could think of us needing the
synchronisation of a hashtable is any system-wide constants, but even then
maybe not.
I attach a patch that replaces Hashtable instantiations with HashMap and
Hashtable declarations with Map (the common interface). Current git tests
pass with this patch applied.
Patches to the list tend to get lost. Any chance you could either open a
bugzilla entry and attach it there, or open it as a new pull request on
github?
The failing test is this one:
assertEquals(typeResqml+";version=2.0;type=obj_global1dCrs",
part.getContentTypeDetails().toString());
part is of type org.apache.poi.openxml4j.opc.PackagePart and toString() just
concatenates all the entries contained in the parameters attribute
(Hashtable) together by iterating over its entryset.
This is rather fragile and could break anytime since AFAIK the order in which
hashtable/HashMap entries are returned is not guaranteed and could change
with any (minor) Java release.
It might be better to replace that with an assertContains or similar?
-leave the hashtable in
-use a LinkedHashMap for org.apache.poi.openxml4j.opc.PackagePart.parameters
to ensure consistent ordering
Maybe use a linked map, as there might be some odd ooxml compatibility
stuff we've all forgotten about that needs a certain ordering... I don't
think for 0-3 params it'll make much performance difference!
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]