4 Replies Latest reply on Aug 11, 2008 12:29 PM by brian.stansberry

    Unexpected canonicalization of string

    brian.stansberry

      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.