Issue 121192 - service EnumerableMap is too restrictive on data types
Summary: service EnumerableMap is too restrictive on data types
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Normal
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
Depends on:
Reported: 2012-10-10 10:20 UTC by bmarcelly
Modified: 2013-02-24 21:06 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description bmarcelly 2012-10-10 10:20:47 UTC
If an enumerable map is declared as using a value of type long, it will not accept in Basic a value like 1234, because it is interpreted as short.
This probably happens with other language bindings.

Option Explicit

Sub Main
' Needs AOO 3.4.1 that solves Bug 116184
Dim dico As Object, enu As Object, elem As Variant, ville As String

dico ="string", "long")
dico.put("Angers",   49000) ' key "Angers", Item 49000

dico.put("Foix", 9000) ' throws IllegalTypeException ***

dico.put("Foix", CreateUnoValue("long", 9000)) ' works, but cumbersome
End Sub

The same problem can also happen with keys.
Keys and values handling should use the service c.s.s.script.Converter to widen from one type to another when it is possible (e.g. short > long or long > double).