You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2013/03/10 15:45:24 UTC

[jira] [Commented] (BEANUTILS-410) No bean defined exception with mapped properties

    [ https://issues.apache.org/jira/browse/BEANUTILS-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13598274#comment-13598274 ] 

Benedikt Ritter commented on BEANUTILS-410:
-------------------------------------------

Hi Daniel,

it looks like your using the API the wrong way. If you want to put the value "1234" to key "abc" the correct use would be:

{code}
properties.put("teste(abc)", "1234");
BeanUtils.populate(testeBean, properties)
{code}

Beside that, trying to put "teste(abc)_new_value" doesn't throw an exception (see attached TestCase). It will just silently return without setting anything.
                
> No bean defined exception with mapped properties
> ------------------------------------------------
>
>                 Key: BEANUTILS-410
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-410
>             Project: Commons BeanUtils
>          Issue Type: Bug
>          Components: Bean / Property Utils
>    Affects Versions: 1.8.3
>         Environment: All Operating Systems
>            Reporter: DANIEL BRASIL
>            Assignee: Benedikt Ritter
>            Priority: Blocker
>              Labels: bug
>             Fix For: 1.8.4
>
>
> The following code throws an exception. The same code does not throw exception at 1.7.0 version. 
> The code tries to set property "_new_value" on bean "teste(abc)". It's not the correct behavior since the property accessor notation is ".".
> {Code}
> import java.util.HashMap;
> import java.util.Map;
> public class MappedBean {
> 	public Map<String, String> teste = new HashMap<String, String>();
> 	public String getTeste(String key) {
> 		return this.teste.get(key);
> 	}
> 	public void setTeste(String key, String value) {
> 		this.teste.put(key, value);
> 	}
> }
> {Code}
> {Code}
> 		MappedBean testeBean = new MappedBean();
> 		Map<String, String> properties = new HashMap<String, String>();
> 		properties.put("teste(abc)_new_value", "1234");
> 		BeanUtils.populate(testeBean, properties);
> {Code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira