Bug 35965 - JMSAppender JMS properties unaccessible to subclasses
JMSAppender JMS properties unaccessible to subclasses
Status: RESOLVED FIXED
Product: Log4j
Classification: Unclassified
Component: Appender
1.2
All All
: P2 minor
: ---
Assigned To: log4j-dev
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-08-01 20:38 UTC by John Rimell
Modified: 2005-08-02 23:06 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Rimell 2005-08-01 20:38:40 UTC
I'm wanting to extend the JMSAppender to reuse the JMS code (I can just pass in
the required connection info), however, I can't use the append method as it
stands (I need it to publish TextMessage's not ObjectMessage's). I wanted to be
able to simply override the append method, but the internal properties
(topicConnection, topicSession etc) are not accessible. They should be
"protected" to allow extended classes to have access to them.
Comment 1 Mark Womack 2005-08-01 22:59:18 UTC
1.2.12 candidate
Comment 2 Curt Arnold 2005-08-02 00:11:25 UTC
I'd be okay with adding accessors, but protected variables are problematic and we shouldn't be adding to 
the ones that we already have.  Do you think you need mutators too?
Comment 3 Mark Womack 2005-08-02 05:51:43 UTC
Actually, in this case I think that protected member variables are a better 
solution.  Opening these members to be accessed via getter methods will also 
open them up to being manipulated by other entities besides subclasses of 
JMSAppender.  Any class could access the getter methods and then use the 
returned object to do whatever it wants.  It implies a contract with the 
outside world that it is ok to get and manipulate these member variables, which 
it isn't.  Whereas if they are just changed to protected, only subclasses can 
screw things up, but we expect them to be a bit more knowleable.
Comment 4 Mark Womack 2005-08-02 08:26:02 UTC
Doh.  Of course, protected accessor/mutator methods would solve what I was just 
talking about.  Sorry, I have been working just plain old bean objects now for 
too long, obviously.  I would only add the accessor ones and not mutators.
Comment 5 Mark Womack 2005-08-03 07:06:19 UTC
Added protected accessors for the JMS member variables.  Subclasses should be 
able to use these to get at the values need to override other methods to change 
behavior.