Mark,

On 5/27/21 04:59, Mark Thomas wrote:
On 27/05/2021 07:32, Carsten Klein wrote:
On 26/05/2021 19:56, Mark Thomas wrote:

Given that the attributes may well be security related, you would need to make sure neither the Map nor any of the keys/values could be modified. Protecting the Map is easy. Protecting the keys/values is a little trickier. For that reason I'd lean towards the solution below.

Oh yes, these attributes should likely be immutable. Since I still believe that Enumerations are kind of uncomfortable (and outdated?), what about strictly relying on Collections.unmodifiableMap?

The issue while objects can't be added to the Map or removed from the Map, the objects can still be mutated. For that reason I prefer the getAttribute() approach where an appropriate defensive copy can be made before returning any attribute value.

Does that mean this needs to be Map<String,<? extends Clonable>>? Or Map<String,<? extends Serializable>>?

How do you expect to perform defensive-copies of arbitrary objects?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to