Skip to content

Commit

Permalink
modified concrete appenders to use appropriate constructors
Browse files Browse the repository at this point in the history
Mutable fields in SocketAppenderBase were previously exposed as
protected fields and modified by constructors in concrete subclasses.
This commit improves encapsulation of the base class by exposing
protected constructors for subclasses to invoke rather than directly
exposing the fields.  These new constructors are marked as deprecated,
as the convenience constructors on the base classes (which are also
deprecated) are the sole reason for their existence.  A future release
should remove all but the no-arg constructor from the base class and
subclasses.
  • Loading branch information
ceharris committed Apr 28, 2013
1 parent 03fe4b0 commit 16d67e5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
Expand Up @@ -40,16 +40,15 @@ public SSLSocketAppender() {
*/
@Deprecated
public SSLSocketAppender(String host, int port) {
this(getAddressByName(host), port);
super(host, port);
}

/**
* Connects to remote server at <code>address</code> and <code>port</code>.
*/
@Deprecated
public SSLSocketAppender(InetAddress address, int port) {
this.address = address;
this.port = port;
super(address.getHostAddress(), port);
}

@Override
Expand Down
Expand Up @@ -44,19 +44,15 @@ public SocketAppender() {
*/
@Deprecated
public SocketAppender(InetAddress address, int port) {
this.address = address;
this.remoteHost = address.getHostName();
this.port = port;
super(address.getHostAddress(), port);
}

/**
* Connects to remote server at <code>host</code> and <code>port</code>.
*/
@Deprecated
public SocketAppender(String host, int port) {
this.port = port;
this.address = getAddressByName(host);
this.remoteHost = host;
super(host, port);
}

@Override
Expand Down
Expand Up @@ -42,16 +42,15 @@ public SSLSocketAppender() {
*/
@Deprecated
public SSLSocketAppender(String host, int port) {
this(getAddressByName(host), port);
super(host, port);
}

/**
* Connects to remote server at <code>address</code> and <code>port</code>.
*/
@Deprecated
public SSLSocketAppender(InetAddress address, int port) {
this.address = address;
this.port = port;
super(address.getHostAddress(), port);
}

@Override
Expand Down
Expand Up @@ -42,23 +42,19 @@ public SocketAppender() {
}

/**
* Connects to remote server at <code>address</code> and <code>port</code>.
* Connects to remote server at <code>host</code> and <code>port</code>.
*/
@Deprecated
public SocketAppender(InetAddress address, int port) {
this.address = address;
this.remoteHost = address.getHostName();
this.port = port;
public SocketAppender(String host, int port) {
super(host, port);
}

/**
* Connects to remote server at <code>host</code> and <code>port</code>.
* Connects to remote server at <code>address</code> and <code>port</code>.
*/
@Deprecated
public SocketAppender(String host, int port) {
this.port = port;
this.address = getAddressByName(host);
this.remoteHost = host;
public SocketAppender(InetAddress address, int port) {
super(address.getHostAddress(), port);
}

@Override
Expand Down

0 comments on commit 16d67e5

Please sign in to comment.