camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-584) BeanWithPropertiesAndHeadersAndBodyInjectionTest causes java.lang.StackOverflowError
Date Fri, 06 Jun 2008 11:48:00 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43296#action_43296
] 

Claus Ibsen commented on CAMEL-584:
-----------------------------------

The bug is in BeanProcessor that adds the bean itself as a propery the the exchange

{code}
    public void process(Exchange exchange) throws Exception {
        if (LOG.isDebugEnabled()) {
            LOG.debug(">>>> invoking method for: " + exchange);
        }

        Object bean = beanHolder.getBean();
        exchange.setProperty("CamelBean", bean);
{code}

And then when you do a toString() as the unit test does with the properties:

{code}
        public String toString() {
            return "MyBean[foo: " + foo + " bar: " + bar + " body: " + body + "]";
        }
{code}

And the properties is the foo argument, then you get circular dependency.


Why do Camel set the bean itself as a property? Is this used by end-users at all?
"CamelBean" is not used anywhere else in the java code, so I do think its safe to delete the
codeline but then end-users that this property existed isn't there anymore.

We could remedy this by setting the BeanHolder instead of the bean directly.

> BeanWithPropertiesAndHeadersAndBodyInjectionTest causes java.lang.StackOverflowError
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-584
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-584
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> This unit test cases infinitive loop
> {code}
> Caused by: java.lang.StackOverflowError
> 	at java.util.HashMap$HashIterator.<init>(HashMap.java:822)
> 	at java.util.HashMap$EntryIterator.<init>(HashMap.java:881)
> 	at java.util.HashMap$EntryIterator.<init>(HashMap.java:881)
> 	at java.util.HashMap.newEntryIterator(HashMap.java:895)
> 	at java.util.HashMap$EntrySet.iterator(HashMap.java:988)
> 	at java.util.AbstractMap.toString(AbstractMap.java:584)
> 	at java.lang.String.valueOf(String.java:2615)
> 	at java.lang.StringBuilder.append(StringBuilder.java:116)
> 	at org.apache.camel.component.bean.BeanWithPropertiesAndHeadersAndBodyInjectionTest$MyBean.toString(BeanWithPropertiesAndHeadersAndBodyInjectionTest.java:91)
> 	at java.lang.String.valueOf(String.java:2615)
> 	at java.lang.StringBuffer.append(StringBuffer.java:220)
> 	at java.util.AbstractMap.toString(AbstractMap.java:598)
> 	at java.lang.String.valueOf(String.java:2615)
> 	at java.lang.StringBuilder.append(StringBuilder.java:116)
> 	at org.apache.camel.component.bean.BeanWithPropertiesAndHeadersAndBodyInjectionTest$MyBean.toString(BeanWithPropertiesAndHeadersAndBodyInjectionTest.java:91)
> 	at java.lang.String.valueOf(String.java:2615)
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message