Re: Should this be called a bug ?

2003-03-03 Thread Cedric Dumoulin
 This is a known behavior ;-).
 It is not a bug, it is an implementation choice (for efficiency, this 
reduce the number of objects created ).
 In the normal usage, you should only consult, add or remove attributes 
from ComponentContext. You should not modify the attributes obtained 
from the ComponentContext !
 A componentContext is created for each inserted tile. This 
componentContext is populated from the corresponding definition: the 
attributes are initialized. Instead of creating a new value for each 
attribute, we reference the value stored in the definition. If you get 
it and modify it, the modification will be reflected by all subsequent 
calls.
 An attribute value can be any kind of object, even a user defined one. 
So, it is hard to enforce a read-only API on the attribute value. The 
only solution is to copy the attribute value each time we use it. This 
will lead to several object creations. More than 99.9% of the 
application doesn't need to modify the attributes. So, I don't want to 
let them pay the price for the 0.01% remaining. These remaining 
applications can do the attribute copy themselves when needed ;-).

 An improvement can be done by changing the current attribute 
definition objects and let them disallow modifications. This can be an 
improvement request in bugzilla.

 Cedric

Pankaj Dhoolia wrote:

Hi,

Current implementation of ComponentContext is such that you can make
changes to it in such a manner that the base definition cached with the
DefinitionFactory will reflect those changes. In effect it is possible
to 
cause global changes for all subsequent requests thru the
ComponentContext API. Was this intended or is it a bug, because for the
List type attributes ComponentContext lands up having a reference point
right in the definition cached in the DefinitionFactory?

cheers,
pdhoolia
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Should this be called a bug ?

2003-03-03 Thread Pankaj Dhoolia
  This is a known behavior ;-).

pdhooliaI guessed so, that's why I asked rather than saying that it is
a bug. Returning a cloned definition or a cloned list everytime could be
heavy on performance. I agree. By the way it would be possible only to
modify the list items since String is itself immutable /pdhoolia

cheers,
pdhoolia

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]