commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter_F...@blm.gov
Subject Re: Betwixt: Trouble reading Map data [BUG]
Date Fri, 29 Aug 2008 15:19:28 GMT
It took a while but I figured out what was wrong. This looks like a bug in
Betwixt.

In the generated XML below, the <entry> element contains tags <Key> and
<Value> (note the capitalization). When reading back, Betwixt appears to be
looking instead for <key> and <value> (no capitalization). If I pass the
generated XML through a filter to locate and replace the capitalized tags
with the uncapitalized ones before reading back into Betwixt, it works -
the map is populated correctly.

I'll check the open bugs to see if this is known about and report it if
not.

Peter_Ford@blm.gov wrote on 08/27/2008 01:07:13 PM:

>
> I have a bean containing a Map<String, String> and the get/set/add
methods:
>
>     private Map<String, String> details = new TreeMap<String, String>();
>
>     public Map<String, String> getDetails()
>     {
>         return details;
>     }
>
>     public void setDetails(Map<String, String> details)
>     {
>         this.details = details;
>     }
>
>     public void addDetail(String key, String value)
>     {
>         details.put(key, value);
>     }
>
> When I use betwixt to render the bean as XML the output looks fine:
>
>     <Details>
>       <entry>
>         <Key>...</Key>
>         <Value>...</Value>
>       </entry>
>     </Details>
>
> The problem is that when the bean is reconstructed from the XML, the Map
is
> empty. I put a breakpoint in the addDetail() method and it isn't getting
> hit, so this method isn't being called. Is this an error in the
> documentation or is there something else I've missed?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message