On Wednesday, November 30, 2011 4:38:40 PM Miguel Feitosa wrote:
> Lines 325-330 of JAXBElementProvider.java contain the following code:
>         if (ns.length() > 0) {
>             Map<String, String> map = Collections.singletonMap(ns, "ns1");
>             map.putAll(nsPrefixes);
>             setNamespaceMapper(ms, map);
>         }
>         marshal(obj, cls, genericType, enc, os, mt, ms);
> 
> The call Collections.singletonMap(...) is below:
> 
>  /**
>      * Returns an immutable map, mapping only the specified key to the
>      * specified value.  The returned map is serializable.
>      *
>      * @param key the sole key to be stored in the returned map.
>      * @param value the value to which the returned map maps <tt>key</tt>.
>      * @return an immutable map containing only the specified key-value
>      *         mapping.
>      * @since 1.3
>      */
>     public static <K,V> Map<K,V> singletonMap(K key, V value) {
>         return new SingletonMap<>(key, value);
>     }
> 
> So it seems that
>             map.putAll(nsPrefixes);
> 
> should fail as it is failing when called because the map is immutable.
> 
> In case there are other prefixes to add it seems that the map should be of
> another type....

That DEFINITELY looks like a bug to me.   Can you log that?


-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to