quality@glassfish.java.net

Re: why does Glassfish define both getdataSourceName() and getDataSourceName()?

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Thu, 14 Dec 2006 20:19:57 +0530

Hi Bill,

In case of com.sun.gjc.spi warnings,
these methods will be called dynamically (via reflection).
I think these methods were written purposefully assuming that,
user may specify the property as "DataSourceName" / "dataSourceName" and
when the code that uses reflection to set these properties does not use
"equalsIgnoreCase" for method-name comparison.
In GlassFish, this may not be needed. I will verify that there is no any
other purpose for these method duplications and raise a bug.

In com.sun.gjc.spi case, it is not a "programmer" error. However, method
duplication is a right candidate for "medium priority correctness
warnings"

Thanks,
-Jagadish

------------------------------------------------------------------------------
From: Bill Pugh <pugh_at_cs.umd.edu>
Date: Thu, 7 Dec 2006 20:59:59 -0500
Subject: why does Glassfish define both getdataSourceName() and getDataSourceName()?

I was reviewing the differences between FindBugs 1.1.1 and 1.1.2 on
Glassfish.

1.1.2 currently reports a _lot_ of warnings about methods with the
same name and signature, but different method
name capitalization. Many of these are in the com.sun.gjc.spi package.

For example, CPManagedConnectionFactory, XAManagedConnectionFactory
and ManagedConnectionFactory all define both
getdataSourceName() and getDataSourceName().

Is occurs so systematically that it seems as if it is intentional.
Can anyone explain this to me?
Should we be flagging this as medium priority correctness warnings,
or is there some reason to think
that this is actually an acceptable programming practice?

        Bill




com.sun.gjc.spi.CPManagedConnectionFactory.getDataSourceName() and
com.sun.gjc.spi.ManagedConnectionFactory.getdataSourceName() At
CPManagedConnectionFactory.java:[line 323]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getDatabaseName() and
com.sun.gjc.spi.ManagedConnectionFactory.getdatabaseName() At
CPManagedConnectionFactory.java:[line 283]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getDescription() and
com.sun.gjc.spi.ManagedConnectionFactory.getdescription() At
CPManagedConnectionFactory.java:[line 363]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getNetworkProtocol() and
com.sun.gjc.spi.ManagedConnectionFactory.getnetworkProtocol() At
CPManagedConnectionFactory.java:[line 403]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getPortNumber() and
com.sun.gjc.spi.ManagedConnectionFactory.getportNumber() At
CPManagedConnectionFactory.java:[line 243]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getRoleName() and
com.sun.gjc.spi.ManagedConnectionFactory.getroleName() At
CPManagedConnectionFactory.java:[line 443]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getServerName() and
com.sun.gjc.spi.ManagedConnectionFactory.getserverName() At
CPManagedConnectionFactory.java:[line 203]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getdataSourceName() and
com.sun.gjc.spi.ManagedConnectionFactory.getDataSourceName() At
CPManagedConnectionFactory.java:[line 303]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getdatabaseName() and
com.sun.gjc.spi.ManagedConnectionFactory.getDatabaseName() At
CPManagedConnectionFactory.java:[line 263]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getdescription() and
com.sun.gjc.spi.ManagedConnectionFactory.getDescription() At
CPManagedConnectionFactory.java:[line 343]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getnetworkProtocol() and
com.sun.gjc.spi.ManagedConnectionFactory.getNetworkProtocol() At
CPManagedConnectionFactory.java:[line 383]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getportNumber() and
com.sun.gjc.spi.ManagedConnectionFactory.getPortNumber() At
CPManagedConnectionFactory.java:[line 223]
M C NM_VERY_CONFUSING Nm: VERY confusing to have methods
com.sun.gjc.spi.CPManagedConnectionFactory.getroleName() and
com.sun.gjc.spi.ManagedConnectionFactory.getRoleName() At
CPManagedConnectionFactory.java:[line 423]