Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/535#discussion_r33406307 --- Diff: framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java --- @@ -122,6 +122,13 @@ public boolean equals(Object obj) { if (obj instanceof ConfigKey) { ConfigKey<?> that = (ConfigKey<?>)obj; return this._name.equals(that._name); + } + return false; + } + + public boolean isSameKeyAs(Object obj) { + if(this.equals(obj)) { + return true; } else if (obj instanceof String) { --- End diff -- ``this.getClass().equals(obj.getClass())`` is preferred over ``instanceof`` because ``instanceof`` only verifies that the two objects are the compatible types, not that the classes themselves are loaded from a common class loader. If two objects have the same type but their underlying classes are loaded from different class loaders, casting the objects will fail. Given that web containers play games with class loaders and often load the same jar multiple times, unexpected behavior and runtime exceptions (e.g. apparent duplicate Map entries, ClassCastExceptions, etc) occurs.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---