TIMEOUT: 17:00 PST May 3
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2965
raharsha: com/sun/enterprise/admin/monitor/stats/lb/
InstanceStats.java:545:545 ES: Comparison of String parameter using
== or != in
com.sun.enterprise.admin.monitor.stats.lb.InstanceStats.fetchPropertyByN
ame(String) (H)
Index: admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/
stats/lb/InstanceStats.java
===================================================================
RCS file: /cvs/glassfish/admin-core/monitor/src/java/com/sun/
enterprise/admin/monitor/stats/lb/InstanceStats.java,v
retrieving revision 1.2
diff -w -u -r1.2 InstanceStats.java
--- admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/
stats/lb/InstanceStats.java 25 Dec 2005 03:52:31 -0000 1.2
+++ admin-core/monitor/src/java/com/sun/enterprise/admin/monitor/
stats/lb/InstanceStats.java 3 May 2007 18:53:46 -0000
@@ -504,9 +504,13 @@
}
}
- public void changePropertyByName(String name, Object value) {
- if (name == null) return;
- name = name.intern();
+ public void changePropertyByName(final String nameIn, Object
value) {
+ if (nameIn == null) return;
+
+ /** The '==' comparisons below are correct;
+ see the javadoc for String.intern().
+ */
+ final String name = nameIn.intern();
if (name == "id")
setId((java.lang.String)value);
else if (name == "health")
@@ -541,7 +545,15 @@
throw new IllegalArgumentException(name+" is
not a valid property name for InstanceStats");
}
- public Object fetchPropertyByName(String name) {
+ public Object fetchPropertyByName(final String nameIn) {
+ if ( nameIn == null ) {
+ throw new IllegalArgumentException();
+ }
+ /** The '==' comparisons below are correct;
+ see the javadoc for String.intern().
+ */
+ final String name = nameIn.intern();
+
if (name == "id")
return getId();
if (name == "health")