[jboss-dev-forums] [Design the new POJO MicroContainer] - Unexpected canonicalization of string

bstansberry@jboss.com do-not-reply at jboss.com
Fri Aug 8 16:59:29 EDT 2008


I'm seeing a case where a string value is being converted into a canonical form before being passed to my object's constructor. This behavior seems odd to me and wanted to point it out in case it's considered to be a bug.

My class has a constructor like this:

public ServiceBinding(String serviceName, String hostName, int port)

The xml declaration is as follows:

<bean class="org.jboss.bindings.ServiceBinding">
  |                <constructor>
  |                   <parameter>jboss.remoting:service=JMXConnectorServer,protocol=rmi</parameter>
  |                   <parameter>${jboss.bind.address}</parameter>
  |                   <parameter>1090</parameter>
  |                </constructor>
  |             </bean>

What's odd here is when the constructor is invoked, the passed in serviceName is the canonicalized form jboss.remoting:protocol=rmi,service=JMXConnectorServer . So it seems that even though the type of the parameter is String, something is detecting that the value looks like an ObjectName and is canonicalizing it.

There's no constructor that takes an ObjectName, so it's not a case of confusion about the desired type.

This is causing problems because value-factory parameter parsing in ServiceMetaDataParser isn't doing the same thing. So a ServiceBindingManager lookup of the binding fails.  I can work around that, but it seems odd to have to.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4169692#4169692

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4169692



More information about the jboss-dev-forums mailing list