[jboss-remoting-issues] [JBoss JIRA] Created: (JBREM-1255) Classname redundancy in Remoting.addServices()

Ron Sigal (JIRA) jira-events at lists.jboss.org
Wed Oct 20 17:53:54 EDT 2010


Classname redundancy in Remoting.addServices()
----------------------------------------------

                 Key: JBREM-1255
                 URL: https://jira.jboss.org/browse/JBREM-1255
             Project: JBoss Remoting
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 3.1.0.Beta2
            Reporter: Ron Sigal
            Priority: Minor
             Fix For: 3.1.0.Beta3


In org.jboss.remoting3.Remoting.addServices()

    private static <T> void addServices(final Endpoint endpoint, final ProtocolServiceType<T> serviceType, final Properties props) {
        final String basePropName = serviceType.getName().toLowerCase();
        final String instances = props.getProperty(endpoint.getName() + "." + basePropName + "_list");
        final Class<T> valueClass = serviceType.getValueClass();
        if (instances != null) {
            for (String name : instances.split(",")) {
                final String trimmed = name.trim();
                final String className = props.getProperty(name + "." + basePropName + "." + trimmed + ".class"); // <<<=====
                if (className != null) {
                    try {
                        final Class<? extends T> instanceType = Class.forName(className).asSubclass(valueClass);
                        final T instance = instanceType.getConstructor().newInstance();
                        log.trace("Adding protocol service '%s' of type '%s'", name, serviceType);
                        endpoint.addProtocolService(serviceType, name, instance);
                    } catch (InvocationTargetException e) {
                        log.warn(e.getCause(), "Unable to create %s instance '%s'", serviceType, name);
                    } catch (Exception e) {
                        log.warn("Unable to register %s '%s': %s", serviceType, name, e);
                    }
                }
            }
        }
    } 

the line labelled <<<==== has what seems to be the redundant use of name and trimmed.  As a result, the property it's looking for ends up looking like, for example, "mockClassResolver.class_resolver.mockClassResolver.class".  I suspect it should be "class_resolver.mockClassResolver.class".

Note that the property file jboss-remoting/src/test/resources/protocols.test.remoting.properties, used by org.jboss.remoting3.test.EndpointConfigurationTestCase, is written to work with this redundancy.  It should be changed if the code is changed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-remoting-issues mailing list