You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/09/21 02:40:26 UTC
[commons-net] 01/03: Rename most private names to remove __prefix,
_prefix and postfix_ underscores. Protected names are untouched.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 10b792c0ba3f852adb5cbfb102a83c658c238fbe
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Sep 20 22:11:14 2020 -0400
Rename most private names to remove __prefix, _prefix and postfix_
underscores. Protected names are untouched.
---
.../apache/commons/net/PrintCommandListener.java | 48 +--
.../apache/commons/net/ProtocolCommandEvent.java | 30 +-
.../apache/commons/net/ProtocolCommandSupport.java | 22 +-
.../java/org/apache/commons/net/SocketClient.java | 6 +-
.../org/apache/commons/net/bsd/RCommandClient.java | 2 +-
.../org/apache/commons/net/bsd/RExecClient.java | 12 +-
.../commons/net/daytime/DaytimeTCPClient.java | 8 +-
.../commons/net/daytime/DaytimeUDPClient.java | 8 +-
.../commons/net/discard/DiscardUDPClient.java | 14 +-
.../org/apache/commons/net/echo/EchoUDPClient.java | 10 +-
.../apache/commons/net/finger/FingerClient.java | 8 +-
src/main/java/org/apache/commons/net/ftp/FTP.java | 12 +-
.../java/org/apache/commons/net/ftp/FTPClient.java | 420 ++++++++++-----------
.../apache/commons/net/ftp/FTPListParseEngine.java | 16 +-
.../ftp/parser/VMSVersioningFTPEntryParser.java | 8 +-
.../commons/net/io/DotTerminatedMessageWriter.java | 52 +--
.../commons/net/io/FromNetASCIIInputStream.java | 12 +-
.../commons/net/io/FromNetASCIIOutputStream.java | 18 +-
.../apache/commons/net/io/SocketInputStream.java | 6 +-
.../apache/commons/net/io/SocketOutputStream.java | 6 +-
.../commons/net/io/ToNetASCIIInputStream.java | 24 +-
.../commons/net/io/ToNetASCIIOutputStream.java | 10 +-
.../org/apache/commons/net/nntp/NNTPClient.java | 78 ++--
.../commons/net/nntp/NewGroupsOrNewsQuery.java | 44 +--
.../org/apache/commons/net/nntp/NewsgroupInfo.java | 36 +-
.../apache/commons/net/nntp/SimpleNNTPHeader.java | 48 +--
.../org/apache/commons/net/ntp/NTPUDPClient.java | 8 +-
.../java/org/apache/commons/net/ntp/TimeInfo.java | 90 ++---
.../commons/net/pop3/ExtendedPOP3Client.java | 4 +-
.../java/org/apache/commons/net/pop3/POP3.java | 80 ++--
.../org/apache/commons/net/pop3/POP3Client.java | 28 +-
.../org/apache/commons/net/pop3/POP3Command.java | 8 +-
.../org/apache/commons/net/pop3/POP3SClient.java | 4 +-
.../org/apache/commons/net/smtp/RelayPath.java | 14 +-
.../java/org/apache/commons/net/smtp/SMTP.java | 78 ++--
.../org/apache/commons/net/smtp/SMTPClient.java | 2 +-
.../org/apache/commons/net/smtp/SMTPCommand.java | 8 +-
.../org/apache/commons/net/smtp/SMTPSClient.java | 4 +-
.../apache/commons/net/smtp/SimpleSMTPHeader.java | 54 +--
.../java/org/apache/commons/net/telnet/Telnet.java | 290 +++++++-------
.../apache/commons/net/telnet/TelnetClient.java | 40 +-
.../commons/net/telnet/TelnetInputStream.java | 320 ++++++++--------
.../apache/commons/net/telnet/TelnetOption.java | 12 +-
.../commons/net/telnet/TelnetOutputStream.java | 56 +--
.../java/org/apache/commons/net/tftp/TFTP.java | 42 +--
.../org/apache/commons/net/tftp/TFTPAckPacket.java | 4 +-
.../org/apache/commons/net/tftp/TFTPClient.java | 6 +-
.../apache/commons/net/tftp/TFTPDataPacket.java | 78 ++--
.../apache/commons/net/tftp/TFTPErrorPacket.java | 38 +-
.../org/apache/commons/net/tftp/TFTPPacket.java | 12 +-
.../apache/commons/net/tftp/TFTPRequestPacket.java | 38 +-
.../org/apache/commons/net/time/TimeUDPClient.java | 16 +-
.../org/apache/commons/net/util/ListenerList.java | 12 +-
.../org/apache/commons/net/ftp/FTPClientTest.java | 18 +-
.../commons/net/pop3/POP3ConstructorTest.java | 8 +-
.../apache/commons/net/tftp/TFTPServerMain.java | 4 +-
56 files changed, 1167 insertions(+), 1167 deletions(-)
diff --git a/src/main/java/org/apache/commons/net/PrintCommandListener.java b/src/main/java/org/apache/commons/net/PrintCommandListener.java
index 13f2fd6..7765a77 100644
--- a/src/main/java/org/apache/commons/net/PrintCommandListener.java
+++ b/src/main/java/org/apache/commons/net/PrintCommandListener.java
@@ -30,10 +30,10 @@ import java.io.PrintWriter;
public class PrintCommandListener implements ProtocolCommandListener
{
- private final PrintWriter __writer;
- private final boolean __nologin;
- private final char __eolMarker;
- private final boolean __directionMarker;
+ private final PrintWriter writer;
+ private final boolean nologin;
+ private final char eolMarker;
+ private final boolean directionMarker;
/**
* Create the default instance which prints everything.
@@ -141,49 +141,49 @@ public class PrintCommandListener implements ProtocolCommandListener
*/
public PrintCommandListener(final PrintWriter writer, final boolean suppressLogin, final char eolMarker,
final boolean showDirection) {
- __writer = writer;
- __nologin = suppressLogin;
- __eolMarker = eolMarker;
- __directionMarker = showDirection;
+ this.writer = writer;
+ this.nologin = suppressLogin;
+ this.eolMarker = eolMarker;
+ this.directionMarker = showDirection;
}
@Override
public void protocolCommandSent(final ProtocolCommandEvent event)
{
- if (__directionMarker) {
- __writer.print("> ");
+ if (directionMarker) {
+ writer.print("> ");
}
- if (__nologin) {
+ if (nologin) {
final String cmd = event.getCommand();
if ("PASS".equalsIgnoreCase(cmd) || "USER".equalsIgnoreCase(cmd)) {
- __writer.print(cmd);
- __writer.println(" *******"); // Don't bother with EOL marker for this!
+ writer.print(cmd);
+ writer.println(" *******"); // Don't bother with EOL marker for this!
} else {
final String IMAP_LOGIN = "LOGIN";
if (IMAP_LOGIN.equalsIgnoreCase(cmd)) { // IMAP
String msg = event.getMessage();
msg=msg.substring(0, msg.indexOf(IMAP_LOGIN)+IMAP_LOGIN.length());
- __writer.print(msg);
- __writer.println(" *******"); // Don't bother with EOL marker for this!
+ writer.print(msg);
+ writer.println(" *******"); // Don't bother with EOL marker for this!
} else {
- __writer.print(getPrintableString(event.getMessage()));
+ writer.print(getPrintableString(event.getMessage()));
}
}
} else {
- __writer.print(getPrintableString(event.getMessage()));
+ writer.print(getPrintableString(event.getMessage()));
}
- __writer.flush();
+ writer.flush();
}
private String getPrintableString(final String msg){
- if (__eolMarker == 0) {
+ if (eolMarker == 0) {
return msg;
}
final int pos = msg.indexOf(SocketClient.NETASCII_EOL);
if (pos > 0) {
final StringBuilder sb = new StringBuilder();
sb.append(msg.substring(0,pos));
- sb.append(__eolMarker);
+ sb.append(eolMarker);
sb.append(msg.substring(pos));
return sb.toString();
}
@@ -193,11 +193,11 @@ public class PrintCommandListener implements ProtocolCommandListener
@Override
public void protocolReplyReceived(final ProtocolCommandEvent event)
{
- if (__directionMarker) {
- __writer.print("< ");
+ if (directionMarker) {
+ writer.print("< ");
}
- __writer.print(event.getMessage());
- __writer.flush();
+ writer.print(event.getMessage());
+ writer.flush();
}
}
diff --git a/src/main/java/org/apache/commons/net/ProtocolCommandEvent.java b/src/main/java/org/apache/commons/net/ProtocolCommandEvent.java
index da9fce8..4c34887 100644
--- a/src/main/java/org/apache/commons/net/ProtocolCommandEvent.java
+++ b/src/main/java/org/apache/commons/net/ProtocolCommandEvent.java
@@ -36,9 +36,9 @@ public class ProtocolCommandEvent extends EventObject
{
private static final long serialVersionUID = 403743538418947240L;
- private final int __replyCode;
- private final boolean __isCommand;
- private final String __message, __command;
+ private final int replyCode;
+ private final boolean isCommand;
+ private final String message, command;
/***
* Creates a ProtocolCommandEvent signalling a command was sent to
@@ -55,10 +55,10 @@ public class ProtocolCommandEvent extends EventObject
public ProtocolCommandEvent(final Object source, final String command, final String message)
{
super(source);
- __replyCode = 0;
- __message = message;
- __isCommand = true;
- __command = command;
+ this.replyCode = 0;
+ this.message = message;
+ this.isCommand = true;
+ this.command = command;
}
@@ -79,10 +79,10 @@ public class ProtocolCommandEvent extends EventObject
public ProtocolCommandEvent(final Object source, final int replyCode, final String message)
{
super(source);
- __replyCode = replyCode;
- __message = message;
- __isCommand = false;
- __command = null;
+ this.replyCode = replyCode;
+ this.message = message;
+ this.isCommand = false;
+ this.command = null;
}
/***
@@ -95,7 +95,7 @@ public class ProtocolCommandEvent extends EventObject
***/
public String getCommand()
{
- return __command;
+ return command;
}
@@ -108,7 +108,7 @@ public class ProtocolCommandEvent extends EventObject
***/
public int getReplyCode()
{
- return __replyCode;
+ return replyCode;
}
/***
@@ -120,7 +120,7 @@ public class ProtocolCommandEvent extends EventObject
***/
public boolean isCommand()
{
- return __isCommand;
+ return isCommand;
}
/***
@@ -143,6 +143,6 @@ public class ProtocolCommandEvent extends EventObject
***/
public String getMessage()
{
- return __message;
+ return message;
}
}
diff --git a/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java b/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
index 3e1017d..f04a319 100644
--- a/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
+++ b/src/main/java/org/apache/commons/net/ProtocolCommandSupport.java
@@ -37,8 +37,8 @@ public class ProtocolCommandSupport implements Serializable
{
private static final long serialVersionUID = -8017692739988399978L;
- private final Object __source;
- private final ListenerList __listeners;
+ private final Object source;
+ private final ListenerList listeners;
/***
* Creates a ProtocolCommandSupport instance using the indicated source
@@ -48,8 +48,8 @@ public class ProtocolCommandSupport implements Serializable
***/
public ProtocolCommandSupport(final Object source)
{
- __listeners = new ListenerList();
- __source = source;
+ this.listeners = new ListenerList();
+ this.source = source;
}
@@ -68,9 +68,9 @@ public class ProtocolCommandSupport implements Serializable
{
ProtocolCommandEvent event;
- event = new ProtocolCommandEvent(__source, command, message);
+ event = new ProtocolCommandEvent(source, command, message);
- for (final EventListener listener : __listeners)
+ for (final EventListener listener : listeners)
{
((ProtocolCommandListener)listener).protocolCommandSent(event);
}
@@ -92,9 +92,9 @@ public class ProtocolCommandSupport implements Serializable
public void fireReplyReceived(final int replyCode, final String message)
{
ProtocolCommandEvent event;
- event = new ProtocolCommandEvent(__source, replyCode, message);
+ event = new ProtocolCommandEvent(source, replyCode, message);
- for (final EventListener listener : __listeners)
+ for (final EventListener listener : listeners)
{
((ProtocolCommandListener)listener).protocolReplyReceived(event);
}
@@ -107,7 +107,7 @@ public class ProtocolCommandSupport implements Serializable
***/
public void addProtocolCommandListener(final ProtocolCommandListener listener)
{
- __listeners.addListener(listener);
+ listeners.addListener(listener);
}
/***
@@ -117,7 +117,7 @@ public class ProtocolCommandSupport implements Serializable
***/
public void removeProtocolCommandListener(final ProtocolCommandListener listener)
{
- __listeners.removeListener(listener);
+ listeners.removeListener(listener);
}
@@ -128,7 +128,7 @@ public class ProtocolCommandSupport implements Serializable
***/
public int getListenerCount()
{
- return __listeners.getListenerCount();
+ return listeners.getListenerCount();
}
}
diff --git a/src/main/java/org/apache/commons/net/SocketClient.java b/src/main/java/org/apache/commons/net/SocketClient.java
index bd5c949..90ff247 100644
--- a/src/main/java/org/apache/commons/net/SocketClient.java
+++ b/src/main/java/org/apache/commons/net/SocketClient.java
@@ -72,7 +72,7 @@ public abstract class SocketClient
* A ProtocolCommandSupport object used to manage the registering of
* ProtocolCommandListeners and the firing of ProtocolCommandEvents.
*/
- private ProtocolCommandSupport __commandSupport;
+ private ProtocolCommandSupport commandSupport;
/** The timeout to use after opening a socket. */
protected int _timeout_;
@@ -810,7 +810,7 @@ public abstract class SocketClient
* Create the CommandSupport instance if required
*/
protected void createCommandSupport(){
- __commandSupport = new ProtocolCommandSupport(this);
+ commandSupport = new ProtocolCommandSupport(this);
}
/**
@@ -821,7 +821,7 @@ public abstract class SocketClient
* @since 3.0
*/
protected ProtocolCommandSupport getCommandSupport() {
- return __commandSupport;
+ return commandSupport;
}
/**
diff --git a/src/main/java/org/apache/commons/net/bsd/RCommandClient.java b/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
index e7c204e..ca07dbb 100644
--- a/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
+++ b/src/main/java/org/apache/commons/net/bsd/RCommandClient.java
@@ -106,7 +106,7 @@ public class RCommandClient extends RExecClient
// Overrides method in RExecClient in order to implement proper
// port number limitations.
@Override
- InputStream _createErrorStream() throws IOException
+ InputStream createErrorStream() throws IOException
{
int localPort;
ServerSocket server;
diff --git a/src/main/java/org/apache/commons/net/bsd/RExecClient.java b/src/main/java/org/apache/commons/net/bsd/RExecClient.java
index 23e9d21..32734a6 100644
--- a/src/main/java/org/apache/commons/net/bsd/RExecClient.java
+++ b/src/main/java/org/apache/commons/net/bsd/RExecClient.java
@@ -74,7 +74,7 @@ public class RExecClient extends SocketClient
***/
public static final int DEFAULT_PORT = 512;
- private boolean __remoteVerificationEnabled;
+ private boolean remoteVerificationEnabled;
/***
* If a separate error stream is requested, <code>_errorStream_</code>
@@ -86,7 +86,7 @@ public class RExecClient extends SocketClient
// This can be overridden in local package to implement port range
// limitations of rcmd and rlogin
- InputStream _createErrorStream() throws IOException
+ InputStream createErrorStream() throws IOException
{
ServerSocket server;
Socket socket;
@@ -100,7 +100,7 @@ public class RExecClient extends SocketClient
socket = server.accept();
server.close();
- if (__remoteVerificationEnabled && !verifyRemote(socket))
+ if (remoteVerificationEnabled && !verifyRemote(socket))
{
socket.close();
throw new IOException(
@@ -207,7 +207,7 @@ public class RExecClient extends SocketClient
if (separateErrorStream)
{
- _errorStream_ = _createErrorStream();
+ _errorStream_ = createErrorStream();
}
else
{
@@ -279,7 +279,7 @@ public class RExecClient extends SocketClient
***/
public final void setRemoteVerificationEnabled(final boolean enable)
{
- __remoteVerificationEnabled = enable;
+ remoteVerificationEnabled = enable;
}
/***
@@ -291,7 +291,7 @@ public class RExecClient extends SocketClient
***/
public final boolean isRemoteVerificationEnabled()
{
- return __remoteVerificationEnabled;
+ return remoteVerificationEnabled;
}
}
diff --git a/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java b/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
index 6dfc195..c6027fd 100644
--- a/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
+++ b/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
@@ -41,7 +41,7 @@ public final class DaytimeTCPClient extends SocketClient
// Received dates will likely be less than 64 characters.
// This is a temporary buffer used while receiving data.
- private final char[] __buffer = new char[64];
+ private final char[] buffer = new char[64];
/**
* The default DaytimeTCPClient constructor. It merely sets the default
@@ -68,18 +68,18 @@ public final class DaytimeTCPClient extends SocketClient
public String getTime() throws IOException
{
int read;
- final StringBuilder result = new StringBuilder(__buffer.length);
+ final StringBuilder result = new StringBuilder(buffer.length);
BufferedReader reader;
reader = new BufferedReader(new InputStreamReader(_input_, getCharset()));
while (true)
{
- read = reader.read(__buffer, 0, __buffer.length);
+ read = reader.read(buffer, 0, buffer.length);
if (read <= 0) {
break;
}
- result.append(__buffer, 0, read);
+ result.append(buffer, 0, read);
}
return result.toString();
diff --git a/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java b/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java
index 3f2d941..42b4f58 100644
--- a/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java
+++ b/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java
@@ -43,9 +43,9 @@ public final class DaytimeUDPClient extends DatagramSocketClient
/** The default daytime port. It is set to 13 according to RFC 867. */
public static final int DEFAULT_PORT = 13;
- private final byte[] __dummyData = new byte[1];
+ private final byte[] dummyData = new byte[1];
// Received dates should be less than 256 bytes
- private final byte[] __timeData = new byte[256];
+ private final byte[] timeData = new byte[256];
/**
* Retrieves the time string from the specified server and port and
@@ -61,8 +61,8 @@ public final class DaytimeUDPClient extends DatagramSocketClient
DatagramPacket sendPacket, receivePacket;
sendPacket =
- new DatagramPacket(__dummyData, __dummyData.length, host, port);
- receivePacket = new DatagramPacket(__timeData, __timeData.length);
+ new DatagramPacket(dummyData, dummyData.length, host, port);
+ receivePacket = new DatagramPacket(timeData, timeData.length);
_socket_.send(sendPacket);
_socket_.receive(receivePacket);
diff --git a/src/main/java/org/apache/commons/net/discard/DiscardUDPClient.java b/src/main/java/org/apache/commons/net/discard/DiscardUDPClient.java
index 65fd497..2fff6da 100644
--- a/src/main/java/org/apache/commons/net/discard/DiscardUDPClient.java
+++ b/src/main/java/org/apache/commons/net/discard/DiscardUDPClient.java
@@ -41,11 +41,11 @@ public class DiscardUDPClient extends DatagramSocketClient
/*** The default discard port. It is set to 9 according to RFC 863. ***/
public static final int DEFAULT_PORT = 9;
- DatagramPacket _sendPacket;
+ DatagramPacket sendPacket;
public DiscardUDPClient()
{
- _sendPacket = new DatagramPacket(new byte[0], 0);
+ sendPacket = new DatagramPacket(new byte[0], 0);
}
@@ -63,11 +63,11 @@ public class DiscardUDPClient extends DatagramSocketClient
public void send(final byte[] data, final int length, final InetAddress host, final int port)
throws IOException
{
- _sendPacket.setData(data);
- _sendPacket.setLength(length);
- _sendPacket.setAddress(host);
- _sendPacket.setPort(port);
- _socket_.send(_sendPacket);
+ sendPacket.setData(data);
+ sendPacket.setLength(length);
+ sendPacket.setAddress(host);
+ sendPacket.setPort(port);
+ _socket_.send(sendPacket);
}
diff --git a/src/main/java/org/apache/commons/net/echo/EchoUDPClient.java b/src/main/java/org/apache/commons/net/echo/EchoUDPClient.java
index 723c514..cd57f47 100644
--- a/src/main/java/org/apache/commons/net/echo/EchoUDPClient.java
+++ b/src/main/java/org/apache/commons/net/echo/EchoUDPClient.java
@@ -43,7 +43,7 @@ public final class EchoUDPClient extends DiscardUDPClient
/*** The default echo port. It is set to 7 according to RFC 862. ***/
public static final int DEFAULT_PORT = 7;
- private final DatagramPacket __receivePacket = new DatagramPacket(new byte[0], 0);
+ private final DatagramPacket receivePacket = new DatagramPacket(new byte[0], 0);
/***
* Sends the specified data to the specified server at the default echo
@@ -85,10 +85,10 @@ public final class EchoUDPClient extends DiscardUDPClient
***/
public int receive(final byte[] data, final int length) throws IOException
{
- __receivePacket.setData(data);
- __receivePacket.setLength(length);
- _socket_.receive(__receivePacket);
- return __receivePacket.getLength();
+ receivePacket.setData(data);
+ receivePacket.setLength(length);
+ _socket_.receive(receivePacket);
+ return receivePacket.getLength();
}
/*** Same as <code> receive(data, data.length)</code>
diff --git a/src/main/java/org/apache/commons/net/finger/FingerClient.java b/src/main/java/org/apache/commons/net/finger/FingerClient.java
index 8cf66c2..0d1aca1 100644
--- a/src/main/java/org/apache/commons/net/finger/FingerClient.java
+++ b/src/main/java/org/apache/commons/net/finger/FingerClient.java
@@ -59,7 +59,7 @@ public class FingerClient extends SocketClient
private static final String __LONG_FLAG = "/W ";
- private transient char[] __buffer = new char[1024];
+ private transient char[] buffer = new char[1024];
/***
* The default FingerClient constructor. Initializes the
@@ -84,16 +84,16 @@ public class FingerClient extends SocketClient
public String query(final boolean longOutput, final String username) throws IOException
{
int read;
- final StringBuilder result = new StringBuilder(__buffer.length);
+ final StringBuilder result = new StringBuilder(buffer.length);
try (BufferedReader input = new BufferedReader(
new InputStreamReader(getInputStream(longOutput, username), getCharset()));) {
while (true) {
- read = input.read(__buffer, 0, __buffer.length);
+ read = input.read(buffer, 0, buffer.length);
if (read <= 0) {
break;
}
- result.append(__buffer, 0, read);
+ result.append(buffer, 0, read);
}
}
diff --git a/src/main/java/org/apache/commons/net/ftp/FTP.java b/src/main/java/org/apache/commons/net/ftp/FTP.java
index c144005..cd47c13 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTP.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTP.java
@@ -213,7 +213,7 @@ public class FTP extends SocketClient
/** Length of the FTP reply code (3 alphanumerics) */
public static final int REPLY_CODE_LEN = 3;
- private static final String __modes = "AEILNTCFRPSBC";
+ private static final String modes = "AEILNTCFRPSBC";
protected int _replyCode;
protected ArrayList<String> _replyLines;
@@ -1083,12 +1083,12 @@ public class FTP extends SocketClient
{
final StringBuilder arg = new StringBuilder();
- arg.append(__modes.charAt(fileType));
+ arg.append(modes.charAt(fileType));
arg.append(' ');
if (fileType == LOCAL_FILE_TYPE) {
arg.append(formatOrByteSize);
} else {
- arg.append(__modes.charAt(formatOrByteSize));
+ arg.append(modes.charAt(formatOrByteSize));
}
return sendCommand(FTPCmd.TYPE, arg.toString());
@@ -1113,7 +1113,7 @@ public class FTP extends SocketClient
public int type(final int fileType) throws IOException
{
return sendCommand(FTPCmd.TYPE,
- __modes.substring(fileType, fileType + 1));
+ modes.substring(fileType, fileType + 1));
}
/***
@@ -1134,7 +1134,7 @@ public class FTP extends SocketClient
public int stru(final int structure) throws IOException
{
return sendCommand(FTPCmd.STRU,
- __modes.substring(structure, structure + 1));
+ modes.substring(structure, structure + 1));
}
/***
@@ -1155,7 +1155,7 @@ public class FTP extends SocketClient
public int mode(final int mode) throws IOException
{
return sendCommand(FTPCmd.MODE,
- __modes.substring(mode, mode + 1));
+ modes.substring(mode, mode + 1));
}
/***
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPClient.java b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
index 56e0447..3fe9e17 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPClient.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPClient.java
@@ -356,65 +356,65 @@ implements Configurable
*/
public static final int PASSIVE_REMOTE_DATA_CONNECTION_MODE = 3;
- private int __dataConnectionMode;
- private int __dataTimeout;
- private int __passivePort;
+ private int dataConnectionMode;
+ private int dataTimeout;
+ private int passivePort;
private String __passiveHost;
- private final Random __random;
- private int __activeMinPort;
- private int __activeMaxPort;
- private InetAddress __activeExternalHost;
- private InetAddress __reportActiveExternalHost; // overrides __activeExternalHost in EPRT/PORT commands
+ private final Random random;
+ private int activeMinPort;
+ private int activeMaxPort;
+ private InetAddress activeExternalHost;
+ private InetAddress reportActiveExternalHost; // overrides __activeExternalHost in EPRT/PORT commands
/** The address to bind to on passive connections, if necessary. */
- private InetAddress __passiveLocalHost;
+ private InetAddress passiveLocalHost;
private int __fileType;
@SuppressWarnings("unused") // fields are written, but currently not read
- private int __fileFormat;
+ private int fileFormat;
@SuppressWarnings("unused") // field is written, but currently not read
- private int __fileStructure;
+ private int fileStructure;
@SuppressWarnings("unused") // field is written, but currently not read
- private int __fileTransferMode;
- private boolean __remoteVerificationEnabled;
- private long __restartOffset;
+ private int fileTransferMode;
+ private boolean remoteVerificationEnabled;
+ private long restartOffset;
private FTPFileEntryParserFactory __parserFactory;
- private int __bufferSize; // buffersize for buffered data streams
- private int __sendDataSocketBufferSize;
- private int __receiveDataSocketBufferSize;
- private boolean __listHiddenFiles;
- private boolean __useEPSVwithIPv4; // whether to attempt EPSV with an IPv4 connection
+ private int bufferSize; // buffersize for buffered data streams
+ private int sendDataSocketBufferSize;
+ private int receiveDataSocketBufferSize;
+ private boolean listHiddenFiles;
+ private boolean useEPSVwithIPv4; // whether to attempt EPSV with an IPv4 connection
// __systemName is a cached value that should not be referenced directly
// except when assigned in getSystemName and __initDefaults.
- private String __systemName;
+ private String systemName;
// __entryParser is a cached value that should not be referenced directly
// except when assigned in listFiles(String, String) and __initDefaults.
- private FTPFileEntryParser __entryParser;
+ private FTPFileEntryParser entryParser;
// Key used to create the parser; necessary to ensure that the parser type is not ignored
- private String __entryParserKey;
+ private String entryParserKey;
- private FTPClientConfig __configuration;
+ private FTPClientConfig configuration;
// Listener used by store/retrieve methods to handle keepalive
- private CopyStreamListener __copyStreamListener;
+ private CopyStreamListener copyStreamListener;
// How long to wait before sending another control keep-alive message
- private long __controlKeepAliveTimeout;
+ private long controlKeepAliveTimeout;
// How long to wait (ms) for keepalive message replies before continuing
// Most FTP servers don't seem to support concurrent control and data connection usage
- private int __controlKeepAliveReplyTimeout=1000;
+ private int controlKeepAliveReplyTimeout=1000;
// Debug counts for NOOP acks
- private int[] __cslDebug;
+ private int[] cslDebug;
/**
* Enable or disable replacement of internal IP in passive mode. Default enabled
* using {code NatServerResolverImpl}.
*/
- private HostnameResolver __passiveNatWorkaroundStrategy = new NatServerResolverImpl(this);
+ private HostnameResolver passiveNatWorkaroundStrategy = new NatServerResolverImpl(this);
/** Pattern for PASV mode responses. Groups: (n,n,n,n),(n),(n) */
private static final java.util.regex.Pattern __PARMS_PAT;
@@ -425,10 +425,10 @@ implements Configurable
}
/** Controls the automatic server encoding detection (only UTF-8 supported). */
- private boolean __autodetectEncoding = false;
+ private boolean autodetectEncoding = false;
/** Map of FEAT responses. If null, has not been initialised. */
- private HashMap<String, Set<String>> __featuresMap;
+ private HashMap<String, Set<String>> featuresMap;
private static class PropertiesSingleton {
@@ -479,36 +479,36 @@ implements Configurable
*/
public FTPClient()
{
- __initDefaults();
- __dataTimeout = -1;
- __remoteVerificationEnabled = true;
+ initDefaults();
+ dataTimeout = -1;
+ remoteVerificationEnabled = true;
__parserFactory = new DefaultFTPFileEntryParserFactory();
- __configuration = null;
- __listHiddenFiles = false;
- __useEPSVwithIPv4 = false;
- __random = new Random();
- __passiveLocalHost = null;
+ configuration = null;
+ listHiddenFiles = false;
+ useEPSVwithIPv4 = false;
+ random = new Random();
+ passiveLocalHost = null;
}
- private void __initDefaults()
+ private void initDefaults()
{
- __dataConnectionMode = ACTIVE_LOCAL_DATA_CONNECTION_MODE;
+ dataConnectionMode = ACTIVE_LOCAL_DATA_CONNECTION_MODE;
__passiveHost = null;
- __passivePort = -1;
- __activeExternalHost = null;
- __reportActiveExternalHost = null;
- __activeMinPort = 0;
- __activeMaxPort = 0;
+ passivePort = -1;
+ activeExternalHost = null;
+ reportActiveExternalHost = null;
+ activeMinPort = 0;
+ activeMaxPort = 0;
__fileType = FTP.ASCII_FILE_TYPE;
- __fileStructure = FTP.FILE_STRUCTURE;
- __fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
- __fileTransferMode = FTP.STREAM_TRANSFER_MODE;
- __restartOffset = 0;
- __systemName = null;
- __entryParser = null;
- __entryParserKey = "";
- __featuresMap = null;
+ fileStructure = FTP.FILE_STRUCTURE;
+ fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
+ fileTransferMode = FTP.STREAM_TRANSFER_MODE;
+ restartOffset = 0;
+ systemName = null;
+ entryParser = null;
+ entryParserKey = "";
+ featuresMap = null;
}
/**
@@ -528,7 +528,7 @@ implements Configurable
* (i.e. enclosing quotes are missing or embedded quotes are not doubled)
*/
// package protected for access by test cases
- static String __parsePathname(final String reply)
+ static String parsePathname(final String reply)
{
final String param = reply.substring(REPLY_CODE_LEN + 1);
if (param.startsWith("\"")) {
@@ -581,7 +581,7 @@ implements Configurable
{
final int oct1 = Integer.parseInt(m.group(2));
final int oct2 = Integer.parseInt(m.group(3));
- __passivePort = (oct1 << 8) | oct2;
+ passivePort = (oct1 << 8) | oct2;
}
catch (final NumberFormatException e)
{
@@ -589,9 +589,9 @@ implements Configurable
"Could not parse passive port information.\nServer Reply: " + reply);
}
- if (__passiveNatWorkaroundStrategy != null) {
+ if (passiveNatWorkaroundStrategy != null) {
try {
- final String passiveHost = __passiveNatWorkaroundStrategy.resolve(__passiveHost);
+ final String passiveHost = passiveNatWorkaroundStrategy.resolve(__passiveHost);
if (!__passiveHost.equals(passiveHost)) {
fireReplyReceived(0,
"[Replacing PASV mode reply address "+__passiveHost+" with "+passiveHost+"]\n");
@@ -636,10 +636,10 @@ implements Configurable
// in EPSV mode, the passive host address is implicit
__passiveHost = getRemoteAddress().getHostAddress();
- __passivePort = port;
+ passivePort = port;
}
- private boolean __storeFile(final FTPCmd command, final String remote, final InputStream local)
+ private boolean storeFile(final FTPCmd command, final String remote, final InputStream local)
throws IOException
{
return _storeFile(command.getCommand(), remote, local);
@@ -672,15 +672,15 @@ implements Configurable
}
CSL csl = null;
- if (__controlKeepAliveTimeout > 0) {
- csl = new CSL(this, __controlKeepAliveTimeout, __controlKeepAliveReplyTimeout);
+ if (controlKeepAliveTimeout > 0) {
+ csl = new CSL(this, controlKeepAliveTimeout, controlKeepAliveReplyTimeout);
}
// Treat everything else as binary for now
try
{
Util.copyStream(local, output, getBufferSize(),
- CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
+ CopyStreamEvent.UNKNOWN_STREAM_SIZE, mergeListeners(csl),
false);
output.close(); // ensure the file is fully written
socket.close(); // done writing the file
@@ -695,12 +695,12 @@ implements Configurable
throw e;
} finally {
if (csl != null) {
- __cslDebug = csl.cleanUp(); // fetch any outstanding keepalive replies
+ cslDebug = csl.cleanUp(); // fetch any outstanding keepalive replies
}
}
}
- private OutputStream __storeFileStream(final FTPCmd command, final String remote)
+ private OutputStream storeFileStream(final FTPCmd command, final String remote)
throws IOException
{
return _storeFileStream(command.getCommand(), remote);
@@ -812,8 +812,8 @@ implements Configurable
protected Socket _openDataConnection_(final String command, final String arg)
throws IOException
{
- if (__dataConnectionMode != ACTIVE_LOCAL_DATA_CONNECTION_MODE &&
- __dataConnectionMode != PASSIVE_LOCAL_DATA_CONNECTION_MODE) {
+ if (dataConnectionMode != ACTIVE_LOCAL_DATA_CONNECTION_MODE &&
+ dataConnectionMode != PASSIVE_LOCAL_DATA_CONNECTION_MODE) {
return null;
}
@@ -821,7 +821,7 @@ implements Configurable
Socket socket;
- if (__dataConnectionMode == ACTIVE_LOCAL_DATA_CONNECTION_MODE)
+ if (dataConnectionMode == ACTIVE_LOCAL_DATA_CONNECTION_MODE)
{
// if no activePortRange was set (correctly) -> getActivePort() = 0
// -> new ServerSocket(0) -> bind to any free local port
@@ -843,7 +843,7 @@ implements Configurable
}
}
- if ((__restartOffset > 0) && !restart(__restartOffset)) {
+ if ((restartOffset > 0) && !restart(restartOffset)) {
return null;
}
@@ -855,20 +855,20 @@ implements Configurable
// the data connection. It may be desirable to let this be a
// separately configurable value. In any case, we really want
// to allow preventing the accept from blocking indefinitely.
- if (__dataTimeout >= 0) {
- server.setSoTimeout(__dataTimeout);
+ if (dataTimeout >= 0) {
+ server.setSoTimeout(dataTimeout);
}
socket = server.accept();
// Ensure the timeout is set before any commands are issued on the new socket
- if (__dataTimeout >= 0) {
- socket.setSoTimeout(__dataTimeout);
+ if (dataTimeout >= 0) {
+ socket.setSoTimeout(dataTimeout);
}
- if (__receiveDataSocketBufferSize > 0) {
- socket.setReceiveBufferSize(__receiveDataSocketBufferSize);
+ if (receiveDataSocketBufferSize > 0) {
+ socket.setReceiveBufferSize(receiveDataSocketBufferSize);
}
- if (__sendDataSocketBufferSize > 0) {
- socket.setSendBufferSize(__sendDataSocketBufferSize);
+ if (sendDataSocketBufferSize > 0) {
+ socket.setSendBufferSize(sendDataSocketBufferSize);
}
}
}
@@ -900,26 +900,26 @@ implements Configurable
}
socket = _socketFactory_.createSocket();
- if (__receiveDataSocketBufferSize > 0) {
- socket.setReceiveBufferSize(__receiveDataSocketBufferSize);
+ if (receiveDataSocketBufferSize > 0) {
+ socket.setReceiveBufferSize(receiveDataSocketBufferSize);
}
- if (__sendDataSocketBufferSize > 0) {
- socket.setSendBufferSize(__sendDataSocketBufferSize);
+ if (sendDataSocketBufferSize > 0) {
+ socket.setSendBufferSize(sendDataSocketBufferSize);
}
- if (__passiveLocalHost != null) {
- socket.bind(new InetSocketAddress(__passiveLocalHost, 0));
+ if (passiveLocalHost != null) {
+ socket.bind(new InetSocketAddress(passiveLocalHost, 0));
}
// For now, let's just use the data timeout value for waiting for
// the data connection. It may be desirable to let this be a
// separately configurable value. In any case, we really want
// to allow preventing the accept from blocking indefinitely.
- if (__dataTimeout >= 0) {
- socket.setSoTimeout(__dataTimeout);
+ if (dataTimeout >= 0) {
+ socket.setSoTimeout(dataTimeout);
}
- socket.connect(new InetSocketAddress(__passiveHost, __passivePort), connectTimeout);
- if ((__restartOffset > 0) && !restart(__restartOffset))
+ socket.connect(new InetSocketAddress(__passiveHost, passivePort), connectTimeout);
+ if ((restartOffset > 0) && !restart(restartOffset))
{
socket.close();
return null;
@@ -932,7 +932,7 @@ implements Configurable
}
}
- if (__remoteVerificationEnabled && !verifyRemote(socket))
+ if (remoteVerificationEnabled && !verifyRemote(socket))
{
// Grab the host before we close the socket to avoid NET-663
final InetAddress socketHost = socket.getInetAddress();
@@ -964,10 +964,10 @@ implements Configurable
protected void _connectAction_(final Reader socketIsReader) throws IOException
{
super._connectAction_(socketIsReader); // sets up _input_ and _output_
- __initDefaults();
+ initDefaults();
// must be after super._connectAction_(), because otherwise we get an
// Exception claiming we're not connected
- if ( __autodetectEncoding )
+ if ( autodetectEncoding )
{
final ArrayList<String> oldReplyLines = new ArrayList<> (_replyLines);
final int oldReplyCode = _replyCode;
@@ -1000,7 +1000,7 @@ implements Configurable
*/
public void setDataTimeout(final int timeout)
{
- __dataTimeout = timeout;
+ dataTimeout = timeout;
}
/**
@@ -1027,7 +1027,7 @@ implements Configurable
public void disconnect() throws IOException
{
super.disconnect();
- __initDefaults();
+ initDefaults();
}
@@ -1042,7 +1042,7 @@ implements Configurable
*/
public void setRemoteVerificationEnabled(final boolean enable)
{
- __remoteVerificationEnabled = enable;
+ remoteVerificationEnabled = enable;
}
/**
@@ -1054,7 +1054,7 @@ implements Configurable
*/
public boolean isRemoteVerificationEnabled()
{
- return __remoteVerificationEnabled;
+ return remoteVerificationEnabled;
}
/**
@@ -1231,7 +1231,7 @@ implements Configurable
FTPReply.isPositiveCompletion(getReply())))
{
- __initDefaults();
+ initDefaults();
return true;
}
@@ -1251,9 +1251,9 @@ implements Configurable
*/
public void enterLocalActiveMode()
{
- __dataConnectionMode = ACTIVE_LOCAL_DATA_CONNECTION_MODE;
+ dataConnectionMode = ACTIVE_LOCAL_DATA_CONNECTION_MODE;
__passiveHost = null;
- __passivePort = -1;
+ passivePort = -1;
}
@@ -1274,11 +1274,11 @@ implements Configurable
*/
public void enterLocalPassiveMode()
{
- __dataConnectionMode = PASSIVE_LOCAL_DATA_CONNECTION_MODE;
+ dataConnectionMode = PASSIVE_LOCAL_DATA_CONNECTION_MODE;
// These will be set when just before a data connection is opened
// in _openDataConnection_()
__passiveHost = null;
- __passivePort = -1;
+ passivePort = -1;
}
@@ -1311,9 +1311,9 @@ implements Configurable
{
if (FTPReply.isPositiveCompletion(port(host, port)))
{
- __dataConnectionMode = ACTIVE_REMOTE_DATA_CONNECTION_MODE;
+ dataConnectionMode = ACTIVE_REMOTE_DATA_CONNECTION_MODE;
__passiveHost = null;
- __passivePort = -1;
+ passivePort = -1;
return true;
}
return false;
@@ -1347,7 +1347,7 @@ implements Configurable
return false;
}
- __dataConnectionMode = PASSIVE_REMOTE_DATA_CONNECTION_MODE;
+ dataConnectionMode = PASSIVE_REMOTE_DATA_CONNECTION_MODE;
_parsePassiveModeReply(_replyLines.get(0));
return true;
@@ -1384,7 +1384,7 @@ implements Configurable
*/
public int getPassivePort()
{
- return __passivePort;
+ return passivePort;
}
@@ -1397,7 +1397,7 @@ implements Configurable
*/
public int getDataConnectionMode()
{
- return __dataConnectionMode;
+ return dataConnectionMode;
}
/**
@@ -1407,13 +1407,13 @@ implements Configurable
*/
private int getActivePort()
{
- if (__activeMinPort > 0 && __activeMaxPort >= __activeMinPort)
+ if (activeMinPort > 0 && activeMaxPort >= activeMinPort)
{
- if (__activeMaxPort == __activeMinPort) {
- return __activeMaxPort;
+ if (activeMaxPort == activeMinPort) {
+ return activeMaxPort;
}
// Get a random port between the min and max port range
- return __random.nextInt(__activeMaxPort - __activeMinPort + 1) + __activeMinPort;
+ return random.nextInt(activeMaxPort - activeMinPort + 1) + activeMinPort;
}
// default port
return 0;
@@ -1427,9 +1427,9 @@ implements Configurable
*/
private InetAddress getHostAddress()
{
- if (__activeExternalHost != null)
+ if (activeExternalHost != null)
{
- return __activeExternalHost;
+ return activeExternalHost;
}
// default local address
return getLocalAddress();
@@ -1444,8 +1444,8 @@ implements Configurable
* @return __reportActiveExternalHost if non-null, else getHostAddress();
*/
private InetAddress getReportHostAddress() {
- if (__reportActiveExternalHost != null) {
- return __reportActiveExternalHost ;
+ if (reportActiveExternalHost != null) {
+ return reportActiveExternalHost ;
}
return getHostAddress();
}
@@ -1459,8 +1459,8 @@ implements Configurable
*/
public void setActivePortRange(final int minPort, final int maxPort)
{
- this.__activeMinPort = minPort;
- this.__activeMaxPort = maxPort;
+ this.activeMinPort = minPort;
+ this.activeMaxPort = maxPort;
}
/**
@@ -1473,7 +1473,7 @@ implements Configurable
*/
public void setActiveExternalIPAddress(final String ipAddress) throws UnknownHostException
{
- this.__activeExternalHost = InetAddress.getByName(ipAddress);
+ this.activeExternalHost = InetAddress.getByName(ipAddress);
}
/**
@@ -1485,7 +1485,7 @@ implements Configurable
*/
public void setPassiveLocalIPAddress(final String ipAddress) throws UnknownHostException
{
- this.__passiveLocalHost = InetAddress.getByName(ipAddress);
+ this.passiveLocalHost = InetAddress.getByName(ipAddress);
}
/**
@@ -1496,7 +1496,7 @@ implements Configurable
*/
public void setPassiveLocalIPAddress(final InetAddress inetAddress)
{
- this.__passiveLocalHost = inetAddress;
+ this.passiveLocalHost = inetAddress;
}
/**
@@ -1507,7 +1507,7 @@ implements Configurable
*/
public InetAddress getPassiveLocalIPAddress()
{
- return this.__passiveLocalHost;
+ return this.passiveLocalHost;
}
/**
@@ -1521,7 +1521,7 @@ implements Configurable
*/
public void setReportActiveExternalIPAddress(final String ipAddress) throws UnknownHostException
{
- this.__reportActiveExternalHost = InetAddress.getByName(ipAddress);
+ this.reportActiveExternalHost = InetAddress.getByName(ipAddress);
}
@@ -1556,7 +1556,7 @@ implements Configurable
if (FTPReply.isPositiveCompletion(type(fileType)))
{
__fileType = fileType;
- __fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
+ fileFormat = FTP.NON_PRINT_TEXT_FORMAT;
return true;
}
return false;
@@ -1605,7 +1605,7 @@ implements Configurable
if (FTPReply.isPositiveCompletion(type(fileType, formatOrByteSize)))
{
__fileType = fileType;
- __fileFormat = formatOrByteSize;
+ fileFormat = formatOrByteSize;
return true;
}
return false;
@@ -1632,7 +1632,7 @@ implements Configurable
{
if (FTPReply.isPositiveCompletion(stru(structure)))
{
- __fileStructure = structure;
+ fileStructure = structure;
return true;
}
return false;
@@ -1659,7 +1659,7 @@ implements Configurable
{
if (FTPReply.isPositiveCompletion(mode(mode)))
{
- __fileTransferMode = mode;
+ fileTransferMode = mode;
return true;
}
return false;
@@ -1683,8 +1683,8 @@ implements Configurable
*/
public boolean remoteRetrieve(final String fileName) throws IOException
{
- if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
- __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
+ if (dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
+ dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
return FTPReply.isPositivePreliminary(retr(fileName));
}
return false;
@@ -1710,8 +1710,8 @@ implements Configurable
*/
public boolean remoteStore(final String fileName) throws IOException
{
- if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
- __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
+ if (dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
+ dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
return FTPReply.isPositivePreliminary(stor(fileName));
}
return false;
@@ -1738,8 +1738,8 @@ implements Configurable
*/
public boolean remoteStoreUnique(final String fileName) throws IOException
{
- if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
- __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
+ if (dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
+ dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
return FTPReply.isPositivePreliminary(stou(fileName));
}
return false;
@@ -1766,8 +1766,8 @@ implements Configurable
*/
public boolean remoteStoreUnique() throws IOException
{
- if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
- __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
+ if (dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
+ dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
return FTPReply.isPositivePreliminary(stou());
}
return false;
@@ -1794,8 +1794,8 @@ implements Configurable
*/
public boolean remoteAppend(final String fileName) throws IOException
{
- if (__dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
- __dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
+ if (dataConnectionMode == ACTIVE_REMOTE_DATA_CONNECTION_MODE ||
+ dataConnectionMode == PASSIVE_REMOTE_DATA_CONNECTION_MODE) {
return FTPReply.isPositivePreliminary(appe(fileName));
}
return false;
@@ -1907,15 +1907,15 @@ implements Configurable
}
CSL csl = null;
- if (__controlKeepAliveTimeout > 0) {
- csl = new CSL(this, __controlKeepAliveTimeout, __controlKeepAliveReplyTimeout);
+ if (controlKeepAliveTimeout > 0) {
+ csl = new CSL(this, controlKeepAliveTimeout, controlKeepAliveReplyTimeout);
}
// Treat everything else as binary for now
try
{
Util.copyStream(input, local, getBufferSize(),
- CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
+ CopyStreamEvent.UNKNOWN_STREAM_SIZE, mergeListeners(csl),
false);
// Get the transfer response
@@ -1924,7 +1924,7 @@ implements Configurable
Util.closeQuietly(input);
Util.closeQuietly(socket);
if (csl != null) {
- __cslDebug = csl.cleanUp(); // fetch any outstanding keepalive replies
+ cslDebug = csl.cleanUp(); // fetch any outstanding keepalive replies
}
}
}
@@ -2023,7 +2023,7 @@ implements Configurable
public boolean storeFile(final String remote, final InputStream local)
throws IOException
{
- return __storeFile(FTPCmd.STOR, remote, local);
+ return storeFile(FTPCmd.STOR, remote, local);
}
@@ -2057,7 +2057,7 @@ implements Configurable
*/
public OutputStream storeFileStream(final String remote) throws IOException
{
- return __storeFileStream(FTPCmd.STOR, remote);
+ return storeFileStream(FTPCmd.STOR, remote);
}
/**
@@ -2088,7 +2088,7 @@ implements Configurable
public boolean appendFile(final String remote, final InputStream local)
throws IOException
{
- return __storeFile(FTPCmd.APPE, remote, local);
+ return storeFile(FTPCmd.APPE, remote, local);
}
/**
@@ -2121,7 +2121,7 @@ implements Configurable
*/
public OutputStream appendFileStream(final String remote) throws IOException
{
- return __storeFileStream(FTPCmd.APPE, remote);
+ return storeFileStream(FTPCmd.APPE, remote);
}
/**
@@ -2153,7 +2153,7 @@ implements Configurable
public boolean storeUniqueFile(final String remote, final InputStream local)
throws IOException
{
- return __storeFile(FTPCmd.STOU, remote, local);
+ return storeFile(FTPCmd.STOU, remote, local);
}
@@ -2189,7 +2189,7 @@ implements Configurable
*/
public OutputStream storeUniqueFileStream(final String remote) throws IOException
{
- return __storeFileStream(FTPCmd.STOU, remote);
+ return storeFileStream(FTPCmd.STOU, remote);
}
/**
@@ -2218,7 +2218,7 @@ implements Configurable
*/
public boolean storeUniqueFile(final InputStream local) throws IOException
{
- return __storeFile(FTPCmd.STOU, null, local);
+ return storeFile(FTPCmd.STOU, null, local);
}
/**
@@ -2251,7 +2251,7 @@ implements Configurable
*/
public OutputStream storeUniqueFileStream() throws IOException
{
- return __storeFileStream(FTPCmd.STOU, null);
+ return storeFileStream(FTPCmd.STOU, null);
}
/**
@@ -2326,7 +2326,7 @@ implements Configurable
if (!initFeatureMap()) {
return null;
}
- final Set<String> entries = __featuresMap.get(feature.toUpperCase(Locale.ENGLISH));
+ final Set<String> entries = featuresMap.get(feature.toUpperCase(Locale.ENGLISH));
if (entries != null) {
return entries.toArray(new String[entries.size()]);
}
@@ -2369,7 +2369,7 @@ implements Configurable
if (!initFeatureMap()) {
return false;
}
- return __featuresMap.containsKey(feature.toUpperCase(Locale.ENGLISH));
+ return featuresMap.containsKey(feature.toUpperCase(Locale.ENGLISH));
}
/**
@@ -2391,7 +2391,7 @@ implements Configurable
if (!initFeatureMap()) {
return false;
}
- final Set<String> entries = __featuresMap.get(feature.toUpperCase(Locale.ENGLISH));
+ final Set<String> entries = featuresMap.get(feature.toUpperCase(Locale.ENGLISH));
if (entries != null) {
return entries.contains(value);
}
@@ -2402,7 +2402,7 @@ implements Configurable
* Create the feature map if not already created.
*/
private boolean initFeatureMap() throws IOException {
- if (__featuresMap == null) {
+ if (featuresMap == null) {
// Don't create map here, because next line may throw exception
final int replyCode = feat();
if (replyCode == FTPReply.NOT_LOGGED_IN) { // 503
@@ -2410,7 +2410,7 @@ implements Configurable
}
final boolean success = FTPReply.isPositiveCompletion(replyCode);
// we init the map here, so we don't keep trying if we know the command will fail
- __featuresMap = new HashMap<>();
+ featuresMap = new HashMap<>();
if (!success) {
return false;
}
@@ -2426,10 +2426,10 @@ implements Configurable
key = l.substring(1);
}
key = key.toUpperCase(Locale.ENGLISH);
- Set<String> entries = __featuresMap.get(key);
+ Set<String> entries = featuresMap.get(key);
if (entries == null) {
entries = new HashSet<>();
- __featuresMap.put(key, entries);
+ featuresMap.put(key, entries);
}
entries.add(value);
}
@@ -2614,7 +2614,7 @@ implements Configurable
*/
protected boolean restart(final long offset) throws IOException
{
- __restartOffset = 0;
+ restartOffset = 0;
return FTPReply.isPositiveIntermediate(rest(Long.toString(offset)));
}
@@ -2637,7 +2637,7 @@ implements Configurable
public void setRestartOffset(final long offset)
{
if (offset >= 0) {
- __restartOffset = offset;
+ restartOffset = offset;
}
}
@@ -2649,7 +2649,7 @@ implements Configurable
*/
public long getRestartOffset()
{
- return __restartOffset;
+ return restartOffset;
}
@@ -2773,7 +2773,7 @@ implements Configurable
return null;
}
- return __parsePathname(_replyLines.get( _replyLines.size() - 1));
+ return parsePathname(_replyLines.get( _replyLines.size() - 1));
}
@@ -2822,21 +2822,21 @@ implements Configurable
// Technically, we should expect a NAME_SYSTEM_TYPE response, but
// in practice FTP servers deviate, so we soften the condition to
// a positive completion.
- if (__systemName == null){
+ if (systemName == null){
if (FTPReply.isPositiveCompletion(syst())) {
// Assume that response is not empty here (cannot be null)
- __systemName = _replyLines.get(_replyLines.size() - 1).substring(4);
+ systemName = _replyLines.get(_replyLines.size() - 1).substring(4);
} else {
// Check if the user has provided a default for when the SYST command fails
final String systDefault = System.getProperty(FTP_SYSTEM_TYPE_DEFAULT);
if (systDefault != null) {
- __systemName = systDefault;
+ systemName = systDefault;
} else {
throw new IOException("Unable to determine system type - response: " + getReplyString());
}
}
}
- return __systemName;
+ return systemName;
}
@@ -3367,30 +3367,30 @@ implements Configurable
final String parserKey, final String pathname)
throws IOException
{
- __createParser(parserKey); // create and cache parser
- return initiateListParsing(__entryParser, pathname);
+ createParser(parserKey); // create and cache parser
+ return initiateListParsing(entryParser, pathname);
}
// package access for test purposes
- void __createParser(final String parserKey) throws IOException {
+ void createParser(final String parserKey) throws IOException {
// We cache the value to avoid creation of a new object every
// time a file listing is generated.
// Note: we don't check against a null parserKey (NET-544)
- if(__entryParser == null || (parserKey != null && ! __entryParserKey.equals(parserKey))) {
+ if(entryParser == null || (parserKey != null && ! entryParserKey.equals(parserKey))) {
if (null != parserKey) {
// if a parser key was supplied in the parameters,
// use that to create the parser
- __entryParser =
+ entryParser =
__parserFactory.createFileEntryParser(parserKey);
- __entryParserKey = parserKey;
+ entryParserKey = parserKey;
} else {
// if no parserKey was supplied, check for a configuration
// in the params, and if it has a non-empty system type, use that.
- if (null != __configuration && __configuration.getServerSystemKey().length() > 0) {
- __entryParser =
- __parserFactory.createFileEntryParser(__configuration);
- __entryParserKey = __configuration.getServerSystemKey();
+ if (null != configuration && configuration.getServerSystemKey().length() > 0) {
+ entryParser =
+ __parserFactory.createFileEntryParser(configuration);
+ entryParserKey = configuration.getServerSystemKey();
} else {
// if a parserKey hasn't been supplied, and a configuration
// hasn't been supplied, and the override property is not set
@@ -3407,12 +3407,12 @@ implements Configurable
}
}
}
- if (null != __configuration) { // system type must have been empty above
- __entryParser = __parserFactory.createFileEntryParser(new FTPClientConfig(systemType, __configuration));
+ if (null != configuration) { // system type must have been empty above
+ entryParser = __parserFactory.createFileEntryParser(new FTPClientConfig(systemType, configuration));
} else {
- __entryParser = __parserFactory.createFileEntryParser(systemType);
+ entryParser = __parserFactory.createFileEntryParser(systemType);
}
- __entryParserKey = systemType;
+ entryParserKey = systemType;
}
}
}
@@ -3440,7 +3440,7 @@ implements Configurable
{
final Socket socket = _openDataConnection_(FTPCmd.LIST, getListArguments(pathname));
- final FTPListParseEngine engine = new FTPListParseEngine(parser, __configuration);
+ final FTPListParseEngine engine = new FTPListParseEngine(parser, configuration);
if (socket == null)
{
return engine;
@@ -3478,7 +3478,7 @@ implements Configurable
public FTPListParseEngine initiateMListParsing(final String pathname) throws IOException
{
final Socket socket = _openDataConnection_(FTPCmd.MLSD, pathname);
- final FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance(), __configuration);
+ final FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance(), configuration);
if (socket == null)
{
return engine;
@@ -3657,7 +3657,7 @@ implements Configurable
* @param bufSize The size of the buffer. Use a non-positive value to use the default.
*/
public void setBufferSize(final int bufSize) {
- __bufferSize = bufSize;
+ bufferSize = bufSize;
}
/**
@@ -3665,7 +3665,7 @@ implements Configurable
* @return The current buffer size.
*/
public int getBufferSize() {
- return __bufferSize;
+ return bufferSize;
}
/**
@@ -3676,7 +3676,7 @@ implements Configurable
* @since 3.3
*/
public void setSendDataSocketBufferSize(final int bufSize) {
- __sendDataSocketBufferSize = bufSize;
+ sendDataSocketBufferSize = bufSize;
}
/**
@@ -3685,7 +3685,7 @@ implements Configurable
* @since 3.3
*/
public int getSendDataSocketBufferSize() {
- return __sendDataSocketBufferSize;
+ return sendDataSocketBufferSize;
}
/**
@@ -3696,7 +3696,7 @@ implements Configurable
* @since 3.3
*/
public void setReceieveDataSocketBufferSize(final int bufSize) {
- __receiveDataSocketBufferSize = bufSize;
+ receiveDataSocketBufferSize = bufSize;
}
/**
@@ -3705,7 +3705,7 @@ implements Configurable
* @since 3.3
*/
public int getReceiveDataSocketBufferSize() {
- return __receiveDataSocketBufferSize;
+ return receiveDataSocketBufferSize;
}
/**
@@ -3718,7 +3718,7 @@ implements Configurable
*/
@Override
public void configure(final FTPClientConfig config) {
- this.__configuration = config;
+ this.configuration = config;
}
/**
@@ -3731,7 +3731,7 @@ implements Configurable
* @since 2.0
*/
public void setListHiddenFiles(final boolean listHiddenFiles) {
- this.__listHiddenFiles = listHiddenFiles;
+ this.listHiddenFiles = listHiddenFiles;
}
/**
@@ -3740,7 +3740,7 @@ implements Configurable
* @since 2.0
*/
public boolean getListHiddenFiles() {
- return this.__listHiddenFiles;
+ return this.listHiddenFiles;
}
/**
@@ -3750,7 +3750,7 @@ implements Configurable
* @since 2.2
*/
public boolean isUseEPSVwithIPv4() {
- return __useEPSVwithIPv4;
+ return useEPSVwithIPv4;
}
@@ -3769,7 +3769,7 @@ implements Configurable
* @since 2.2
*/
public void setUseEPSVwithIPv4(final boolean selected) {
- this.__useEPSVwithIPv4 = selected;
+ this.useEPSVwithIPv4 = selected;
}
/**
@@ -3780,7 +3780,7 @@ implements Configurable
* @since 3.0
*/
public void setCopyStreamListener(final CopyStreamListener listener){
- __copyStreamListener = listener;
+ copyStreamListener = listener;
}
/**
@@ -3790,7 +3790,7 @@ implements Configurable
* @since 3.0
*/
public CopyStreamListener getCopyStreamListener(){
- return __copyStreamListener;
+ return copyStreamListener;
}
/**
@@ -3804,7 +3804,7 @@ implements Configurable
* @see #setControlKeepAliveReplyTimeout(int)
*/
public void setControlKeepAliveTimeout(final long controlIdle){
- __controlKeepAliveTimeout = controlIdle * 1000;
+ controlKeepAliveTimeout = controlIdle * 1000;
}
/**
@@ -3817,7 +3817,7 @@ implements Configurable
* @since 3.0
*/
public long getControlKeepAliveTimeout() {
- return __controlKeepAliveTimeout / 1000;
+ return controlKeepAliveTimeout / 1000;
}
/**
@@ -3837,7 +3837,7 @@ implements Configurable
*/
@Deprecated // only for use in testing
public int[] getCslDebug() {
- return __cslDebug;
+ return cslDebug;
}
/**
* Set how long to wait for control keep-alive message replies.
@@ -3847,7 +3847,7 @@ implements Configurable
* @see #setControlKeepAliveTimeout(long)
*/
public void setControlKeepAliveReplyTimeout(final int timeout) {
- __controlKeepAliveReplyTimeout = timeout;
+ controlKeepAliveReplyTimeout = timeout;
}
/**
@@ -3856,7 +3856,7 @@ implements Configurable
* @since 3.0
*/
public int getControlKeepAliveReplyTimeout() {
- return __controlKeepAliveReplyTimeout;
+ return controlKeepAliveReplyTimeout;
}
/**
@@ -3875,9 +3875,9 @@ implements Configurable
@Deprecated
public void setPassiveNatWorkaround(final boolean enabled) {
if (enabled) {
- this.__passiveNatWorkaroundStrategy = new NatServerResolverImpl(this);
+ this.passiveNatWorkaroundStrategy = new NatServerResolverImpl(this);
} else {
- this.__passiveNatWorkaroundStrategy = null;
+ this.passiveNatWorkaroundStrategy = null;
}
}
@@ -3892,7 +3892,7 @@ implements Configurable
* @since 3.6
*/
public void setPassiveNatWorkaroundStrategy(final HostnameResolver resolver) {
- this.__passiveNatWorkaroundStrategy = resolver;
+ this.passiveNatWorkaroundStrategy = resolver;
}
/**
@@ -3933,15 +3933,15 @@ implements Configurable
}
private OutputStream getBufferedOutputStream(final OutputStream outputStream) {
- if (__bufferSize > 0) {
- return new BufferedOutputStream(outputStream, __bufferSize);
+ if (bufferSize > 0) {
+ return new BufferedOutputStream(outputStream, bufferSize);
}
return new BufferedOutputStream(outputStream);
}
private InputStream getBufferedInputStream(final InputStream inputStream) {
- if (__bufferSize > 0) {
- return new BufferedInputStream(inputStream, __bufferSize);
+ if (bufferSize > 0) {
+ return new BufferedInputStream(inputStream, bufferSize);
}
return new BufferedInputStream(inputStream);
}
@@ -4012,17 +4012,17 @@ implements Configurable
* @return a merged listener or a single listener or null
* @since 3.0
*/
- private CopyStreamListener __mergeListeners(final CopyStreamListener local) {
+ private CopyStreamListener mergeListeners(final CopyStreamListener local) {
if (local == null) {
- return __copyStreamListener;
+ return copyStreamListener;
}
- if (__copyStreamListener == null) {
+ if (copyStreamListener == null) {
return local;
}
// Both are non-null
final CopyStreamAdapter merged = new CopyStreamAdapter();
merged.addCopyStreamListener(local);
- merged.addCopyStreamListener(__copyStreamListener);
+ merged.addCopyStreamListener(copyStreamListener);
return merged;
}
@@ -4035,7 +4035,7 @@ implements Configurable
*/
public void setAutodetectUTF8(final boolean autodetect)
{
- __autodetectEncoding = autodetect;
+ autodetectEncoding = autodetect;
}
/**
@@ -4044,12 +4044,12 @@ implements Configurable
*/
public boolean getAutodetectUTF8()
{
- return __autodetectEncoding;
+ return autodetectEncoding;
}
// Method for use by unit test code only
FTPFileEntryParser getEntryParser() {
- return __entryParser;
+ return entryParser;
}
// DEPRECATED METHODS - for API compatibility only - DO NOT USE
@@ -4062,10 +4062,10 @@ implements Configurable
@Deprecated
public String getSystemName() throws IOException
{
- if (__systemName == null && FTPReply.isPositiveCompletion(syst())) {
- __systemName = _replyLines.get(_replyLines.size() - 1).substring(4);
+ if (systemName == null && FTPReply.isPositiveCompletion(syst())) {
+ systemName = _replyLines.get(_replyLines.size() - 1).substring(4);
}
- return __systemName;
+ return systemName;
}
}
diff --git a/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java b/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java
index a8e625e..ba99e0f 100644
--- a/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java
+++ b/src/main/java/org/apache/commons/net/ftp/FTPListParseEngine.java
@@ -76,7 +76,7 @@ import org.apache.commons.net.util.Charsets;
*/
public class FTPListParseEngine {
private List<String> entries = new LinkedList<>();
- private ListIterator<String> _internalIterator = entries.listIterator();
+ private ListIterator<String> internalIterator = entries.listIterator();
private final FTPFileEntryParser parser;
// Should invalid files (parse failures) be allowed?
@@ -174,8 +174,8 @@ public class FTPListParseEngine {
public FTPFile[] getNext(final int quantityRequested) {
final List<FTPFile> tmpResults = new LinkedList<>();
int count = quantityRequested;
- while (count > 0 && this._internalIterator.hasNext()) {
- final String entry = this._internalIterator.next();
+ while (count > 0 && this.internalIterator.hasNext()) {
+ final String entry = this.internalIterator.next();
FTPFile temp = this.parser.parseFTPEntry(entry);
if (temp == null && saveUnparseableEntries) {
temp = new FTPFile(entry);
@@ -216,8 +216,8 @@ public class FTPListParseEngine {
public FTPFile[] getPrevious(final int quantityRequested) {
final List<FTPFile> tmpResults = new LinkedList<>();
int count = quantityRequested;
- while (count > 0 && this._internalIterator.hasPrevious()) {
- final String entry = this._internalIterator.previous();
+ while (count > 0 && this.internalIterator.hasPrevious()) {
+ final String entry = this.internalIterator.previous();
FTPFile temp = this.parser.parseFTPEntry(entry);
if (temp == null && saveUnparseableEntries) {
temp = new FTPFile(entry);
@@ -288,7 +288,7 @@ public class FTPListParseEngine {
* otherwise.
*/
public boolean hasNext() {
- return _internalIterator.hasNext();
+ return internalIterator.hasNext();
}
/**
@@ -299,14 +299,14 @@ public class FTPListParseEngine {
* otherwise.
*/
public boolean hasPrevious() {
- return _internalIterator.hasPrevious();
+ return internalIterator.hasPrevious();
}
/**
* resets this object's internal iterator to the beginning of the list.
*/
public void resetIterator() {
- this._internalIterator = this.entries.listIterator();
+ this.internalIterator = this.entries.listIterator();
}
// DEPRECATED METHODS - for API compatibility only - DO NOT USE
diff --git a/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
index 07e65ce..838c439 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/VMSVersioningFTPEntryParser.java
@@ -45,7 +45,7 @@ import org.apache.commons.net.ftp.FTPClientConfig;
public class VMSVersioningFTPEntryParser extends VMSFTPEntryParser
{
- private final Pattern _preparse_pattern_;
+ private final Pattern preparsePattern;
private static final String PRE_PARSE_REGEX =
"(.*?);([0-9]+)\\s*.*";
@@ -81,7 +81,7 @@ public class VMSVersioningFTPEntryParser extends VMSFTPEntryParser
try
{
//_preparse_matcher_ = new Perl5Matcher();
- _preparse_pattern_ = Pattern.compile(PRE_PARSE_REGEX);
+ preparsePattern = Pattern.compile(PRE_PARSE_REGEX);
}
catch (final PatternSyntaxException pse)
{
@@ -107,7 +107,7 @@ public class VMSVersioningFTPEntryParser extends VMSFTPEntryParser
while (iter.hasNext()) {
final String entry = iter.next().trim();
MatchResult result = null;
- final Matcher _preparse_matcher_ = _preparse_pattern_.matcher(entry);
+ final Matcher _preparse_matcher_ = preparsePattern.matcher(entry);
if (_preparse_matcher_.matches()) {
result = _preparse_matcher_.toMatchResult();
final String name = result.group(1);
@@ -131,7 +131,7 @@ public class VMSVersioningFTPEntryParser extends VMSFTPEntryParser
while (iter.hasPrevious()) {
final String entry = iter.previous().trim();
MatchResult result = null;
- final Matcher _preparse_matcher_ = _preparse_pattern_.matcher(entry);
+ final Matcher _preparse_matcher_ = preparsePattern.matcher(entry);
if (_preparse_matcher_.matches()) {
result = _preparse_matcher_.toMatchResult();
final String name = result.group(1);
diff --git a/src/main/java/org/apache/commons/net/io/DotTerminatedMessageWriter.java b/src/main/java/org/apache/commons/net/io/DotTerminatedMessageWriter.java
index c709073..3a24448 100644
--- a/src/main/java/org/apache/commons/net/io/DotTerminatedMessageWriter.java
+++ b/src/main/java/org/apache/commons/net/io/DotTerminatedMessageWriter.java
@@ -38,12 +38,12 @@ import java.io.Writer;
public final class DotTerminatedMessageWriter extends Writer
{
- private static final int __NOTHING_SPECIAL_STATE = 0;
- private static final int __LAST_WAS_CR_STATE = 1;
- private static final int __LAST_WAS_NL_STATE = 2;
+ private static final int NOTHING_SPECIAL_STATE = 0;
+ private static final int LAST_WAS_CR_STATE = 1;
+ private static final int LAST_WAS_NL_STATE = 2;
- private int __state;
- private Writer __output;
+ private int state;
+ private Writer output;
/***
@@ -55,8 +55,8 @@ public final class DotTerminatedMessageWriter extends Writer
public DotTerminatedMessageWriter(final Writer output)
{
super(output);
- __output = output;
- __state = __NOTHING_SPECIAL_STATE;
+ this.output = output;
+ this.state = NOTHING_SPECIAL_STATE;
}
@@ -79,25 +79,25 @@ public final class DotTerminatedMessageWriter extends Writer
switch (ch)
{
case '\r':
- __state = __LAST_WAS_CR_STATE;
- __output.write('\r');
+ state = LAST_WAS_CR_STATE;
+ output.write('\r');
return ;
case '\n':
- if (__state != __LAST_WAS_CR_STATE) {
- __output.write('\r');
+ if (state != LAST_WAS_CR_STATE) {
+ output.write('\r');
}
- __output.write('\n');
- __state = __LAST_WAS_NL_STATE;
+ output.write('\n');
+ state = LAST_WAS_NL_STATE;
return ;
case '.':
// Double the dot at the beginning of a line
- if (__state == __LAST_WAS_NL_STATE) {
- __output.write('.');
+ if (state == LAST_WAS_NL_STATE) {
+ output.write('.');
}
//$FALL-THROUGH$
default:
- __state = __NOTHING_SPECIAL_STATE;
- __output.write(ch);
+ state = NOTHING_SPECIAL_STATE;
+ output.write(ch);
return ;
}
}
@@ -181,7 +181,7 @@ public final class DotTerminatedMessageWriter extends Writer
{
synchronized (lock)
{
- __output.flush();
+ output.flush();
}
}
@@ -199,20 +199,20 @@ public final class DotTerminatedMessageWriter extends Writer
{
synchronized (lock)
{
- if (__output == null) {
+ if (output == null) {
return ;
}
- if (__state == __LAST_WAS_CR_STATE) {
- __output.write('\n');
- } else if (__state != __LAST_WAS_NL_STATE) {
- __output.write("\r\n");
+ if (state == LAST_WAS_CR_STATE) {
+ output.write('\n');
+ } else if (state != LAST_WAS_NL_STATE) {
+ output.write("\r\n");
}
- __output.write(".\r\n");
+ output.write(".\r\n");
- __output.flush();
- __output = null;
+ output.flush();
+ output = null;
}
}
diff --git a/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java b/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java
index 6495e91..d22247c 100644
--- a/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java
+++ b/src/main/java/org/apache/commons/net/io/FromNetASCIIInputStream.java
@@ -48,7 +48,7 @@ public final class FromNetASCIIInputStream extends PushbackInputStream
}
}
- private int __length = 0;
+ private int length = 0;
/***
* Returns true if the NetASCII line separator differs from the system
@@ -89,7 +89,7 @@ public final class FromNetASCIIInputStream extends PushbackInputStream
unread(_lineSeparatorBytes);
ch = super.read();
// This is a kluge for read(byte[], ...) to read the right amount
- --__length;
+ --length;
}
else
{
@@ -175,11 +175,11 @@ public final class FromNetASCIIInputStream extends PushbackInputStream
ch = available();
- __length = length > ch ? ch : length;
+ this.length = length > ch ? ch : length;
// If nothing is available, block to read only one character
- if (__length < 1) {
- __length = 1;
+ if (this.length < 1) {
+ this.length = 1;
}
@@ -193,7 +193,7 @@ public final class FromNetASCIIInputStream extends PushbackInputStream
{
buffer[offset++] = (byte)ch;
}
- while (--__length > 0 && (ch = __read()) != -1);
+ while (--this.length > 0 && (ch = __read()) != -1);
return offset - off;
diff --git a/src/main/java/org/apache/commons/net/io/FromNetASCIIOutputStream.java b/src/main/java/org/apache/commons/net/io/FromNetASCIIOutputStream.java
index 6721198..027d20b 100644
--- a/src/main/java/org/apache/commons/net/io/FromNetASCIIOutputStream.java
+++ b/src/main/java/org/apache/commons/net/io/FromNetASCIIOutputStream.java
@@ -38,7 +38,7 @@ import java.io.OutputStream;
public final class FromNetASCIIOutputStream extends FilterOutputStream
{
- private boolean __lastWasCR;
+ private boolean lastWasCR;
/***
* Creates a FromNetASCIIOutputStream instance that wraps an existing
@@ -49,7 +49,7 @@ public final class FromNetASCIIOutputStream extends FilterOutputStream
public FromNetASCIIOutputStream(final OutputStream output)
{
super(output);
- __lastWasCR = false;
+ lastWasCR = false;
}
@@ -58,24 +58,24 @@ public final class FromNetASCIIOutputStream extends FilterOutputStream
switch (ch)
{
case '\r':
- __lastWasCR = true;
+ lastWasCR = true;
// Don't write anything. We need to see if next one is linefeed
break;
case '\n':
- if (__lastWasCR)
+ if (lastWasCR)
{
out.write(FromNetASCIIInputStream._lineSeparatorBytes);
- __lastWasCR = false;
+ lastWasCR = false;
break;
}
- __lastWasCR = false;
+ lastWasCR = false;
out.write('\n');
break;
default:
- if (__lastWasCR)
+ if (lastWasCR)
{
out.write('\r');
- __lastWasCR = false;
+ lastWasCR = false;
}
out.write(ch);
break;
@@ -167,7 +167,7 @@ public final class FromNetASCIIOutputStream extends FilterOutputStream
return ;
}
- if (__lastWasCR) {
+ if (lastWasCR) {
out.write('\r');
}
super.close();
diff --git a/src/main/java/org/apache/commons/net/io/SocketInputStream.java b/src/main/java/org/apache/commons/net/io/SocketInputStream.java
index ace3e2a..16424cd 100644
--- a/src/main/java/org/apache/commons/net/io/SocketInputStream.java
+++ b/src/main/java/org/apache/commons/net/io/SocketInputStream.java
@@ -36,7 +36,7 @@ import java.net.Socket;
public class SocketInputStream extends FilterInputStream
{
- private final Socket __socket;
+ private final Socket socket;
/***
* Creates a SocketInputStream instance wrapping an input stream and
@@ -49,7 +49,7 @@ public class SocketInputStream extends FilterInputStream
public SocketInputStream(final Socket socket, final InputStream stream)
{
super(stream);
- __socket = socket;
+ this.socket = socket;
}
/***
@@ -63,6 +63,6 @@ public class SocketInputStream extends FilterInputStream
public void close() throws IOException
{
super.close();
- __socket.close();
+ socket.close();
}
}
diff --git a/src/main/java/org/apache/commons/net/io/SocketOutputStream.java b/src/main/java/org/apache/commons/net/io/SocketOutputStream.java
index ed2da63..139077f 100644
--- a/src/main/java/org/apache/commons/net/io/SocketOutputStream.java
+++ b/src/main/java/org/apache/commons/net/io/SocketOutputStream.java
@@ -36,7 +36,7 @@ import java.net.Socket;
public class SocketOutputStream extends FilterOutputStream
{
- private final Socket __socket;
+ private final Socket socket;
/***
* Creates a SocketOutputStream instance wrapping an output stream and
@@ -49,7 +49,7 @@ public class SocketOutputStream extends FilterOutputStream
public SocketOutputStream(final Socket socket, final OutputStream stream)
{
super(stream);
- __socket = socket;
+ this.socket = socket;
}
@@ -83,6 +83,6 @@ public class SocketOutputStream extends FilterOutputStream
public void close() throws IOException
{
super.close();
- __socket.close();
+ socket.close();
}
}
diff --git a/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java b/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java
index 580401c..db4f317 100644
--- a/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java
+++ b/src/main/java/org/apache/commons/net/io/ToNetASCIIInputStream.java
@@ -34,10 +34,10 @@ import java.io.InputStream;
public final class ToNetASCIIInputStream extends FilterInputStream
{
- private static final int __NOTHING_SPECIAL = 0;
- private static final int __LAST_WAS_CR = 1;
- private static final int __LAST_WAS_NL = 2;
- private int __status;
+ private static final int NOTHING_SPECIAL = 0;
+ private static final int LAST_WAS_CR = 1;
+ private static final int LAST_WAS_NL = 2;
+ private int status;
/***
* Creates a ToNetASCIIInputStream instance that wraps an existing
@@ -48,7 +48,7 @@ public final class ToNetASCIIInputStream extends FilterInputStream
public ToNetASCIIInputStream(final InputStream input)
{
super(input);
- __status = __NOTHING_SPECIAL;
+ status = NOTHING_SPECIAL;
}
@@ -66,9 +66,9 @@ public final class ToNetASCIIInputStream extends FilterInputStream
{
int ch;
- if (__status == __LAST_WAS_NL)
+ if (status == LAST_WAS_NL)
{
- __status = __NOTHING_SPECIAL;
+ status = NOTHING_SPECIAL;
return '\n';
}
@@ -77,17 +77,17 @@ public final class ToNetASCIIInputStream extends FilterInputStream
switch (ch)
{
case '\r':
- __status = __LAST_WAS_CR;
+ status = LAST_WAS_CR;
return '\r';
case '\n':
- if (__status != __LAST_WAS_CR)
+ if (status != LAST_WAS_CR)
{
- __status = __LAST_WAS_NL;
+ status = LAST_WAS_NL;
return '\r';
}
//$FALL-THROUGH$
default:
- __status = __NOTHING_SPECIAL;
+ status = NOTHING_SPECIAL;
return ch;
}
// statement not reached
@@ -176,7 +176,7 @@ public final class ToNetASCIIInputStream extends FilterInputStream
result = in.available();
- if (__status == __LAST_WAS_NL) {
+ if (status == LAST_WAS_NL) {
return result + 1;
}
diff --git a/src/main/java/org/apache/commons/net/io/ToNetASCIIOutputStream.java b/src/main/java/org/apache/commons/net/io/ToNetASCIIOutputStream.java
index f96ca97..b75b512 100644
--- a/src/main/java/org/apache/commons/net/io/ToNetASCIIOutputStream.java
+++ b/src/main/java/org/apache/commons/net/io/ToNetASCIIOutputStream.java
@@ -34,7 +34,7 @@ import java.io.OutputStream;
public final class ToNetASCIIOutputStream extends FilterOutputStream
{
- private boolean __lastWasCR;
+ private boolean lastWasCR;
/***
* Creates a ToNetASCIIOutputStream instance that wraps an existing
@@ -45,7 +45,7 @@ public final class ToNetASCIIOutputStream extends FilterOutputStream
public ToNetASCIIOutputStream(final OutputStream output)
{
super(output);
- __lastWasCR = false;
+ lastWasCR = false;
}
@@ -67,16 +67,16 @@ public final class ToNetASCIIOutputStream extends FilterOutputStream
switch (ch)
{
case '\r':
- __lastWasCR = true;
+ lastWasCR = true;
out.write('\r');
return ;
case '\n':
- if (!__lastWasCR) {
+ if (!lastWasCR) {
out.write('\r');
}
//$FALL-THROUGH$
default:
- __lastWasCR = false;
+ lastWasCR = false;
out.write(ch);
return ;
}
diff --git a/src/main/java/org/apache/commons/net/nntp/NNTPClient.java b/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
index 036972e..9b7ee2c 100644
--- a/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
+++ b/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
@@ -94,7 +94,7 @@ public class NNTPClient extends NNTP
*
* @throws MalformedServerReplyException if response could not be parsed
*/
- private void __parseArticlePointer(final String reply, final ArticleInfo pointer)
+ private void parseArticlePointer(final String reply, final ArticleInfo pointer)
throws MalformedServerReplyException
{
final String tokens[] = reply.split(" ");
@@ -241,7 +241,7 @@ public class NNTPClient extends NNTP
return article;
}
- private NewsgroupInfo[] __readNewsgroupListing() throws IOException
+ private NewsgroupInfo[] readNewsgroupListing() throws IOException
{
// Start of with a big vector because we may be reading a very large
@@ -289,14 +289,14 @@ public class NNTPClient extends NNTP
if (pointer != null) {
- __parseArticlePointer(getReplyString(), pointer);
+ parseArticlePointer(getReplyString(), pointer);
}
return new DotTerminatedMessageReader(_reader_);
}
- private BufferedReader __retrieve(final int command, final long articleNumber, final ArticleInfo pointer)
+ private BufferedReader retrieve(final int command, final long articleNumber, final ArticleInfo pointer)
throws IOException
{
if (!NNTPReply.isPositiveCompletion(sendCommand(command,
@@ -305,7 +305,7 @@ public class NNTPClient extends NNTP
}
if (pointer != null) {
- __parseArticlePointer(getReplyString(), pointer);
+ parseArticlePointer(getReplyString(), pointer);
}
return new DotTerminatedMessageReader(_reader_);
@@ -426,7 +426,7 @@ public class NNTPClient extends NNTP
public BufferedReader retrieveArticle(final long articleNumber, final ArticleInfo pointer)
throws IOException
{
- return __retrieve(NNTPCommand.ARTICLE, articleNumber, pointer);
+ return retrieve(NNTPCommand.ARTICLE, articleNumber, pointer);
}
/**
@@ -556,7 +556,7 @@ public class NNTPClient extends NNTP
final ArticleInfo pointer)
throws IOException
{
- return __retrieve(NNTPCommand.HEAD, articleNumber, pointer);
+ return retrieve(NNTPCommand.HEAD, articleNumber, pointer);
}
@@ -689,7 +689,7 @@ public class NNTPClient extends NNTP
final ArticleInfo pointer)
throws IOException
{
- return __retrieve(NNTPCommand.BODY, articleNumber, pointer);
+ return retrieve(NNTPCommand.BODY, articleNumber, pointer);
}
@@ -834,7 +834,7 @@ public class NNTPClient extends NNTP
}
if (pointer != null) {
- __parseArticlePointer(getReplyString(), pointer);
+ parseArticlePointer(getReplyString(), pointer);
}
return true;
@@ -897,7 +897,7 @@ public class NNTPClient extends NNTP
}
if (pointer != null) {
- __parseArticlePointer(getReplyString(), pointer);
+ parseArticlePointer(getReplyString(), pointer);
}
return true;
@@ -946,7 +946,7 @@ public class NNTPClient extends NNTP
}
if (pointer != null) {
- __parseArticlePointer(getReplyString(), pointer);
+ parseArticlePointer(getReplyString(), pointer);
}
return true;
@@ -992,7 +992,7 @@ public class NNTPClient extends NNTP
}
if (pointer != null) {
- __parseArticlePointer(getReplyString(), pointer);
+ parseArticlePointer(getReplyString(), pointer);
}
return true;
@@ -1034,7 +1034,7 @@ public class NNTPClient extends NNTP
return null;
}
- return __readNewsgroupListing();
+ return readNewsgroupListing();
}
/**
@@ -1100,7 +1100,7 @@ public class NNTPClient extends NNTP
if(!NNTPReply.isPositiveCompletion(listActive(wildmat))) {
return null;
}
- return __readNewsgroupListing();
+ return readNewsgroupListing();
}
@@ -1171,7 +1171,7 @@ public class NNTPClient extends NNTP
return null;
}
- return __readNewsgroupListing();
+ return readNewsgroupListing();
}
/**
@@ -1632,9 +1632,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public boolean selectArticle(final int a, final ArticlePointer ap) throws IOException {
- final ArticleInfo ai = __ap2ai(ap);
+ final ArticleInfo ai = ap2ai(ap);
final boolean b = selectArticle(a, ai);
- __ai2ap(ai, ap);
+ ai2ap(ai, ap);
return b;
}
@@ -1680,9 +1680,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public Reader retrieveArticleHeader(final int a, final ArticlePointer ap) throws IOException {
- final ArticleInfo ai = __ap2ai(ap);
+ final ArticleInfo ai = ap2ai(ap);
final Reader rdr = retrieveArticleHeader(a, ai);
- __ai2ap(ai, ap);
+ ai2ap(ai, ap);
return rdr;
}
@@ -1707,9 +1707,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public Reader retrieveArticle(final int articleNumber, final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final Reader rdr = retrieveArticle(articleNumber, ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return rdr;
}
@@ -1734,9 +1734,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public Reader retrieveArticleBody(final int a, final ArticlePointer ap) throws IOException {
- final ArticleInfo ai = __ap2ai(ap);
+ final ArticleInfo ai = ap2ai(ap);
final Reader rdr = retrieveArticleBody(a, ai);
- __ai2ap(ai, ap);
+ ai2ap(ai, ap);
return rdr;
}
@@ -1750,9 +1750,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public Reader retrieveArticle(final String articleId, final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final Reader rdr = retrieveArticle(articleId, ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return rdr;
}
@@ -1766,9 +1766,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public Reader retrieveArticleBody(final String articleId, final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final Reader rdr = retrieveArticleBody(articleId, ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return rdr;
}
@@ -1782,9 +1782,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public Reader retrieveArticleHeader(final String articleId, final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final Reader rdr = retrieveArticleHeader(articleId, ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return rdr;
}
@@ -1798,9 +1798,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public boolean selectArticle(final String articleId, final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final boolean b = selectArticle(articleId, ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return b;
}
@@ -1813,9 +1813,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public boolean selectArticle(final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final boolean b = selectArticle(ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return b;
}
@@ -1828,9 +1828,9 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public boolean selectNextArticle(final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final boolean b = selectNextArticle(ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return b;
}
@@ -1843,15 +1843,15 @@ public class NNTPClient extends NNTP
*/
@Deprecated
public boolean selectPreviousArticle(final ArticlePointer pointer) throws IOException {
- final ArticleInfo ai = __ap2ai(pointer);
+ final ArticleInfo ai = ap2ai(pointer);
final boolean b = selectPreviousArticle(ai);
- __ai2ap(ai, pointer);
+ ai2ap(ai, pointer);
return b;
}
// Helper methods
- private ArticleInfo __ap2ai(@SuppressWarnings("deprecation") final ArticlePointer ap) {
+ private ArticleInfo ap2ai(@SuppressWarnings("deprecation") final ArticlePointer ap) {
if (ap == null) {
return null;
}
@@ -1860,7 +1860,7 @@ public class NNTPClient extends NNTP
}
@SuppressWarnings("deprecation")
- private void __ai2ap(final ArticleInfo ai, final ArticlePointer ap){
+ private void ai2ap(final ArticleInfo ai, final ArticlePointer ap){
if (ap != null) { // ai cannot be null
ap.articleId = ai.articleId;
ap.articleNumber = (int) ai.articleNumber;
diff --git a/src/main/java/org/apache/commons/net/nntp/NewGroupsOrNewsQuery.java b/src/main/java/org/apache/commons/net/nntp/NewGroupsOrNewsQuery.java
index ea72039..9dfdcdb 100644
--- a/src/main/java/org/apache/commons/net/nntp/NewGroupsOrNewsQuery.java
+++ b/src/main/java/org/apache/commons/net/nntp/NewGroupsOrNewsQuery.java
@@ -42,10 +42,10 @@ import java.util.Calendar;
public final class NewGroupsOrNewsQuery
{
- private final String __date, __time;
- private StringBuffer __distributions;
- private StringBuffer __newsgroups;
- private final boolean __isGMT;
+ private final String date, time;
+ private StringBuffer distributions;
+ private StringBuffer newsgroups;
+ private final boolean isGMT;
/***
@@ -60,9 +60,9 @@ public final class NewGroupsOrNewsQuery
String str;
StringBuilder buffer;
- __distributions = null;
- __newsgroups = null;
- __isGMT = gmt;
+ this.distributions = null;
+ this.newsgroups = null;
+ this.isGMT = gmt;
buffer = new StringBuilder();
@@ -105,7 +105,7 @@ public final class NewGroupsOrNewsQuery
buffer.append("01");
}
- __date = buffer.toString();
+ this.date = buffer.toString();
buffer.setLength(0);
@@ -152,7 +152,7 @@ public final class NewGroupsOrNewsQuery
buffer.append("00");
}
- __time = buffer.toString();
+ this.time = buffer.toString();
}
@@ -168,12 +168,12 @@ public final class NewGroupsOrNewsQuery
***/
public void addNewsgroup(final String newsgroup)
{
- if (__newsgroups != null) {
- __newsgroups.append(',');
+ if (newsgroups != null) {
+ newsgroups.append(',');
} else {
- __newsgroups = new StringBuffer();
+ newsgroups = new StringBuffer();
}
- __newsgroups.append(newsgroup);
+ newsgroups.append(newsgroup);
}
@@ -213,12 +213,12 @@ public final class NewGroupsOrNewsQuery
***/
public void addDistribution(final String distribution)
{
- if (__distributions != null) {
- __distributions.append(',');
+ if (distributions != null) {
+ distributions.append(',');
} else {
- __distributions = new StringBuffer();
+ distributions = new StringBuffer();
}
- __distributions.append(distribution);
+ distributions.append(distribution);
}
/***
@@ -229,7 +229,7 @@ public final class NewGroupsOrNewsQuery
***/
public String getDate()
{
- return __date;
+ return date;
}
/***
@@ -240,7 +240,7 @@ public final class NewGroupsOrNewsQuery
***/
public String getTime()
{
- return __time;
+ return time;
}
/***
@@ -250,7 +250,7 @@ public final class NewGroupsOrNewsQuery
***/
public boolean isGMT()
{
- return __isGMT;
+ return isGMT;
}
/***
@@ -262,7 +262,7 @@ public final class NewGroupsOrNewsQuery
***/
public String getDistributions()
{
- return __distributions == null ? null : __distributions.toString();
+ return distributions == null ? null : distributions.toString();
}
/***
@@ -274,6 +274,6 @@ public final class NewGroupsOrNewsQuery
***/
public String getNewsgroups()
{
- return __newsgroups == null ? null : __newsgroups.toString();
+ return newsgroups == null ? null : newsgroups.toString();
}
}
diff --git a/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java b/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
index 10ef2f5..23b2b88 100644
--- a/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
+++ b/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
@@ -51,35 +51,35 @@ public final class NewsgroupInfo
***/
public static final int PROHIBITED_POSTING_PERMISSION = 3;
- private String __newsgroup;
- private long __estimatedArticleCount;
- private long __firstArticle;
- private long __lastArticle;
- private int __postingPermission;
+ private String newsgroup;
+ private long estimatedArticleCount;
+ private long firstArticle;
+ private long lastArticle;
+ private int postingPermission;
void _setNewsgroup(final String newsgroup)
{
- __newsgroup = newsgroup;
+ this.newsgroup = newsgroup;
}
void _setArticleCount(final long count)
{
- __estimatedArticleCount = count;
+ estimatedArticleCount = count;
}
void _setFirstArticle(final long first)
{
- __firstArticle = first;
+ firstArticle = first;
}
void _setLastArticle(final long last)
{
- __lastArticle = last;
+ lastArticle = last;
}
void _setPostingPermission(final int permission)
{
- __postingPermission = permission;
+ postingPermission = permission;
}
/***
@@ -89,7 +89,7 @@ public final class NewsgroupInfo
***/
public String getNewsgroup()
{
- return __newsgroup;
+ return newsgroup;
}
/***
@@ -100,7 +100,7 @@ public final class NewsgroupInfo
***/
public long getArticleCountLong()
{
- return __estimatedArticleCount;
+ return estimatedArticleCount;
}
/***
@@ -110,7 +110,7 @@ public final class NewsgroupInfo
***/
public long getFirstArticleLong()
{
- return __firstArticle;
+ return firstArticle;
}
/***
@@ -120,7 +120,7 @@ public final class NewsgroupInfo
***/
public long getLastArticleLong()
{
- return __lastArticle;
+ return lastArticle;
}
/***
@@ -131,7 +131,7 @@ public final class NewsgroupInfo
***/
public int getPostingPermission()
{
- return __postingPermission;
+ return postingPermission;
}
/*
@@ -156,16 +156,16 @@ public final class NewsgroupInfo
@Deprecated
public int getArticleCount() {
- return (int) __estimatedArticleCount;
+ return (int) estimatedArticleCount;
}
@Deprecated
public int getFirstArticle() {
- return (int) __firstArticle;
+ return (int) firstArticle;
}
@Deprecated
public int getLastArticle() {
- return (int) __lastArticle;
+ return (int) lastArticle;
}
}
diff --git a/src/main/java/org/apache/commons/net/nntp/SimpleNNTPHeader.java b/src/main/java/org/apache/commons/net/nntp/SimpleNNTPHeader.java
index 903ed5e..8e97c20 100644
--- a/src/main/java/org/apache/commons/net/nntp/SimpleNNTPHeader.java
+++ b/src/main/java/org/apache/commons/net/nntp/SimpleNNTPHeader.java
@@ -46,10 +46,10 @@ package org.apache.commons.net.nntp;
public class SimpleNNTPHeader
{
- private final String __subject, __from;
- private final StringBuilder __newsgroups;
- private final StringBuilder __headerFields;
- private int __newsgroupCount;
+ private final String subject, from;
+ private final StringBuilder newsgroups;
+ private final StringBuilder headerFields;
+ private int newsgroupCount;
/***
* Creates a new SimpleNNTPHeader instance initialized with the given
@@ -62,11 +62,11 @@ public class SimpleNNTPHeader
***/
public SimpleNNTPHeader(final String from, final String subject)
{
- __from = from;
- __subject = subject;
- __newsgroups = new StringBuilder();
- __headerFields = new StringBuilder();
- __newsgroupCount = 0;
+ this.from = from;
+ this.subject = subject;
+ this.newsgroups = new StringBuilder();
+ this.headerFields = new StringBuilder();
+ this.newsgroupCount = 0;
}
/***
@@ -77,10 +77,10 @@ public class SimpleNNTPHeader
***/
public void addNewsgroup(final String newsgroup)
{
- if (__newsgroupCount++ > 0) {
- __newsgroups.append(',');
+ if (newsgroupCount++ > 0) {
+ newsgroups.append(',');
}
- __newsgroups.append(newsgroup);
+ newsgroups.append(newsgroup);
}
/***
@@ -97,10 +97,10 @@ public class SimpleNNTPHeader
***/
public void addHeaderField(final String headerField, final String value)
{
- __headerFields.append(headerField);
- __headerFields.append(": ");
- __headerFields.append(value);
- __headerFields.append('\n');
+ headerFields.append(headerField);
+ headerFields.append(": ");
+ headerFields.append(value);
+ headerFields.append('\n');
}
@@ -111,7 +111,7 @@ public class SimpleNNTPHeader
***/
public String getFromAddress()
{
- return __from;
+ return from;
}
/***
@@ -121,7 +121,7 @@ public class SimpleNNTPHeader
***/
public String getSubject()
{
- return __subject;
+ return subject;
}
/***
@@ -132,7 +132,7 @@ public class SimpleNNTPHeader
***/
public String getNewsgroups()
{
- return __newsgroups.toString();
+ return newsgroups.toString();
}
/***
@@ -148,14 +148,14 @@ public class SimpleNNTPHeader
final StringBuilder header = new StringBuilder();
header.append("From: ");
- header.append(__from);
+ header.append(from);
header.append("\nNewsgroups: ");
- header.append(__newsgroups.toString());
+ header.append(newsgroups.toString());
header.append("\nSubject: ");
- header.append(__subject);
+ header.append(subject);
header.append('\n');
- if (__headerFields.length() > 0) {
- header.append(__headerFields.toString());
+ if (headerFields.length() > 0) {
+ header.append(headerFields.toString());
}
header.append('\n');
diff --git a/src/main/java/org/apache/commons/net/ntp/NTPUDPClient.java b/src/main/java/org/apache/commons/net/ntp/NTPUDPClient.java
index dd1a4d8..80097f3 100644
--- a/src/main/java/org/apache/commons/net/ntp/NTPUDPClient.java
+++ b/src/main/java/org/apache/commons/net/ntp/NTPUDPClient.java
@@ -42,7 +42,7 @@ public final class NTPUDPClient extends DatagramSocketClient
/*** The default NTP port. It is set to 123 according to RFC 1305. ***/
public static final int DEFAULT_PORT = 123;
- private int _version = NtpV3Packet.VERSION_3;
+ private int version = NtpV3Packet.VERSION_3;
/***
* Retrieves the time information from the specified server and port and
@@ -66,7 +66,7 @@ public final class NTPUDPClient extends DatagramSocketClient
final NtpV3Packet message = new NtpV3Impl();
message.setMode(NtpV3Packet.MODE_CLIENT);
- message.setVersion(_version);
+ message.setVersion(version);
final DatagramPacket sendPacket = message.getDatagramPacket();
sendPacket.setAddress(host);
sendPacket.setPort(port);
@@ -121,7 +121,7 @@ public final class NTPUDPClient extends DatagramSocketClient
***/
public int getVersion()
{
- return _version;
+ return version;
}
/***
@@ -132,7 +132,7 @@ public final class NTPUDPClient extends DatagramSocketClient
***/
public void setVersion(final int version)
{
- _version = version;
+ this.version = version;
}
}
diff --git a/src/main/java/org/apache/commons/net/ntp/TimeInfo.java b/src/main/java/org/apache/commons/net/ntp/TimeInfo.java
index 67368c9..d1d5966 100644
--- a/src/main/java/org/apache/commons/net/ntp/TimeInfo.java
+++ b/src/main/java/org/apache/commons/net/ntp/TimeInfo.java
@@ -29,20 +29,20 @@ import java.util.List;
*/
public class TimeInfo {
- private final NtpV3Packet _message;
- private List<String> _comments;
- private Long _delay;
- private Long _offset;
+ private final NtpV3Packet message;
+ private List<String> comments;
+ private Long delay;
+ private Long offset;
/**
* time at which time message packet was received by local machine
*/
- private final long _returnTime;
+ private final long returnTime;
/**
* flag indicating that the TimeInfo details was processed and delay/offset were computed
*/
- private boolean _detailsComputed;
+ private boolean detailsComputed;
/**
* Create TimeInfo object with raw packet message and destination time received.
@@ -102,9 +102,9 @@ public class TimeInfo {
if (message == null) {
throw new IllegalArgumentException("message cannot be null");
}
- this._returnTime = returnTime;
- this._message = message;
- this._comments = comments;
+ this.returnTime = returnTime;
+ this.message = message;
+ this.comments = comments;
if (doComputeDetails) {
computeDetails();
}
@@ -119,10 +119,10 @@ public class TimeInfo {
*/
public void addComment(final String comment)
{
- if (_comments == null) {
- _comments = new ArrayList<>();
+ if (comments == null) {
+ comments = new ArrayList<>();
}
- _comments.add(comment);
+ comments.add(comment);
}
/**
@@ -131,23 +131,23 @@ public class TimeInfo {
*/
public void computeDetails()
{
- if (_detailsComputed) {
+ if (detailsComputed) {
return; // details already computed - do nothing
}
- _detailsComputed = true;
- if (_comments == null) {
- _comments = new ArrayList<>();
+ detailsComputed = true;
+ if (comments == null) {
+ comments = new ArrayList<>();
}
- final TimeStamp origNtpTime = _message.getOriginateTimeStamp();
+ final TimeStamp origNtpTime = message.getOriginateTimeStamp();
final long origTime = origNtpTime.getTime();
// Receive Time is time request received by server (t2)
- final TimeStamp rcvNtpTime = _message.getReceiveTimeStamp();
+ final TimeStamp rcvNtpTime = message.getReceiveTimeStamp();
final long rcvTime = rcvNtpTime.getTime();
// Transmit time is time reply sent by server (t3)
- final TimeStamp xmitNtpTime = _message.getTransmitTimeStamp();
+ final TimeStamp xmitNtpTime = message.getTransmitTimeStamp();
final long xmitTime = xmitNtpTime.getTime();
/*
@@ -172,20 +172,20 @@ public class TimeInfo {
// might be via a broadcast NTP packet...
if (xmitNtpTime.ntpValue() != 0)
{
- _offset = Long.valueOf(xmitTime - _returnTime);
- _comments.add("Error: zero orig time -- cannot compute delay");
+ offset = Long.valueOf(xmitTime - returnTime);
+ comments.add("Error: zero orig time -- cannot compute delay");
} else {
- _comments.add("Error: zero orig time -- cannot compute delay/offset");
+ comments.add("Error: zero orig time -- cannot compute delay/offset");
}
} else if (rcvNtpTime.ntpValue() == 0 || xmitNtpTime.ntpValue() == 0) {
- _comments.add("Warning: zero rcvNtpTime or xmitNtpTime");
+ comments.add("Warning: zero rcvNtpTime or xmitNtpTime");
// assert destTime >= origTime since network delay cannot be negative
- if (origTime > _returnTime) {
- _comments.add("Error: OrigTime > DestRcvTime");
+ if (origTime > returnTime) {
+ comments.add("Error: OrigTime > DestRcvTime");
} else {
// without receive or xmit time cannot figure out processing time
// so delay is simply the network travel time
- _delay = Long.valueOf(_returnTime - origTime);
+ delay = Long.valueOf(returnTime - origTime);
}
// TODO: is offset still valid if rcvNtpTime=0 || xmitNtpTime=0 ???
// Could always hash origNtpTime (sendTime) but if host doesn't set it
@@ -194,20 +194,20 @@ public class TimeInfo {
if (rcvNtpTime.ntpValue() != 0)
{
// xmitTime is 0 just use rcv time
- _offset = Long.valueOf(rcvTime - origTime);
+ offset = Long.valueOf(rcvTime - origTime);
} else if (xmitNtpTime.ntpValue() != 0)
{
// rcvTime is 0 just use xmitTime time
- _offset = Long.valueOf(xmitTime - _returnTime);
+ offset = Long.valueOf(xmitTime - returnTime);
}
} else
{
- long delayValue = _returnTime - origTime;
+ long delayValue = returnTime - origTime;
// assert xmitTime >= rcvTime: difference typically < 1ms
if (xmitTime < rcvTime)
{
// server cannot send out a packet before receiving it...
- _comments.add("Error: xmitTime < rcvTime"); // time-travel not allowed
+ comments.add("Error: xmitTime < rcvTime"); // time-travel not allowed
} else
{
// subtract processing time from round-trip network delay
@@ -226,20 +226,20 @@ public class TimeInfo {
// delayValue == 0 -> local clock saw no tick change but destination clock did
if (delayValue != 0)
{
- _comments.add("Info: processing time > total network time by 1 ms -> assume zero delay");
+ comments.add("Info: processing time > total network time by 1 ms -> assume zero delay");
delayValue = 0;
}
} else {
- _comments.add("Warning: processing time > total network time");
+ comments.add("Warning: processing time > total network time");
}
}
}
- _delay = Long.valueOf(delayValue);
- if (origTime > _returnTime) {
- _comments.add("Error: OrigTime > DestRcvTime");
+ delay = Long.valueOf(delayValue);
+ if (origTime > returnTime) {
+ comments.add("Error: OrigTime > DestRcvTime");
}
- _offset = Long.valueOf(((rcvTime - origTime) + (xmitTime - _returnTime)) / 2);
+ offset = Long.valueOf(((rcvTime - origTime) + (xmitTime - returnTime)) / 2);
}
}
@@ -250,7 +250,7 @@ public class TimeInfo {
*/
public List<String> getComments()
{
- return _comments;
+ return comments;
}
/**
@@ -260,7 +260,7 @@ public class TimeInfo {
*/
public Long getDelay()
{
- return _delay;
+ return delay;
}
/**
@@ -271,7 +271,7 @@ public class TimeInfo {
*/
public Long getOffset()
{
- return _offset;
+ return offset;
}
/**
@@ -281,7 +281,7 @@ public class TimeInfo {
*/
public NtpV3Packet getMessage()
{
- return _message;
+ return message;
}
/**
@@ -290,7 +290,7 @@ public class TimeInfo {
* @since 3.4
*/
public InetAddress getAddress() {
- final DatagramPacket pkt = _message.getDatagramPacket();
+ final DatagramPacket pkt = message.getDatagramPacket();
return pkt == null ? null : pkt.getAddress();
}
@@ -301,7 +301,7 @@ public class TimeInfo {
*/
public long getReturnTime()
{
- return _returnTime;
+ return returnTime;
}
/**
@@ -325,7 +325,7 @@ public class TimeInfo {
return false;
}
final TimeInfo other = (TimeInfo) obj;
- return _returnTime == other._returnTime && _message.equals(other._message);
+ return returnTime == other.returnTime && message.equals(other.message);
}
/**
@@ -339,8 +339,8 @@ public class TimeInfo {
public int hashCode()
{
final int prime = 31;
- int result = (int)_returnTime;
- result = prime * result + _message.hashCode();
+ int result = (int)returnTime;
+ result = prime * result + message.hashCode();
return result;
}
diff --git a/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java b/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
index 39725b4..5110e42 100644
--- a/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
+++ b/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
@@ -87,7 +87,7 @@ public class ExtendedPOP3Client extends POP3SClient
final Mac hmac_md5 = Mac.getInstance("HmacMD5");
hmac_md5.init(new SecretKeySpec(password.getBytes(getCharset()), "HmacMD5"));
// compute the result:
- final byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
+ final byte[] hmacResult = convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
// join the byte arrays to form the reply
final byte[] usernameBytes = username.getBytes(getCharset());
final byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
@@ -108,7 +108,7 @@ public class ExtendedPOP3Client extends POP3SClient
* @param a The byte array to convert.
* @return The resulting String of hex codes.
*/
- private String _convertToHexString(final byte[] a)
+ private String convertToHexString(final byte[] a)
{
final StringBuilder result = new StringBuilder(a.length*2);
for (final byte element : a)
diff --git a/src/main/java/org/apache/commons/net/pop3/POP3.java b/src/main/java/org/apache/commons/net/pop3/POP3.java
index 8c267d6..c35a1e1 100644
--- a/src/main/java/org/apache/commons/net/pop3/POP3.java
+++ b/src/main/java/org/apache/commons/net/pop3/POP3.java
@@ -80,13 +80,13 @@ public class POP3 extends SocketClient
// the wire.
static final Charset _DEFAULT_ENCODING = StandardCharsets.ISO_8859_1;
- private int __popState;
- BufferedWriter _writer;
+ private int popState;
+ BufferedWriter writer;
- BufferedReader _reader;
- int _replyCode;
- String _lastReplyLine;
- List<String> _replyLines;
+ BufferedReader reader;
+ int replyCode;
+ String lastReplyLine;
+ List<String> replyLines;
/**
* A ProtocolCommandSupport object used to manage the registering of
@@ -101,40 +101,40 @@ public class POP3 extends SocketClient
public POP3()
{
setDefaultPort(DEFAULT_PORT);
- __popState = DISCONNECTED_STATE;
- _reader = null;
- _writer = null;
- _replyLines = new ArrayList<>();
+ popState = DISCONNECTED_STATE;
+ reader = null;
+ writer = null;
+ replyLines = new ArrayList<>();
_commandSupport_ = new ProtocolCommandSupport(this);
}
- private void __getReply() throws IOException
+ private void getReply() throws IOException
{
String line;
- _replyLines.clear();
- line = _reader.readLine();
+ replyLines.clear();
+ line = reader.readLine();
if (line == null) {
throw new EOFException("Connection closed without indication.");
}
if (line.startsWith(_OK)) {
- _replyCode = POP3Reply.OK;
+ replyCode = POP3Reply.OK;
} else if (line.startsWith(_ERROR)) {
- _replyCode = POP3Reply.ERROR;
+ replyCode = POP3Reply.ERROR;
} else if (line.startsWith(_OK_INT)) {
- _replyCode = POP3Reply.OK_INT;
+ replyCode = POP3Reply.OK_INT;
} else {
throw new
MalformedServerReplyException(
"Received invalid POP3 protocol response from server." + line);
}
- _replyLines.add(line);
- _lastReplyLine = line;
+ replyLines.add(line);
+ lastReplyLine = line;
- fireReplyReceived(_replyCode, getReplyString());
+ fireReplyReceived(replyCode, getReplyString());
}
@@ -146,13 +146,13 @@ public class POP3 extends SocketClient
protected void _connectAction_() throws IOException
{
super._connectAction_();
- _reader =
+ reader =
new CRLFLineReader(new InputStreamReader(_input_,
_DEFAULT_ENCODING));
- _writer =
+ writer =
new BufferedWriter(new OutputStreamWriter(_output_,
_DEFAULT_ENCODING));
- __getReply();
+ getReply();
setState(AUTHORIZATION_STATE);
}
@@ -163,7 +163,7 @@ public class POP3 extends SocketClient
*/
public void setState(final int state)
{
- __popState = state;
+ popState = state;
}
@@ -174,7 +174,7 @@ public class POP3 extends SocketClient
***/
public int getState()
{
- return __popState;
+ return popState;
}
@@ -186,14 +186,14 @@ public class POP3 extends SocketClient
{
String line;
- line = _reader.readLine();
+ line = reader.readLine();
while (line != null)
{
- _replyLines.add(line);
+ replyLines.add(line);
if (line.equals(".")) {
break;
}
- line = _reader.readLine();
+ line = reader.readLine();
}
}
@@ -210,10 +210,10 @@ public class POP3 extends SocketClient
public void disconnect() throws IOException
{
super.disconnect();
- _reader = null;
- _writer = null;
- _lastReplyLine = null;
- _replyLines.clear();
+ reader = null;
+ writer = null;
+ lastReplyLine = null;
+ replyLines.clear();
setState(DISCONNECTED_STATE);
}
@@ -228,7 +228,7 @@ public class POP3 extends SocketClient
***/
public int sendCommand(final String command, final String args) throws IOException
{
- if (_writer == null) {
+ if (writer == null) {
throw new IllegalStateException("Socket is not connected");
}
final StringBuilder __commandBuffer = new StringBuilder();
@@ -242,13 +242,13 @@ public class POP3 extends SocketClient
__commandBuffer.append(SocketClient.NETASCII_EOL);
final String message = __commandBuffer.toString();
- _writer.write(message);
- _writer.flush();
+ writer.write(message);
+ writer.flush();
fireCommandSent(command, message);
- __getReply();
- return _replyCode;
+ getReply();
+ return replyCode;
}
/***
@@ -275,7 +275,7 @@ public class POP3 extends SocketClient
***/
public int sendCommand(final int command, final String args) throws IOException
{
- return sendCommand(POP3Command._commands[command], args);
+ return sendCommand(POP3Command.commands[command], args);
}
/***
@@ -289,7 +289,7 @@ public class POP3 extends SocketClient
***/
public int sendCommand(final int command) throws IOException
{
- return sendCommand(POP3Command._commands[command], null);
+ return sendCommand(POP3Command.commands[command], null);
}
@@ -307,7 +307,7 @@ public class POP3 extends SocketClient
***/
public String[] getReplyStrings()
{
- return _replyLines.toArray(new String[_replyLines.size()]);
+ return replyLines.toArray(new String[replyLines.size()]);
}
/***
@@ -326,7 +326,7 @@ public class POP3 extends SocketClient
{
final StringBuilder buffer = new StringBuilder(256);
- for (final String entry : _replyLines)
+ for (final String entry : replyLines)
{
buffer.append(entry);
buffer.append(SocketClient.NETASCII_EOL);
diff --git a/src/main/java/org/apache/commons/net/pop3/POP3Client.java b/src/main/java/org/apache/commons/net/pop3/POP3Client.java
index 9a2973a..2b07085 100644
--- a/src/main/java/org/apache/commons/net/pop3/POP3Client.java
+++ b/src/main/java/org/apache/commons/net/pop3/POP3Client.java
@@ -51,7 +51,7 @@ import org.apache.commons.net.io.DotTerminatedMessageReader;
public class POP3Client extends POP3
{
- private static POP3MessageInfo __parseStatus(final String line)
+ private static POP3MessageInfo parseStatus(final String line)
{
int num, size;
StringTokenizer tokenizer;
@@ -82,7 +82,7 @@ public class POP3Client extends POP3
return new POP3MessageInfo(num, size);
}
- private static POP3MessageInfo __parseUID(String line)
+ private static POP3MessageInfo parseUID(String line)
{
int num;
StringTokenizer tokenizer;
@@ -261,7 +261,7 @@ public class POP3Client extends POP3
setState(UPDATE_STATE);
}
sendCommand(POP3Command.QUIT);
- return _replyCode == POP3Reply.OK;
+ return replyCode == POP3Reply.OK;
}
@@ -353,7 +353,7 @@ public class POP3Client extends POP3
if (sendCommand(POP3Command.STAT) != POP3Reply.OK) {
return null;
}
- return __parseStatus(_lastReplyLine.substring(3));
+ return parseStatus(lastReplyLine.substring(3));
}
@@ -383,7 +383,7 @@ public class POP3Client extends POP3
!= POP3Reply.OK) {
return null;
}
- return __parseStatus(_lastReplyLine.substring(3));
+ return parseStatus(lastReplyLine.substring(3));
}
@@ -415,13 +415,13 @@ public class POP3Client extends POP3
getAdditionalReply();
// This could be a zero length array if no messages present
- final POP3MessageInfo[] messages = new POP3MessageInfo[_replyLines.size() - 2]; // skip first and last lines
+ final POP3MessageInfo[] messages = new POP3MessageInfo[replyLines.size() - 2]; // skip first and last lines
- final ListIterator<String> en = _replyLines.listIterator(1); // Skip first line
+ final ListIterator<String> en = replyLines.listIterator(1); // Skip first line
// Fetch lines.
for (int line = 0; line < messages.length; line++) {
- messages[line] = __parseStatus(en.next());
+ messages[line] = parseStatus(en.next());
}
return messages;
@@ -454,7 +454,7 @@ public class POP3Client extends POP3
!= POP3Reply.OK) {
return null;
}
- return __parseUID(_lastReplyLine.substring(3));
+ return parseUID(lastReplyLine.substring(3));
}
@@ -486,13 +486,13 @@ public class POP3Client extends POP3
getAdditionalReply();
// This could be a zero length array if no messages present
- final POP3MessageInfo[] messages = new POP3MessageInfo[_replyLines.size() - 2]; // skip first and last lines
+ final POP3MessageInfo[] messages = new POP3MessageInfo[replyLines.size() - 2]; // skip first and last lines
- final ListIterator<String> en = _replyLines.listIterator(1); // skip first line
+ final ListIterator<String> en = replyLines.listIterator(1); // skip first line
// Fetch lines.
for (int line = 0; line < messages.length; line++) {
- messages[line] = __parseUID(en.next());
+ messages[line] = parseUID(en.next());
}
return messages;
@@ -533,7 +533,7 @@ public class POP3Client extends POP3
return null;
}
- return new DotTerminatedMessageReader(_reader);
+ return new DotTerminatedMessageReader(reader);
}
@@ -576,7 +576,7 @@ public class POP3Client extends POP3
return null;
}
- return new DotTerminatedMessageReader(_reader);
+ return new DotTerminatedMessageReader(reader);
}
diff --git a/src/main/java/org/apache/commons/net/pop3/POP3Command.java b/src/main/java/org/apache/commons/net/pop3/POP3Command.java
index a378b13..79a1660 100644
--- a/src/main/java/org/apache/commons/net/pop3/POP3Command.java
+++ b/src/main/java/org/apache/commons/net/pop3/POP3Command.java
@@ -60,15 +60,15 @@ public final class POP3Command
*/
public static final int AUTH = 13;
- private static final int _NEXT_ = AUTH + 1; // update as necessary when adding new entries
+ private static final int NEXT = AUTH + 1; // update as necessary when adding new entries
- static final String[] _commands = {
+ static final String[] commands = {
"USER", "PASS", "QUIT", "STAT", "LIST", "RETR", "DELE", "NOOP", "RSET",
"APOP", "TOP", "UIDL", "CAPA", "AUTH",
};
static {
- if (_commands.length != _NEXT_) {
+ if (commands.length != NEXT) {
throw new RuntimeException("Error in array definition");
}
}
@@ -85,6 +85,6 @@ public final class POP3Command
***/
public static String getCommand(final int command)
{
- return _commands[command];
+ return commands[command];
}
}
diff --git a/src/main/java/org/apache/commons/net/pop3/POP3SClient.java b/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
index 8c23f00..c5d8561 100644
--- a/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
+++ b/src/main/java/org/apache/commons/net/pop3/POP3SClient.java
@@ -230,8 +230,8 @@ public class POP3SClient extends POP3Client
_socket_ = socket;
_input_ = socket.getInputStream();
_output_ = socket.getOutputStream();
- _reader = new CRLFLineReader(new InputStreamReader(_input_, _DEFAULT_ENCODING));
- _writer = new BufferedWriter(new OutputStreamWriter(_output_, _DEFAULT_ENCODING));
+ reader = new CRLFLineReader(new InputStreamReader(_input_, _DEFAULT_ENCODING));
+ writer = new BufferedWriter(new OutputStreamWriter(_output_, _DEFAULT_ENCODING));
if (hostnameVerifier != null && !hostnameVerifier.verify(host, socket.getSession())) {
throw new SSLHandshakeException("Hostname doesn't match certificate");
diff --git a/src/main/java/org/apache/commons/net/smtp/RelayPath.java b/src/main/java/org/apache/commons/net/smtp/RelayPath.java
index d766b8c..e7a5524 100644
--- a/src/main/java/org/apache/commons/net/smtp/RelayPath.java
+++ b/src/main/java/org/apache/commons/net/smtp/RelayPath.java
@@ -31,8 +31,8 @@ import java.util.Vector;
public final class RelayPath
{
- Vector<String> _path;
- String _emailAddress;
+ Vector<String> path;
+ String emailAddress;
/***
* Create a relay path with the specified email address as the ultimate
@@ -42,8 +42,8 @@ public final class RelayPath
***/
public RelayPath(final String emailAddress)
{
- _path = new Vector<>();
- _emailAddress = emailAddress;
+ this.path = new Vector<>();
+ this.emailAddress = emailAddress;
}
/***
@@ -60,7 +60,7 @@ public final class RelayPath
***/
public void addRelay(final String hostname)
{
- _path.addElement(hostname);
+ path.addElement(hostname);
}
/***
@@ -76,7 +76,7 @@ public final class RelayPath
buffer.append('<');
- hosts = _path.elements();
+ hosts = path.elements();
if (hosts.hasMoreElements())
{
@@ -91,7 +91,7 @@ public final class RelayPath
buffer.append(':');
}
- buffer.append(_emailAddress);
+ buffer.append(emailAddress);
buffer.append('>');
return buffer.toString();
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTP.java b/src/main/java/org/apache/commons/net/smtp/SMTP.java
index 6d85b41..4a77a74 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTP.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTP.java
@@ -89,7 +89,7 @@ public class SMTP extends SocketClient
// We have to ensure that the protocol communication is in ASCII
// but we use ISO-8859-1 just in case 8-bit characters cross
// the wire.
- private static final String __DEFAULT_ENCODING = "ISO-8859-1";
+ private static final String DEFAULT_ENCODING = "ISO-8859-1";
/**
* The encoding to use (user-settable).
@@ -104,13 +104,13 @@ public class SMTP extends SocketClient
*/
protected ProtocolCommandSupport _commandSupport_;
- BufferedReader _reader;
- BufferedWriter _writer;
+ BufferedReader reader;
+ BufferedWriter writer;
- private int _replyCode;
- private final ArrayList<String> _replyLines;
- private boolean _newReplyString;
- private String _replyString;
+ private int replyCode;
+ private final ArrayList<String> replyLines;
+ private boolean newReplyString;
+ private String replyString;
/***
* The default SMTP constructor. Sets the default port to
@@ -119,7 +119,7 @@ public class SMTP extends SocketClient
***/
public SMTP()
{
- this(__DEFAULT_ENCODING);
+ this(DEFAULT_ENCODING);
}
/**
@@ -129,9 +129,9 @@ public class SMTP extends SocketClient
*/
public SMTP(final String encoding) {
setDefaultPort(DEFAULT_PORT);
- _replyLines = new ArrayList<>();
- _newReplyString = false;
- _replyString = null;
+ replyLines = new ArrayList<>();
+ newReplyString = false;
+ replyString = null;
_commandSupport_ = new ProtocolCommandSupport(this);
this.encoding = encoding;
}
@@ -162,13 +162,13 @@ public class SMTP extends SocketClient
__commandBuffer.append(SocketClient.NETASCII_EOL);
final String message = __commandBuffer.toString();
- _writer.write(message);
- _writer.flush();
+ writer.write(message);
+ writer.flush();
fireCommandSent(command, message);
__getReply();
- return _replyCode;
+ return replyCode;
}
/**
@@ -189,10 +189,10 @@ public class SMTP extends SocketClient
{
int length;
- _newReplyString = true;
- _replyLines.clear();
+ newReplyString = true;
+ replyLines.clear();
- String line = _reader.readLine();
+ String line = reader.readLine();
if (line == null) {
throw new SMTPConnectionClosedException(
@@ -210,7 +210,7 @@ public class SMTP extends SocketClient
try
{
final String code = line.substring(0, 3);
- _replyCode = Integer.parseInt(code);
+ replyCode = Integer.parseInt(code);
}
catch (final NumberFormatException e)
{
@@ -218,21 +218,21 @@ public class SMTP extends SocketClient
"Could not parse response code.\nServer Reply: " + line);
}
- _replyLines.add(line);
+ replyLines.add(line);
// Get extra lines if message continues.
if (length > 3 && line.charAt(3) == '-')
{
do
{
- line = _reader.readLine();
+ line = reader.readLine();
if (line == null) {
throw new SMTPConnectionClosedException(
"Connection closed without indication.");
}
- _replyLines.add(line);
+ replyLines.add(line);
// The length() check handles problems that could arise from readLine()
// returning too soon after encountering a naked CR or some other
@@ -245,9 +245,9 @@ public class SMTP extends SocketClient
// line.startsWith(code)));
}
- fireReplyReceived(_replyCode, getReplyString());
+ fireReplyReceived(replyCode, getReplyString());
- if (_replyCode == SMTPReply.SERVICE_NOT_AVAILABLE) {
+ if (replyCode == SMTPReply.SERVICE_NOT_AVAILABLE) {
throw new SMTPConnectionClosedException(
"SMTP response 421 received. Server closed connection.");
}
@@ -258,10 +258,10 @@ public class SMTP extends SocketClient
protected void _connectAction_() throws IOException
{
super._connectAction_();
- _reader =
+ reader =
new CRLFLineReader(new InputStreamReader(_input_,
encoding));
- _writer =
+ writer =
new BufferedWriter(new OutputStreamWriter(_output_,
encoding));
__getReply();
@@ -281,11 +281,11 @@ public class SMTP extends SocketClient
public void disconnect() throws IOException
{
super.disconnect();
- _reader = null;
- _writer = null;
- _replyString = null;
- _replyLines.clear();
- _newReplyString = false;
+ reader = null;
+ writer = null;
+ replyString = null;
+ replyLines.clear();
+ newReplyString = false;
}
@@ -401,7 +401,7 @@ public class SMTP extends SocketClient
***/
public int getReplyCode()
{
- return _replyCode;
+ return replyCode;
}
/***
@@ -424,7 +424,7 @@ public class SMTP extends SocketClient
public int getReply() throws IOException
{
__getReply();
- return _replyCode;
+ return replyCode;
}
@@ -437,7 +437,7 @@ public class SMTP extends SocketClient
***/
public String[] getReplyStrings()
{
- return _replyLines.toArray(new String[_replyLines.size()]);
+ return replyLines.toArray(new String[replyLines.size()]);
}
/***
@@ -451,22 +451,22 @@ public class SMTP extends SocketClient
{
StringBuilder buffer;
- if (!_newReplyString) {
- return _replyString;
+ if (!newReplyString) {
+ return replyString;
}
buffer = new StringBuilder();
- for (final String line : _replyLines)
+ for (final String line : replyLines)
{
buffer.append(line);
buffer.append(SocketClient.NETASCII_EOL);
}
- _newReplyString = false;
+ newReplyString = false;
- _replyString = buffer.toString();
- return _replyString;
+ replyString = buffer.toString();
+ return replyString;
}
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTPClient.java b/src/main/java/org/apache/commons/net/smtp/SMTPClient.java
index 4abf4a3..b3b03d6 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTPClient.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTPClient.java
@@ -363,7 +363,7 @@ public class SMTPClient extends SMTP
return null;
}
- return new DotTerminatedMessageWriter(_writer);
+ return new DotTerminatedMessageWriter(writer);
}
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java b/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
index ef31979..49d4387 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTPCommand.java
@@ -57,7 +57,7 @@ public final class SMTPCommand
*/
public static final int EHLO = 15 ;
- private static final int _NEXT_ = EHLO + 1; // update as necessary when adding new entries
+ private static final int NEXT = EHLO + 1; // update as necessary when adding new entries
public static final int HELLO = HELO;
public static final int LOGIN = HELO;
@@ -80,7 +80,7 @@ public final class SMTPCommand
private SMTPCommand()
{}
- private static final String[] _commands = {
+ private static final String[] commands = {
"HELO", "MAIL FROM:", "RCPT TO:", "DATA", "SEND FROM:", "SOML FROM:",
"SAML FROM:", "RSET", "VRFY", "EXPN", "HELP", "NOOP", "TURN", "QUIT",
"AUTH", "EHLO"
@@ -88,7 +88,7 @@ public final class SMTPCommand
static {
- if (_commands.length != _NEXT_) {
+ if (commands.length != NEXT) {
throw new RuntimeException("Error in array definition");
}
}
@@ -103,7 +103,7 @@ public final class SMTPCommand
***/
public static String getCommand(final int command)
{
- return _commands[command];
+ return commands[command];
}
}
diff --git a/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java b/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
index 9eef19f..3781473 100644
--- a/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
+++ b/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java
@@ -218,9 +218,9 @@ public class SMTPSClient extends SMTPClient
_socket_ = socket;
_input_ = socket.getInputStream();
_output_ = socket.getOutputStream();
- _reader = new CRLFLineReader(
+ reader = new CRLFLineReader(
new InputStreamReader(_input_, encoding));
- _writer = new BufferedWriter(
+ writer = new BufferedWriter(
new OutputStreamWriter(_output_, encoding));
if (hostnameVerifier != null && !hostnameVerifier.verify(host, socket.getSession())) {
diff --git a/src/main/java/org/apache/commons/net/smtp/SimpleSMTPHeader.java b/src/main/java/org/apache/commons/net/smtp/SimpleSMTPHeader.java
index acf6b64..4d71ad4 100644
--- a/src/main/java/org/apache/commons/net/smtp/SimpleSMTPHeader.java
+++ b/src/main/java/org/apache/commons/net/smtp/SimpleSMTPHeader.java
@@ -51,12 +51,12 @@ import java.util.Locale;
public class SimpleSMTPHeader
{
- private final String __subject;
- private final String __from;
- private final String __to;
- private final StringBuffer __headerFields;
+ private final String subject;
+ private final String from;
+ private final String to;
+ private final StringBuffer headerFields;
private boolean hasHeaderDate;
- private StringBuffer __cc;
+ private StringBuffer cc;
/***
* Creates a new SimpleSMTPHeader instance initialized with the given
@@ -77,11 +77,11 @@ public class SimpleSMTPHeader
if (from == null) {
throw new IllegalArgumentException("From cannot be null");
}
- __to = to;
- __from = from;
- __subject = subject;
- __headerFields = new StringBuffer();
- __cc = null;
+ this.to = to;
+ this.from = from;
+ this.subject = subject;
+ this.headerFields = new StringBuffer();
+ this.cc = null;
}
/***
@@ -101,10 +101,10 @@ public class SimpleSMTPHeader
if (!hasHeaderDate && "Date".equals(headerField)) {
hasHeaderDate = true;
}
- __headerFields.append(headerField);
- __headerFields.append(": ");
- __headerFields.append(value);
- __headerFields.append('\n');
+ headerFields.append(headerField);
+ headerFields.append(": ");
+ headerFields.append(value);
+ headerFields.append('\n');
}
@@ -115,13 +115,13 @@ public class SimpleSMTPHeader
***/
public void addCC(final String address)
{
- if (__cc == null) {
- __cc = new StringBuffer();
+ if (cc == null) {
+ cc = new StringBuffer();
} else {
- __cc.append(", ");
+ cc.append(", ");
}
- __cc.append(address);
+ cc.append(address);
}
@@ -144,24 +144,24 @@ public class SimpleSMTPHeader
if (!hasHeaderDate) {
addHeaderField("Date", format.format(new Date()));
}
- if (__headerFields.length() > 0) {
- header.append(__headerFields.toString());
+ if (headerFields.length() > 0) {
+ header.append(headerFields.toString());
}
- header.append("From: ").append(__from).append("\n");
+ header.append("From: ").append(from).append("\n");
- if (__to != null) {
- header.append("To: ").append(__to).append("\n");
+ if (to != null) {
+ header.append("To: ").append(to).append("\n");
}
- if (__cc != null)
+ if (cc != null)
{
- header.append("Cc: ").append(__cc.toString()).append("\n");
+ header.append("Cc: ").append(cc.toString()).append("\n");
}
- if (__subject != null)
+ if (subject != null)
{
- header.append("Subject: ").append(__subject).append("\n");
+ header.append("Subject: ").append(subject).append("\n");
}
header.append('\n'); // end of headers; body follows
diff --git a/src/main/java/org/apache/commons/net/telnet/Telnet.java b/src/main/java/org/apache/commons/net/telnet/Telnet.java
index e7a4e0f..a640c23 100644
--- a/src/main/java/org/apache/commons/net/telnet/Telnet.java
+++ b/src/main/java/org/apache/commons/net/telnet/Telnet.java
@@ -61,7 +61,7 @@ class Telnet extends SocketClient
/* public */
static final int DEFAULT_PORT = 23;
- int[] _doResponse, _willResponse, _options;
+ int[] doResponse, willResponse, options;
/* TERMINAL-TYPE option (start)*/
/***
@@ -127,16 +127,16 @@ class Telnet extends SocketClient
/***
* The notification handler
***/
- private TelnetNotificationHandler __notifhand = null;
+ private TelnetNotificationHandler notifhand = null;
/***
* Empty Constructor
***/
Telnet()
{
setDefaultPort(DEFAULT_PORT);
- _doResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
- _willResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
- _options = new int[TelnetOption.MAX_OPTION_VALUE + 1];
+ doResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
+ willResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
+ options = new int[TelnetOption.MAX_OPTION_VALUE + 1];
optionHandlers =
new TelnetOptionHandler[TelnetOption.MAX_OPTION_VALUE + 1];
}
@@ -150,9 +150,9 @@ class Telnet extends SocketClient
Telnet(final String termtype)
{
setDefaultPort(DEFAULT_PORT);
- _doResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
- _willResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
- _options = new int[TelnetOption.MAX_OPTION_VALUE + 1];
+ doResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
+ willResponse = new int[TelnetOption.MAX_OPTION_VALUE + 1];
+ options = new int[TelnetOption.MAX_OPTION_VALUE + 1];
terminalType = termtype;
optionHandlers =
new TelnetOptionHandler[TelnetOption.MAX_OPTION_VALUE + 1];
@@ -166,9 +166,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _stateIsWill(final int option)
+ boolean stateIsWill(final int option)
{
- return (_options[option] & _WILL_MASK) != 0;
+ return (options[option] & _WILL_MASK) != 0;
}
/***
@@ -178,9 +178,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _stateIsWont(final int option)
+ boolean stateIsWont(final int option)
{
- return !_stateIsWill(option);
+ return !stateIsWill(option);
}
/***
@@ -190,9 +190,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _stateIsDo(final int option)
+ boolean stateIsDo(final int option)
{
- return (_options[option] & _DO_MASK) != 0;
+ return (options[option] & _DO_MASK) != 0;
}
/***
@@ -202,9 +202,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _stateIsDont(final int option)
+ boolean stateIsDont(final int option)
{
- return !_stateIsDo(option);
+ return !stateIsDo(option);
}
/***
@@ -214,9 +214,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _requestedWill(final int option)
+ boolean requestedWill(final int option)
{
- return (_options[option] & _REQUESTED_WILL_MASK) != 0;
+ return (options[option] & _REQUESTED_WILL_MASK) != 0;
}
/***
@@ -226,9 +226,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _requestedWont(final int option)
+ boolean requestedWont(final int option)
{
- return !_requestedWill(option);
+ return !requestedWill(option);
}
/***
@@ -238,9 +238,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _requestedDo(final int option)
+ boolean requestedDo(final int option)
{
- return (_options[option] & _REQUESTED_DO_MASK) != 0;
+ return (options[option] & _REQUESTED_DO_MASK) != 0;
}
/***
@@ -250,9 +250,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be looked up.
***/
- boolean _requestedDont(final int option)
+ boolean requestedDont(final int option)
{
- return !_requestedDo(option);
+ return !requestedDo(option);
}
/***
@@ -261,12 +261,12 @@ class Telnet extends SocketClient
* @param option - option code to be set.
* @throws IOException
***/
- void _setWill(final int option) throws IOException
+ void setWill(final int option) throws IOException
{
- _options[option] |= _WILL_MASK;
+ options[option] |= _WILL_MASK;
/* open TelnetOptionHandler functionality (start)*/
- if (_requestedWill(option))
+ if (requestedWill(option))
{
if (optionHandlers[option] != null)
{
@@ -290,12 +290,12 @@ class Telnet extends SocketClient
* @param option - option code to be set.
* @throws IOException
***/
- void _setDo(final int option) throws IOException
+ void setDo(final int option) throws IOException
{
- _options[option] |= _DO_MASK;
+ options[option] |= _DO_MASK;
/* open TelnetOptionHandler functionality (start)*/
- if (_requestedDo(option))
+ if (requestedDo(option))
{
if (optionHandlers[option] != null)
{
@@ -318,9 +318,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be set.
***/
- void _setWantWill(final int option)
+ void setWantWill(final int option)
{
- _options[option] |= _REQUESTED_WILL_MASK;
+ options[option] |= _REQUESTED_WILL_MASK;
}
/***
@@ -328,9 +328,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be set.
***/
- void _setWantDo(final int option)
+ void setWantDo(final int option)
{
- _options[option] |= _REQUESTED_DO_MASK;
+ options[option] |= _REQUESTED_DO_MASK;
}
/***
@@ -338,9 +338,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be set.
***/
- void _setWont(final int option)
+ void setWont(final int option)
{
- _options[option] &= ~_WILL_MASK;
+ options[option] &= ~_WILL_MASK;
/* open TelnetOptionHandler functionality (start)*/
if (optionHandlers[option] != null)
@@ -355,9 +355,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be set.
***/
- void _setDont(final int option)
+ void setDont(final int option)
{
- _options[option] &= ~_DO_MASK;
+ options[option] &= ~_DO_MASK;
/* open TelnetOptionHandler functionality (start)*/
if (optionHandlers[option] != null)
@@ -372,9 +372,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be set.
***/
- void _setWantWont(final int option)
+ void setWantWont(final int option)
{
- _options[option] &= ~_REQUESTED_WILL_MASK;
+ options[option] &= ~_REQUESTED_WILL_MASK;
}
/***
@@ -382,9 +382,9 @@ class Telnet extends SocketClient
*
* @param option - option code to be set.
***/
- void _setWantDont(final int option)
+ void setWantDont(final int option)
{
- _options[option] &= ~_REQUESTED_DO_MASK;
+ options[option] &= ~_REQUESTED_DO_MASK;
}
/**
@@ -392,16 +392,16 @@ class Telnet extends SocketClient
*
* @param command - option code to be set.
**/
- void _processCommand(final int command)
+ void processCommand(final int command)
{
if (debugoptions)
{
System.err.println("RECEIVED COMMAND: " + command);
}
- if (__notifhand != null)
+ if (notifhand != null)
{
- __notifhand.receivedNegotiation(
+ notifhand.receivedNegotiation(
TelnetNotificationHandler.RECEIVED_COMMAND, command);
}
}
@@ -412,7 +412,7 @@ class Telnet extends SocketClient
* @param option - option code to be set.
* @throws IOException - Exception in I/O.
**/
- void _processDo(final int option) throws IOException
+ void processDo(final int option) throws IOException
{
if (debugoptions)
{
@@ -420,9 +420,9 @@ class Telnet extends SocketClient
+ TelnetOption.getOption(option));
}
- if (__notifhand != null)
+ if (notifhand != null)
{
- __notifhand.receivedNegotiation(
+ notifhand.receivedNegotiation(
TelnetNotificationHandler.RECEIVED_DO,
option);
}
@@ -451,18 +451,18 @@ class Telnet extends SocketClient
}
/* open TelnetOptionHandler functionality (end)*/
- if (_willResponse[option] > 0)
+ if (willResponse[option] > 0)
{
- --_willResponse[option];
- if (_willResponse[option] > 0 && _stateIsWill(option))
+ --willResponse[option];
+ if (willResponse[option] > 0 && stateIsWill(option))
{
- --_willResponse[option];
+ --willResponse[option];
}
}
- if (_willResponse[option] == 0)
+ if (willResponse[option] == 0)
{
- if (_requestedWont(option))
+ if (requestedWont(option))
{
switch (option)
@@ -476,13 +476,13 @@ class Telnet extends SocketClient
if (acceptNewState)
{
- _setWantWill(option);
- _sendWill(option);
+ setWantWill(option);
+ sendWill(option);
}
else
{
- ++_willResponse[option];
- _sendWont(option);
+ ++willResponse[option];
+ sendWont(option);
}
}
else
@@ -500,7 +500,7 @@ class Telnet extends SocketClient
}
}
- _setWill(option);
+ setWill(option);
}
/**
@@ -509,29 +509,29 @@ class Telnet extends SocketClient
* @param option - option code to be set.
* @throws IOException - Exception in I/O.
**/
- void _processDont(final int option) throws IOException
+ void processDont(final int option) throws IOException
{
if (debugoptions)
{
System.err.println("RECEIVED DONT: "
+ TelnetOption.getOption(option));
}
- if (__notifhand != null)
+ if (notifhand != null)
{
- __notifhand.receivedNegotiation(
+ notifhand.receivedNegotiation(
TelnetNotificationHandler.RECEIVED_DONT,
option);
}
- if (_willResponse[option] > 0)
+ if (willResponse[option] > 0)
{
- --_willResponse[option];
- if (_willResponse[option] > 0 && _stateIsWont(option))
+ --willResponse[option];
+ if (willResponse[option] > 0 && stateIsWont(option))
{
- --_willResponse[option];
+ --willResponse[option];
}
}
- if (_willResponse[option] == 0 && _requestedWill(option))
+ if (willResponse[option] == 0 && requestedWill(option))
{
switch (option)
@@ -543,16 +543,16 @@ class Telnet extends SocketClient
}
/* FIX for a BUG in the negotiation (start)*/
- if (_stateIsWill(option) || _requestedWill(option))
+ if (stateIsWill(option) || requestedWill(option))
{
- _sendWont(option);
+ sendWont(option);
}
- _setWantWont(option);
+ setWantWont(option);
/* FIX for a BUG in the negotiation (end)*/
}
- _setWont(option);
+ setWont(option);
}
@@ -562,7 +562,7 @@ class Telnet extends SocketClient
* @param option - option code to be set.
* @throws IOException - Exception in I/O.
**/
- void _processWill(final int option) throws IOException
+ void processWill(final int option) throws IOException
{
if (debugoptions)
{
@@ -570,9 +570,9 @@ class Telnet extends SocketClient
+ TelnetOption.getOption(option));
}
- if (__notifhand != null)
+ if (notifhand != null)
{
- __notifhand.receivedNegotiation(
+ notifhand.receivedNegotiation(
TelnetNotificationHandler.RECEIVED_WILL,
option);
}
@@ -586,16 +586,16 @@ class Telnet extends SocketClient
}
/* open TelnetOptionHandler functionality (end)*/
- if (_doResponse[option] > 0)
+ if (doResponse[option] > 0)
{
- --_doResponse[option];
- if (_doResponse[option] > 0 && _stateIsDo(option))
+ --doResponse[option];
+ if (doResponse[option] > 0 && stateIsDo(option))
{
- --_doResponse[option];
+ --doResponse[option];
}
}
- if (_doResponse[option] == 0 && _requestedDont(option))
+ if (doResponse[option] == 0 && requestedDont(option))
{
switch (option)
@@ -609,17 +609,17 @@ class Telnet extends SocketClient
if (acceptNewState)
{
- _setWantDo(option);
- _sendDo(option);
+ setWantDo(option);
+ sendDo(option);
}
else
{
- ++_doResponse[option];
- _sendDont(option);
+ ++doResponse[option];
+ sendDont(option);
}
}
- _setDo(option);
+ setDo(option);
}
/**
@@ -628,7 +628,7 @@ class Telnet extends SocketClient
* @param option - option code to be set.
* @throws IOException - Exception in I/O.
**/
- void _processWont(final int option) throws IOException
+ void processWont(final int option) throws IOException
{
if (debugoptions)
{
@@ -636,23 +636,23 @@ class Telnet extends SocketClient
+ TelnetOption.getOption(option));
}
- if (__notifhand != null)
+ if (notifhand != null)
{
- __notifhand.receivedNegotiation(
+ notifhand.receivedNegotiation(
TelnetNotificationHandler.RECEIVED_WONT,
option);
}
- if (_doResponse[option] > 0)
+ if (doResponse[option] > 0)
{
- --_doResponse[option];
- if (_doResponse[option] > 0 && _stateIsDont(option))
+ --doResponse[option];
+ if (doResponse[option] > 0 && stateIsDont(option))
{
- --_doResponse[option];
+ --doResponse[option];
}
}
- if (_doResponse[option] == 0 && _requestedDo(option))
+ if (doResponse[option] == 0 && requestedDo(option))
{
switch (option)
@@ -664,16 +664,16 @@ class Telnet extends SocketClient
}
/* FIX for a BUG in the negotiation (start)*/
- if (_stateIsDo(option) || _requestedDo(option))
+ if (stateIsDo(option) || requestedDo(option))
{
- _sendDont(option);
+ sendDont(option);
}
- _setWantDont(option);
+ setWantDont(option);
/* FIX for a BUG in the negotiation (end)*/
}
- _setDont(option);
+ setDont(option);
}
/* TERMINAL-TYPE option (start)*/
@@ -684,7 +684,7 @@ class Telnet extends SocketClient
* @param suboptionLength - length of data received
* @throws IOException - Exception in I/O.
**/
- void _processSuboption(final int suboption[], final int suboptionLength)
+ void processSuboption(final int suboption[], final int suboptionLength)
throws IOException
{
if (debug)
@@ -717,7 +717,7 @@ class Telnet extends SocketClient
if (suboption[0] == TERMINAL_TYPE
&& suboption[1] == TERMINAL_TYPE_SEND)
{
- _sendTerminalType();
+ sendTerminalType();
}
}
}
@@ -730,7 +730,7 @@ class Telnet extends SocketClient
*
* @throws IOException - Exception in I/O.
***/
- final synchronized void _sendTerminalType()
+ final synchronized void sendTerminalType()
throws IOException
{
if (debug)
@@ -806,7 +806,7 @@ class Telnet extends SocketClient
/***
* Processes the response of an AYT
***/
- final synchronized void _processAYTResponse()
+ final synchronized void processAYTResponse()
{
if (!aytFlag)
{
@@ -830,9 +830,9 @@ class Telnet extends SocketClient
/* (start). BUGFIX: clean the option info for each connection*/
for (int ii = 0; ii < TelnetOption.MAX_OPTION_VALUE + 1; ii++)
{
- _doResponse[ii] = 0;
- _willResponse[ii] = 0;
- _options[ii] = 0;
+ doResponse[ii] = 0;
+ willResponse[ii] = 0;
+ options[ii] = 0;
if (optionHandlers[ii] != null)
{
optionHandlers[ii].setDo(false);
@@ -852,12 +852,12 @@ class Telnet extends SocketClient
{
if (optionHandlers[ii].getInitLocal())
{
- _requestWill(optionHandlers[ii].getOptionCode());
+ requestWill(optionHandlers[ii].getOptionCode());
}
if (optionHandlers[ii].getInitRemote())
{
- _requestDo(optionHandlers[ii].getOptionCode());
+ requestDo(optionHandlers[ii].getOptionCode());
}
}
}
@@ -870,7 +870,7 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _sendDo(final int option)
+ final synchronized void sendDo(final int option)
throws IOException
{
if (debug || debugoptions)
@@ -891,17 +891,17 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _requestDo(final int option)
+ final synchronized void requestDo(final int option)
throws IOException
{
- if (_doResponse[option] == 0 && _stateIsDo(option)
- || _requestedDo(option))
+ if (doResponse[option] == 0 && stateIsDo(option)
+ || requestedDo(option))
{
return ;
}
- _setWantDo(option);
- ++_doResponse[option];
- _sendDo(option);
+ setWantDo(option);
+ ++doResponse[option];
+ sendDo(option);
}
/**
@@ -910,7 +910,7 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _sendDont(final int option)
+ final synchronized void sendDont(final int option)
throws IOException
{
if (debug || debugoptions)
@@ -931,17 +931,17 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _requestDont(final int option)
+ final synchronized void requestDont(final int option)
throws IOException
{
- if (_doResponse[option] == 0 && _stateIsDont(option)
- || _requestedDont(option))
+ if (doResponse[option] == 0 && stateIsDont(option)
+ || requestedDont(option))
{
return ;
}
- _setWantDont(option);
- ++_doResponse[option];
- _sendDont(option);
+ setWantDont(option);
+ ++doResponse[option];
+ sendDont(option);
}
@@ -951,7 +951,7 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _sendWill(final int option)
+ final synchronized void sendWill(final int option)
throws IOException
{
if (debug || debugoptions)
@@ -972,17 +972,17 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _requestWill(final int option)
+ final synchronized void requestWill(final int option)
throws IOException
{
- if (_willResponse[option] == 0 && _stateIsWill(option)
- || _requestedWill(option))
+ if (willResponse[option] == 0 && stateIsWill(option)
+ || requestedWill(option))
{
return ;
}
- _setWantWill(option);
- ++_doResponse[option];
- _sendWill(option);
+ setWantWill(option);
+ ++doResponse[option];
+ sendWill(option);
}
/**
@@ -991,7 +991,7 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _sendWont(final int option)
+ final synchronized void sendWont(final int option)
throws IOException
{
if (debug || debugoptions)
@@ -1012,17 +1012,17 @@ class Telnet extends SocketClient
* @param option - Option code.
* @throws IOException - Exception in I/O.
**/
- final synchronized void _requestWont(final int option)
+ final synchronized void requestWont(final int option)
throws IOException
{
- if (_willResponse[option] == 0 && _stateIsWont(option)
- || _requestedWont(option))
+ if (willResponse[option] == 0 && stateIsWont(option)
+ || requestedWont(option))
{
return ;
}
- _setWantWont(option);
- ++_doResponse[option];
- _sendWont(option);
+ setWantWont(option);
+ ++doResponse[option];
+ sendWont(option);
}
/**
@@ -1031,13 +1031,13 @@ class Telnet extends SocketClient
* @param b - byte to send
* @throws IOException - Exception in I/O.
**/
- final synchronized void _sendByte(final int b)
+ final synchronized void sendByte(final int b)
throws IOException
{
_output_.write(b);
/* Code Section added for supporting spystreams (start)*/
- _spyWrite(b);
+ spyWrite(b);
/* Code Section added for supporting spystreams (end)*/
}
@@ -1102,12 +1102,12 @@ class Telnet extends SocketClient
{
if (opthand.getInitLocal())
{
- _requestWill(optcode);
+ requestWill(optcode);
}
if (opthand.getInitRemote())
{
- _requestDo(optcode);
+ requestDo(optcode);
}
}
}
@@ -1146,12 +1146,12 @@ class Telnet extends SocketClient
if (opthand.getWill())
{
- _requestWont(optcode);
+ requestWont(optcode);
}
if (opthand.getDo())
{
- _requestDont(optcode);
+ requestDont(optcode);
}
}
else
@@ -1189,7 +1189,7 @@ class Telnet extends SocketClient
*
* @param ch - character read from the session
***/
- void _spyRead(final int ch)
+ void spyRead(final int ch)
{
final OutputStream spy = spyStream;
if (spy != null)
@@ -1218,10 +1218,10 @@ class Telnet extends SocketClient
*
* @param ch - character written to the session
***/
- void _spyWrite(final int ch)
+ void spyWrite(final int ch)
{
- if (!(_stateIsDo(TelnetOption.ECHO)
- && _requestedDo(TelnetOption.ECHO)))
+ if (!(stateIsDo(TelnetOption.ECHO)
+ && requestedDo(TelnetOption.ECHO)))
{
final OutputStream spy = spyStream;
if (spy != null)
@@ -1248,7 +1248,7 @@ class Telnet extends SocketClient
***/
public void registerNotifHandler(final TelnetNotificationHandler notifhand)
{
- __notifhand = notifhand;
+ this.notifhand = notifhand;
}
/***
@@ -1257,6 +1257,6 @@ class Telnet extends SocketClient
***/
public void unregisterNotifHandler()
{
- __notifhand = null;
+ this.notifhand = null;
}
}
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetClient.java b/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
index e5e03b6..a889eac 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetClient.java
@@ -45,9 +45,9 @@ public class TelnetClient extends Telnet
{
private static final int DEFAULT_MAX_SUBNEGOTIATION_LENGTH = 512;
- final int _maxSubnegotiationLength;
- private InputStream __input;
- private OutputStream __output;
+ final int maxSubnegotiationLength;
+ private InputStream input;
+ private OutputStream output;
protected boolean readerThread = true;
private TelnetInputListener inputListener;
@@ -93,19 +93,19 @@ public class TelnetClient extends Telnet
/* TERMINAL-TYPE option (start)*/
super(termtype);
/* TERMINAL-TYPE option (end)*/
- __input = null;
- __output = null;
- _maxSubnegotiationLength = maxSubnegotiationLength;
+ this.input = null;
+ this.output = null;
+ this.maxSubnegotiationLength = maxSubnegotiationLength;
}
- void _flushOutputStream() throws IOException
+ void flushOutputStream() throws IOException
{
if (_output_ == null) {
throw new IOException("Stream closed");
}
_output_.flush();
}
- void _closeOutputStream() throws IOException
+ void closeOutputStream() throws IOException
{
if (_output_ == null) {
return;
@@ -137,8 +137,8 @@ public class TelnetClient extends Telnet
// This blocking behavior requires further investigation, but right
// now it looks like classes like InputStreamReader are not implemented
// in a safe manner.
- __input = new BufferedInputStream(tmp);
- __output = new TelnetOutputStream(this);
+ input = new BufferedInputStream(tmp);
+ output = new TelnetOutputStream(this);
}
/***
@@ -152,15 +152,15 @@ public class TelnetClient extends Telnet
public void disconnect() throws IOException
{
try {
- if (__input != null) {
- __input.close();
+ if (input != null) {
+ input.close();
}
- if (__output != null) {
- __output.close();
+ if (output != null) {
+ output.close();
}
} finally { // NET-594
- __output = null;
- __input = null;
+ output = null;
+ input = null;
super.disconnect();
}
}
@@ -174,7 +174,7 @@ public class TelnetClient extends Telnet
***/
public OutputStream getOutputStream()
{
- return __output;
+ return output;
}
/***
@@ -186,7 +186,7 @@ public class TelnetClient extends Telnet
***/
public InputStream getInputStream()
{
- return __input;
+ return input;
}
/***
@@ -199,7 +199,7 @@ public class TelnetClient extends Telnet
public boolean getLocalOptionState(final int option)
{
/* BUG (option active when not already acknowledged) (start)*/
- return _stateIsWill(option) && _requestedWill(option);
+ return stateIsWill(option) && requestedWill(option);
/* BUG (option active when not already acknowledged) (end)*/
}
@@ -213,7 +213,7 @@ public class TelnetClient extends Telnet
public boolean getRemoteOptionState(final int option)
{
/* BUG (option active when not already acknowledged) (start)*/
- return _stateIsDo(option) && _requestedDo(option);
+ return stateIsDo(option) && requestedDo(option);
/* BUG (option active when not already acknowledged) (end)*/
}
/* open TelnetOptionHandler functionality (end)*/
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
index c5047c7..2e7ef38 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetInputStream.java
@@ -31,48 +31,48 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
private static final int WOULD_BLOCK = -2;
// TODO should these be private enums?
- static final int _STATE_DATA = 0, _STATE_IAC = 1, _STATE_WILL = 2,
- _STATE_WONT = 3, _STATE_DO = 4, _STATE_DONT = 5,
- _STATE_SB = 6, _STATE_SE = 7, _STATE_CR = 8, _STATE_IAC_SB = 9;
-
- private boolean __hasReachedEOF; // @GuardedBy("__queue")
- private volatile boolean __isClosed;
- private boolean __readIsWaiting;
- private int __receiveState, __queueHead, __queueTail, __bytesAvailable;
- private final int[] __queue;
- private final TelnetClient __client;
- private final Thread __thread;
- private IOException __ioException;
+ static final int STATE_DATA = 0, STATE_IAC = 1, STATE_WILL = 2,
+ STATE_WONT = 3, STATE_DO = 4, STATE_DONT = 5,
+ STATE_SB = 6, STATE_SE = 7, STATE_CR = 8, STATE_IAC_SB = 9;
+
+ private boolean hasReachedEOF; // @GuardedBy("__queue")
+ private volatile boolean isClosed;
+ private boolean readIsWaiting;
+ private int receiveState, queueHead, queueTail, bytesAvailable;
+ private final int[] queue;
+ private final TelnetClient client;
+ private final Thread thread;
+ private IOException ioException;
/* TERMINAL-TYPE option (start)*/
- private final int __suboption[];
- private int __suboption_count = 0;
+ private final int suboption[];
+ private int suboptionCount = 0;
/* TERMINAL-TYPE option (end)*/
- private volatile boolean __threaded;
+ private volatile boolean threaded;
TelnetInputStream(final InputStream input, final TelnetClient client,
final boolean readerThread)
{
super(input);
- __client = client;
- __receiveState = _STATE_DATA;
- __isClosed = true;
- __hasReachedEOF = false;
+ this.client = client;
+ this.receiveState = STATE_DATA;
+ this.isClosed = true;
+ this.hasReachedEOF = false;
// Make it 2049, because when full, one slot will go unused, and we
// want a 2048 byte buffer just to have a round number (base 2 that is)
- __queue = new int[2049];
- __queueHead = 0;
- __queueTail = 0;
- __suboption = new int[client._maxSubnegotiationLength];
- __bytesAvailable = 0;
- __ioException = null;
- __readIsWaiting = false;
- __threaded = false;
+ this.queue = new int[2049];
+ this.queueHead = 0;
+ this.queueTail = 0;
+ this.suboption = new int[client.maxSubnegotiationLength];
+ this.bytesAvailable = 0;
+ this.ioException = null;
+ this.readIsWaiting = false;
+ this.threaded = false;
if(readerThread) {
- __thread = new Thread(this);
+ this.thread = new Thread(this);
} else {
- __thread = null;
+ this.thread = null;
}
}
@@ -82,12 +82,12 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
void _start()
{
- if(__thread == null) {
+ if(thread == null) {
return;
}
int priority;
- __isClosed = false;
+ isClosed = false;
// TODO remove this
// Need to set a higher priority in case JVM does not use pre-emptive
// threads. This should prevent scheduler induced deadlock (rather than
@@ -96,10 +96,10 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
if (priority > Thread.MAX_PRIORITY) {
priority = Thread.MAX_PRIORITY;
}
- __thread.setPriority(priority);
- __thread.setDaemon(true);
- __thread.start();
- __threaded = true; // tell _processChar that we are running threaded
+ thread.setPriority(priority);
+ thread.setDaemon(true);
+ thread.start();
+ threaded = true; // tell _processChar that we are running threaded
}
@@ -137,20 +137,20 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
ch = ch & 0xff;
/* Code Section added for supporting AYT (start)*/
- synchronized (__client)
+ synchronized (client)
{
- __client._processAYTResponse();
+ client.processAYTResponse();
}
/* Code Section added for supporting AYT (end)*/
/* Code Section added for supporting spystreams (start)*/
- __client._spyRead(ch);
+ client.spyRead(ch);
/* Code Section added for supporting spystreams (end)*/
- switch (__receiveState)
+ switch (receiveState)
{
- case _STATE_CR:
+ case STATE_CR:
if (ch == '\0')
{
// Strip null
@@ -162,130 +162,130 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
// Handle as normal data by falling through to _STATE_DATA case
//$FALL-THROUGH$
- case _STATE_DATA:
+ case STATE_DATA:
if (ch == TelnetCommand.IAC)
{
- __receiveState = _STATE_IAC;
+ receiveState = STATE_IAC;
continue;
}
if (ch == '\r')
{
- synchronized (__client)
+ synchronized (client)
{
- if (__client._requestedDont(TelnetOption.BINARY)) {
- __receiveState = _STATE_CR;
+ if (client.requestedDont(TelnetOption.BINARY)) {
+ receiveState = STATE_CR;
} else {
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
}
}
} else {
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
}
break;
- case _STATE_IAC:
+ case STATE_IAC:
switch (ch)
{
case TelnetCommand.WILL:
- __receiveState = _STATE_WILL;
+ receiveState = STATE_WILL;
continue;
case TelnetCommand.WONT:
- __receiveState = _STATE_WONT;
+ receiveState = STATE_WONT;
continue;
case TelnetCommand.DO:
- __receiveState = _STATE_DO;
+ receiveState = STATE_DO;
continue;
case TelnetCommand.DONT:
- __receiveState = _STATE_DONT;
+ receiveState = STATE_DONT;
continue;
/* TERMINAL-TYPE option (start)*/
case TelnetCommand.SB:
- __suboption_count = 0;
- __receiveState = _STATE_SB;
+ suboptionCount = 0;
+ receiveState = STATE_SB;
continue;
/* TERMINAL-TYPE option (end)*/
case TelnetCommand.IAC:
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
break; // exit to enclosing switch to return IAC from read
case TelnetCommand.SE: // unexpected byte! ignore it (don't send it as a command)
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
continue;
default:
- __receiveState = _STATE_DATA;
- __client._processCommand(ch); // Notify the user
+ receiveState = STATE_DATA;
+ client.processCommand(ch); // Notify the user
continue; // move on the next char
}
break; // exit and return from read
- case _STATE_WILL:
- synchronized (__client)
+ case STATE_WILL:
+ synchronized (client)
{
- __client._processWill(ch);
- __client._flushOutputStream();
+ client.processWill(ch);
+ client.flushOutputStream();
}
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
continue;
- case _STATE_WONT:
- synchronized (__client)
+ case STATE_WONT:
+ synchronized (client)
{
- __client._processWont(ch);
- __client._flushOutputStream();
+ client.processWont(ch);
+ client.flushOutputStream();
}
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
continue;
- case _STATE_DO:
- synchronized (__client)
+ case STATE_DO:
+ synchronized (client)
{
- __client._processDo(ch);
- __client._flushOutputStream();
+ client.processDo(ch);
+ client.flushOutputStream();
}
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
continue;
- case _STATE_DONT:
- synchronized (__client)
+ case STATE_DONT:
+ synchronized (client)
{
- __client._processDont(ch);
- __client._flushOutputStream();
+ client.processDont(ch);
+ client.flushOutputStream();
}
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
continue;
/* TERMINAL-TYPE option (start)*/
- case _STATE_SB:
+ case STATE_SB:
switch (ch)
{
case TelnetCommand.IAC:
- __receiveState = _STATE_IAC_SB;
+ receiveState = STATE_IAC_SB;
continue;
default:
// store suboption char
- if (__suboption_count < __suboption.length) {
- __suboption[__suboption_count++] = ch;
+ if (suboptionCount < suboption.length) {
+ suboption[suboptionCount++] = ch;
}
break;
}
- __receiveState = _STATE_SB;
+ receiveState = STATE_SB;
continue;
- case _STATE_IAC_SB: // IAC received during SB phase
+ case STATE_IAC_SB: // IAC received during SB phase
switch (ch)
{
case TelnetCommand.SE:
- synchronized (__client)
+ synchronized (client)
{
- __client._processSuboption(__suboption, __suboption_count);
- __client._flushOutputStream();
+ client.processSuboption(suboption, suboptionCount);
+ client.flushOutputStream();
}
- __receiveState = _STATE_DATA;
+ receiveState = STATE_DATA;
continue;
case TelnetCommand.IAC: // De-dup the duplicated IAC
- if (__suboption_count < __suboption.length) {
- __suboption[__suboption_count++] = ch;
+ if (suboptionCount < suboption.length) {
+ suboption[suboptionCount++] = ch;
}
break;
default: // unexpected byte! ignore it
break;
}
- __receiveState = _STATE_SB;
+ receiveState = STATE_SB;
continue;
/* TERMINAL-TYPE option (end)*/
}
@@ -300,24 +300,24 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
// TelnetOutputStream writing through the telnet client at same time
// as a processDo/Will/etc. command invoked from TelnetInputStream
// tries to write. Returns true if buffer was previously empty.
- private boolean __processChar(final int ch) throws InterruptedException
+ private boolean processChar(final int ch) throws InterruptedException
{
// Critical section because we're altering __bytesAvailable,
// __queueTail, and the contents of _queue.
boolean bufferWasEmpty;
- synchronized (__queue)
+ synchronized (queue)
{
- bufferWasEmpty = __bytesAvailable == 0;
- while (__bytesAvailable >= __queue.length - 1)
+ bufferWasEmpty = bytesAvailable == 0;
+ while (bytesAvailable >= queue.length - 1)
{
// The queue is full. We need to wait before adding any more data to it. Hopefully the stream owner
// will consume some data soon!
- if(__threaded)
+ if(threaded)
{
- __queue.notify();
+ queue.notify();
try
{
- __queue.wait();
+ queue.wait();
}
catch (final InterruptedException e)
{
@@ -333,16 +333,16 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
}
// Need to do this in case we're not full, but block on a read
- if (__readIsWaiting && __threaded)
+ if (readIsWaiting && threaded)
{
- __queue.notify();
+ queue.notify();
}
- __queue[__queueTail] = ch;
- ++__bytesAvailable;
+ queue[queueTail] = ch;
+ ++bytesAvailable;
- if (++__queueTail >= __queue.length) {
- __queueTail = 0;
+ if (++queueTail >= queue.length) {
+ queueTail = 0;
}
}
return bufferWasEmpty;
@@ -354,35 +354,35 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
// Critical section because we're altering __bytesAvailable,
// __queueHead, and the contents of _queue in addition to
// testing value of __hasReachedEOF.
- synchronized (__queue)
+ synchronized (queue)
{
while (true)
{
- if (__ioException != null)
+ if (ioException != null)
{
IOException e;
- e = __ioException;
- __ioException = null;
+ e = ioException;
+ ioException = null;
throw e;
}
- if (__bytesAvailable == 0)
+ if (bytesAvailable == 0)
{
// Return EOF if at end of file
- if (__hasReachedEOF) {
+ if (hasReachedEOF) {
return EOF;
}
// Otherwise, we have to wait for queue to get something
- if(__threaded)
+ if(threaded)
{
- __queue.notify();
+ queue.notify();
try
{
- __readIsWaiting = true;
- __queue.wait();
- __readIsWaiting = false;
+ readIsWaiting = true;
+ queue.wait();
+ readIsWaiting = false;
}
catch (final InterruptedException e)
{
@@ -392,7 +392,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
else
{
//__alreadyread = false;
- __readIsWaiting = true;
+ readIsWaiting = true;
int ch;
boolean mayBlock = true; // block on the first read only
@@ -408,13 +408,13 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
}
catch (final InterruptedIOException e)
{
- synchronized (__queue)
+ synchronized (queue)
{
- __ioException = e;
- __queue.notifyAll();
+ ioException = e;
+ queue.notifyAll();
try
{
- __queue.wait(100);
+ queue.wait(100);
}
catch (final InterruptedException interrupted)
{
@@ -429,12 +429,12 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
{
if(ch != WOULD_BLOCK)
{
- __processChar(ch);
+ processChar(ch);
}
}
catch (final InterruptedException e)
{
- if (__isClosed) {
+ if (isClosed) {
return EOF;
}
}
@@ -445,25 +445,25 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
}
// Continue reading as long as there is data available and the queue is not full.
- while (super.available() > 0 && __bytesAvailable < __queue.length - 1);
+ while (super.available() > 0 && bytesAvailable < queue.length - 1);
- __readIsWaiting = false;
+ readIsWaiting = false;
}
continue;
}
int ch;
- ch = __queue[__queueHead];
+ ch = queue[queueHead];
- if (++__queueHead >= __queue.length) {
- __queueHead = 0;
+ if (++queueHead >= queue.length) {
+ queueHead = 0;
}
- --__bytesAvailable;
+ --bytesAvailable;
// Need to explicitly notify() so available() works properly
- if(__bytesAvailable == 0 && __threaded) {
- __queue.notify();
+ if(bytesAvailable == 0 && threaded) {
+ queue.notify();
}
return ch;
@@ -514,10 +514,10 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
}
// Critical section because run() may change __bytesAvailable
- synchronized (__queue)
+ synchronized (queue)
{
- if (length > __bytesAvailable) {
- length = __bytesAvailable;
+ if (length > bytesAvailable) {
+ length = bytesAvailable;
}
}
@@ -549,12 +549,12 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
public int available() throws IOException
{
// Critical section because run() may change __bytesAvailable
- synchronized (__queue)
+ synchronized (queue)
{
- if (__threaded) { // Must not call super.available when running threaded: NET-466
- return __bytesAvailable;
+ if (threaded) { // Must not call super.available when running threaded: NET-466
+ return bytesAvailable;
}
- return __bytesAvailable + super.available();
+ return bytesAvailable + super.available();
}
}
@@ -570,17 +570,17 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
// interrupt a system read() from the interrupt() method.
super.close();
- synchronized (__queue)
+ synchronized (queue)
{
- __hasReachedEOF = true;
- __isClosed = true;
+ hasReachedEOF = true;
+ isClosed = true;
- if (__thread != null && __thread.isAlive())
+ if (thread != null && thread.isAlive())
{
- __thread.interrupt();
+ thread.interrupt();
}
- __queue.notifyAll();
+ queue.notifyAll();
}
}
@@ -593,7 +593,7 @@ final class TelnetInputStream extends BufferedInputStream implements Runnable
try
{
_outerLoop:
- while (!__isClosed)
+ while (!isClosed)
{
try
{
@@ -603,17 +603,17 @@ _outerLoop:
}
catch (final InterruptedIOException e)
{
- synchronized (__queue)
+ synchronized (queue)
{
- __ioException = e;
- __queue.notifyAll();
+ ioException = e;
+ queue.notifyAll();
try
{
- __queue.wait(100);
+ queue.wait(100);
}
catch (final InterruptedException interrupted)
{
- if (__isClosed) {
+ if (isClosed) {
break _outerLoop;
}
}
@@ -633,38 +633,38 @@ _outerLoop:
boolean notify = false;
try
{
- notify = __processChar(ch);
+ notify = processChar(ch);
}
catch (final InterruptedException e)
{
- if (__isClosed) {
+ if (isClosed) {
break _outerLoop;
}
}
// Notify input listener if buffer was previously empty
if (notify) {
- __client.notifyInputListener();
+ client.notifyInputListener();
}
}
}
catch (final IOException ioe)
{
- synchronized (__queue)
+ synchronized (queue)
{
- __ioException = ioe;
+ ioException = ioe;
}
- __client.notifyInputListener();
+ client.notifyInputListener();
}
- synchronized (__queue)
+ synchronized (queue)
{
- __isClosed = true; // Possibly redundant
- __hasReachedEOF = true;
- __queue.notify();
+ isClosed = true; // Possibly redundant
+ hasReachedEOF = true;
+ queue.notify();
}
- __threaded = false;
+ threaded = false;
}
}
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetOption.java b/src/main/java/org/apache/commons/net/telnet/TelnetOption.java
index aa96331..b087506 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetOption.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetOption.java
@@ -116,10 +116,10 @@ public class TelnetOption
public static final int EXTENDED_OPTIONS_LIST = 255;
@SuppressWarnings("unused")
- private static final int __FIRST_OPTION = BINARY;
- private static final int __LAST_OPTION = EXTENDED_OPTIONS_LIST;
+ private static final int FIRST_OPTION = BINARY;
+ private static final int LAST_OPTION = EXTENDED_OPTIONS_LIST;
- private static final String __optionString[] = {
+ private static final String optionString[] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", "STATUS",
"TIMING MARK", "RCTE", "NAOL", "NAOP", "NAOCRD", "NAOHTS", "NAOHTD",
"NAOFFD", "NAOVTS", "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT",
@@ -164,11 +164,11 @@ public class TelnetOption
***/
public static final String getOption(final int code)
{
- if(__optionString[code].length() == 0)
+ if(optionString[code].length() == 0)
{
return "UNASSIGNED";
}
- return __optionString[code];
+ return optionString[code];
}
@@ -181,7 +181,7 @@ public class TelnetOption
**/
public static final boolean isValidOption(final int code)
{
- return code <= __LAST_OPTION;
+ return code <= LAST_OPTION;
}
// Cannot be instantiated
diff --git a/src/main/java/org/apache/commons/net/telnet/TelnetOutputStream.java b/src/main/java/org/apache/commons/net/telnet/TelnetOutputStream.java
index 5017bf5..8222b27 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetOutputStream.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetOutputStream.java
@@ -34,14 +34,14 @@ import java.io.OutputStream;
final class TelnetOutputStream extends OutputStream
{
- private final TelnetClient __client;
+ private final TelnetClient client;
// TODO there does not appear to be any way to change this value - should it be a ctor parameter?
- private final boolean __convertCRtoCRLF = true;
- private boolean __lastWasCR = false;
+ private final boolean convertCRtoCRLF = true;
+ private boolean lastWasCR = false;
TelnetOutputStream(final TelnetClient client)
{
- __client = client;
+ this.client = client;
}
@@ -56,59 +56,59 @@ final class TelnetOutputStream extends OutputStream
public void write(int ch) throws IOException
{
- synchronized (__client)
+ synchronized (client)
{
ch &= 0xff;
- if (__client._requestedWont(TelnetOption.BINARY)) // i.e. ASCII
+ if (client.requestedWont(TelnetOption.BINARY)) // i.e. ASCII
{
- if (__lastWasCR)
+ if (lastWasCR)
{
- if (__convertCRtoCRLF)
+ if (convertCRtoCRLF)
{
- __client._sendByte('\n');
+ client.sendByte('\n');
if (ch == '\n') // i.e. was CRLF anyway
{
- __lastWasCR = false;
+ lastWasCR = false;
return ;
}
} // __convertCRtoCRLF
else if (ch != '\n')
{
- __client._sendByte('\0'); // RFC854 requires CR NUL for bare CR
+ client.sendByte('\0'); // RFC854 requires CR NUL for bare CR
}
}
switch (ch)
{
case '\r':
- __client._sendByte('\r');
- __lastWasCR = true;
+ client.sendByte('\r');
+ lastWasCR = true;
break;
case '\n':
- if (!__lastWasCR) { // convert LF to CRLF
- __client._sendByte('\r');
+ if (!lastWasCR) { // convert LF to CRLF
+ client.sendByte('\r');
}
- __client._sendByte(ch);
- __lastWasCR = false;
+ client.sendByte(ch);
+ lastWasCR = false;
break;
case TelnetCommand.IAC:
- __client._sendByte(TelnetCommand.IAC);
- __client._sendByte(TelnetCommand.IAC);
- __lastWasCR = false;
+ client.sendByte(TelnetCommand.IAC);
+ client.sendByte(TelnetCommand.IAC);
+ lastWasCR = false;
break;
default:
- __client._sendByte(ch);
- __lastWasCR = false;
+ client.sendByte(ch);
+ lastWasCR = false;
break;
}
} // end ASCII
else if (ch == TelnetCommand.IAC)
{
- __client._sendByte(ch);
- __client._sendByte(TelnetCommand.IAC);
+ client.sendByte(ch);
+ client.sendByte(TelnetCommand.IAC);
} else {
- __client._sendByte(ch);
+ client.sendByte(ch);
}
}
}
@@ -141,7 +141,7 @@ final class TelnetOutputStream extends OutputStream
@Override
public void write(final byte buffer[], int offset, int length) throws IOException
{
- synchronized (__client)
+ synchronized (client)
{
while (length-- > 0) {
write(buffer[offset++]);
@@ -153,13 +153,13 @@ final class TelnetOutputStream extends OutputStream
@Override
public void flush() throws IOException
{
- __client._flushOutputStream();
+ client.flushOutputStream();
}
/*** Closes the stream. ***/
@Override
public void close() throws IOException
{
- __client._closeOutputStream();
+ client.closeOutputStream();
}
}
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTP.java b/src/main/java/org/apache/commons/net/tftp/TFTP.java
index d8ef8d0..ac7c205 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTP.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTP.java
@@ -90,13 +90,13 @@ public class TFTP extends DatagramSocketClient
static final int PACKET_SIZE = TFTPPacket.SEGMENT_SIZE + 4;
/*** A buffer used to accelerate receives in bufferedReceive() ***/
- private byte[] __receiveBuffer;
+ private byte[] receiveBuffer;
/*** A datagram used to minimize memory allocation in bufferedReceive() ***/
- private DatagramPacket __receiveDatagram;
+ private DatagramPacket receiveDatagram;
/*** A datagram used to minimize memory allocation in bufferedSend() ***/
- private DatagramPacket __sendDatagram;
+ private DatagramPacket sendDatagram;
/***
* A buffer used to accelerate sends in bufferedSend().
@@ -104,7 +104,7 @@ public class TFTP extends DatagramSocketClient
* efficient during file sends. It saves the creation of an
* additional buffer and prevents a buffer copy in _newDataPcket().
***/
- byte[] _sendBuffer;
+ byte[] sendBuffer;
/***
@@ -127,8 +127,8 @@ public class TFTP extends DatagramSocketClient
public TFTP()
{
setDefaultTimeout(DEFAULT_TIMEOUT);
- __receiveBuffer = null;
- __receiveDatagram = null;
+ receiveBuffer = null;
+ receiveDatagram = null;
}
/***
@@ -197,11 +197,11 @@ public class TFTP extends DatagramSocketClient
public final TFTPPacket bufferedReceive() throws IOException,
InterruptedIOException, SocketException, TFTPPacketException
{
- __receiveDatagram.setData(__receiveBuffer);
- __receiveDatagram.setLength(__receiveBuffer.length);
- _socket_.receive(__receiveDatagram);
+ receiveDatagram.setData(receiveBuffer);
+ receiveDatagram.setLength(receiveBuffer.length);
+ _socket_.receive(receiveDatagram);
- final TFTPPacket newTFTPPacket = TFTPPacket.newTFTPPacket(__receiveDatagram);
+ final TFTPPacket newTFTPPacket = TFTPPacket.newTFTPPacket(receiveDatagram);
trace("<", newTFTPPacket);
return newTFTPPacket;
}
@@ -227,7 +227,7 @@ public class TFTP extends DatagramSocketClient
public final void bufferedSend(final TFTPPacket packet) throws IOException
{
trace(">", packet);
- _socket_.send(packet._newDatagram(__sendDatagram, _sendBuffer));
+ _socket_.send(packet._newDatagram(sendDatagram, sendBuffer));
}
@@ -241,12 +241,12 @@ public class TFTP extends DatagramSocketClient
***/
public final void beginBufferedOps()
{
- __receiveBuffer = new byte[PACKET_SIZE];
- __receiveDatagram =
- new DatagramPacket(__receiveBuffer, __receiveBuffer.length);
- _sendBuffer = new byte[PACKET_SIZE];
- __sendDatagram =
- new DatagramPacket(_sendBuffer, _sendBuffer.length);
+ receiveBuffer = new byte[PACKET_SIZE];
+ receiveDatagram =
+ new DatagramPacket(receiveBuffer, receiveBuffer.length);
+ sendBuffer = new byte[PACKET_SIZE];
+ sendDatagram =
+ new DatagramPacket(sendBuffer, sendBuffer.length);
}
/***
@@ -254,10 +254,10 @@ public class TFTP extends DatagramSocketClient
***/
public final void endBufferedOps()
{
- __receiveBuffer = null;
- __receiveDatagram = null;
- _sendBuffer = null;
- __sendDatagram = null;
+ receiveBuffer = null;
+ receiveDatagram = null;
+ sendBuffer = null;
+ sendDatagram = null;
}
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPAckPacket.java b/src/main/java/org/apache/commons/net/tftp/TFTPAckPacket.java
index f84f179..f680647 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPAckPacket.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPAckPacket.java
@@ -99,7 +99,7 @@ public final class TFTPAckPacket extends TFTPPacket
DatagramPacket _newDatagram(final DatagramPacket datagram, final byte[] data)
{
data[0] = 0;
- data[1] = (byte)_type;
+ data[1] = (byte)type;
data[2] = (byte)((_blockNumber & 0xffff) >> 8);
data[3] = (byte)(_blockNumber & 0xff);
@@ -130,7 +130,7 @@ public final class TFTPAckPacket extends TFTPPacket
data = new byte[4];
data[0] = 0;
- data[1] = (byte)_type;
+ data[1] = (byte)type;
data[2] = (byte)((_blockNumber & 0xffff) >> 8);
data[3] = (byte)(_blockNumber & 0xff);
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPClient.java b/src/main/java/org/apache/commons/net/tftp/TFTPClient.java
index ba58c59..3d16ac0 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPClient.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPClient.java
@@ -365,7 +365,7 @@ public class TFTPClient extends TFTP
}
TFTPPacket sent = new TFTPWriteRequestPacket(host, port, fileName, mode);
- final TFTPDataPacket data = new TFTPDataPacket(host, port, 0, _sendBuffer, 4, 0);
+ final TFTPDataPacket data = new TFTPDataPacket(host, port, 0, sendBuffer, 4, 0);
beginBufferedOps();
@@ -457,7 +457,7 @@ public class TFTPClient extends TFTP
int totalThisPacket = 0;
int bytesRead = 0;
while (dataLength > 0 &&
- (bytesRead = input.read(_sendBuffer, offset, dataLength)) > 0) {
+ (bytesRead = input.read(sendBuffer, offset, dataLength)) > 0) {
offset += bytesRead;
dataLength -= bytesRead;
totalThisPacket += bytesRead;
@@ -467,7 +467,7 @@ public class TFTPClient extends TFTP
lastAckWait = true;
}
data.setBlockNumber(block);
- data.setData(_sendBuffer, 4, totalThisPacket);
+ data.setData(sendBuffer, 4, totalThisPacket);
sent = data;
totalBytesSent += totalThisPacket;
} while (true); // loops until after lastAckWait is set
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPDataPacket.java b/src/main/java/org/apache/commons/net/tftp/TFTPDataPacket.java
index 1c61416..fe9b5a2 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPDataPacket.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPDataPacket.java
@@ -50,16 +50,16 @@ public final class TFTPDataPacket extends TFTPPacket
public static final int MIN_DATA_LENGTH = 0;
/*** The block number of the packet. ***/
- int _blockNumber;
+ int blockNumber;
/*** The length of the data. ***/
- int _length;
+ int length;
/*** The offset into the _data array at which the data begins. ***/
- int _offset;
+ int offset;
/*** The data stored in the packet. ***/
- byte[] _data;
+ byte[] data;
/***
* Creates a data packet to be sent to a host at a given port
@@ -81,14 +81,14 @@ public final class TFTPDataPacket extends TFTPPacket
{
super(TFTPPacket.DATA, destination, port);
- _blockNumber = blockNumber;
- _data = data;
- _offset = offset;
+ this.blockNumber = blockNumber;
+ this.data = data;
+ this.offset = offset;
if (length > MAX_DATA_LENGTH) {
- _length = MAX_DATA_LENGTH;
+ this.length = MAX_DATA_LENGTH;
} else {
- _length = length;
+ this.length = length;
}
}
@@ -112,19 +112,19 @@ public final class TFTPDataPacket extends TFTPPacket
{
super(TFTPPacket.DATA, datagram.getAddress(), datagram.getPort());
- _data = datagram.getData();
- _offset = 4;
+ this.data = datagram.getData();
+ this.offset = 4;
- if (getType() != _data[1]) {
+ if (getType() != this.data[1]) {
throw new TFTPPacketException("TFTP operator code does not match type.");
}
- _blockNumber = (((_data[2] & 0xff) << 8) | (_data[3] & 0xff));
+ this.blockNumber = (((this.data[2] & 0xff) << 8) | (this.data[3] & 0xff));
- _length = datagram.getLength() - 4;
+ this.length = datagram.getLength() - 4;
- if (_length > MAX_DATA_LENGTH) {
- _length = MAX_DATA_LENGTH;
+ if (this.length > MAX_DATA_LENGTH) {
+ this.length = MAX_DATA_LENGTH;
}
}
@@ -143,19 +143,19 @@ public final class TFTPDataPacket extends TFTPPacket
DatagramPacket _newDatagram(final DatagramPacket datagram, final byte[] data)
{
data[0] = 0;
- data[1] = (byte)_type;
- data[2] = (byte)((_blockNumber & 0xffff) >> 8);
- data[3] = (byte)(_blockNumber & 0xff);
+ data[1] = (byte)type;
+ data[2] = (byte)((blockNumber & 0xffff) >> 8);
+ data[3] = (byte)(blockNumber & 0xff);
// Doublecheck we're not the same
- if (data != _data) {
- System.arraycopy(_data, _offset, data, 4, _length);
+ if (data != this.data) {
+ System.arraycopy(this.data, offset, data, 4, length);
}
datagram.setAddress(_address);
datagram.setPort(_port);
datagram.setData(data);
- datagram.setLength(_length + 4);
+ datagram.setLength(length + 4);
return datagram;
}
@@ -177,15 +177,15 @@ public final class TFTPDataPacket extends TFTPPacket
{
byte[] data;
- data = new byte[_length + 4];
+ data = new byte[length + 4];
data[0] = 0;
- data[1] = (byte)_type;
- data[2] = (byte)((_blockNumber & 0xffff) >> 8);
- data[3] = (byte)(_blockNumber & 0xff);
+ data[1] = (byte)type;
+ data[2] = (byte)((blockNumber & 0xffff) >> 8);
+ data[3] = (byte)(blockNumber & 0xff);
- System.arraycopy(_data, _offset, data, 4, _length);
+ System.arraycopy(this.data, offset, data, 4, length);
- return new DatagramPacket(data, _length + 4, _address, _port);
+ return new DatagramPacket(data, length + 4, _address, _port);
}
/***
@@ -195,7 +195,7 @@ public final class TFTPDataPacket extends TFTPPacket
***/
public int getBlockNumber()
{
- return _blockNumber;
+ return blockNumber;
}
/*** Sets the block number of the data packet.
@@ -203,7 +203,7 @@ public final class TFTPDataPacket extends TFTPPacket
***/
public void setBlockNumber(final int blockNumber)
{
- _blockNumber = blockNumber;
+ this.blockNumber = blockNumber;
}
/***
@@ -215,14 +215,14 @@ public final class TFTPDataPacket extends TFTPPacket
***/
public void setData(final byte[] data, final int offset, final int length)
{
- _data = data;
- _offset = offset;
- _length = length;
+ this.data = data;
+ this.offset = offset;
+ this.length = length;
if (length > MAX_DATA_LENGTH) {
- _length = MAX_DATA_LENGTH;
+ this.length = MAX_DATA_LENGTH;
} else {
- _length = length;
+ this.length = length;
}
}
@@ -233,7 +233,7 @@ public final class TFTPDataPacket extends TFTPPacket
***/
public int getDataLength()
{
- return _length;
+ return length;
}
/***
@@ -245,7 +245,7 @@ public final class TFTPDataPacket extends TFTPPacket
***/
public int getDataOffset()
{
- return _offset;
+ return offset;
}
/***
@@ -255,7 +255,7 @@ public final class TFTPDataPacket extends TFTPPacket
***/
public byte[] getData()
{
- return _data;
+ return data;
}
/**
@@ -264,6 +264,6 @@ public final class TFTPDataPacket extends TFTPPacket
*/
@Override
public String toString() {
- return super.toString() + " DATA " + _blockNumber + " " + _length;
+ return super.toString() + " DATA " + blockNumber + " " + length;
}
}
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPErrorPacket.java b/src/main/java/org/apache/commons/net/tftp/TFTPErrorPacket.java
index a11f1db..7d71c9f 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPErrorPacket.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPErrorPacket.java
@@ -70,10 +70,10 @@ public final class TFTPErrorPacket extends TFTPPacket
public static final int NO_SUCH_USER = 7;
/*** The error code of this packet. ***/
- int _error;
+ int error;
/*** The error message of this packet. ***/
- String _message;
+ String message;
/***
* Creates an error packet to be sent to a host at a given port
@@ -89,8 +89,8 @@ public final class TFTPErrorPacket extends TFTPPacket
{
super(TFTPPacket.ERROR, destination, port);
- _error = error;
- _message = message;
+ this.error = error;
+ this.message = message;
}
/***
@@ -116,7 +116,7 @@ public final class TFTPErrorPacket extends TFTPPacket
throw new TFTPPacketException("TFTP operator code does not match type.");
}
- _error = (data[2] & 0xff) << 8 | data[3] & 0xff;
+ error = (data[2] & 0xff) << 8 | data[3] & 0xff;
if (length < 5) {
throw new TFTPPacketException("Bad error packet. No message.");
@@ -131,7 +131,7 @@ public final class TFTPErrorPacket extends TFTPPacket
++index;
}
- _message = buffer.toString();
+ message = buffer.toString();
}
/***
@@ -150,14 +150,14 @@ public final class TFTPErrorPacket extends TFTPPacket
{
int length;
- length = _message.length();
+ length = message.length();
data[0] = 0;
- data[1] = (byte)_type;
- data[2] = (byte)((_error & 0xffff) >> 8);
- data[3] = (byte)(_error & 0xff);
+ data[1] = (byte)type;
+ data[2] = (byte)((error & 0xffff) >> 8);
+ data[3] = (byte)(error & 0xff);
- System.arraycopy(_message.getBytes(), 0, data, 4, length);
+ System.arraycopy(message.getBytes(), 0, data, 4, length);
data[length + 4] = 0;
@@ -188,15 +188,15 @@ public final class TFTPErrorPacket extends TFTPPacket
byte[] data;
int length;
- length = _message.length();
+ length = message.length();
data = new byte[length + 5];
data[0] = 0;
- data[1] = (byte)_type;
- data[2] = (byte)((_error & 0xffff) >> 8);
- data[3] = (byte)(_error & 0xff);
+ data[1] = (byte)type;
+ data[2] = (byte)((error & 0xffff) >> 8);
+ data[3] = (byte)(error & 0xff);
- System.arraycopy(_message.getBytes(), 0, data, 4, length);
+ System.arraycopy(message.getBytes(), 0, data, 4, length);
data[length + 4] = 0;
@@ -211,7 +211,7 @@ public final class TFTPErrorPacket extends TFTPPacket
***/
public int getError()
{
- return _error;
+ return error;
}
@@ -222,7 +222,7 @@ public final class TFTPErrorPacket extends TFTPPacket
***/
public String getMessage()
{
- return _message;
+ return message;
}
/**
@@ -231,6 +231,6 @@ public final class TFTPErrorPacket extends TFTPPacket
*/
@Override
public String toString() {
- return super.toString() + " ERR " + _error + " " + _message;
+ return super.toString() + " ERR " + error + " " + message;
}
}
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPPacket.java b/src/main/java/org/apache/commons/net/tftp/TFTPPacket.java
index 9e9201e..623eb9f 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPPacket.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPPacket.java
@@ -101,7 +101,7 @@ public abstract class TFTPPacket
public static final int SEGMENT_SIZE = 512;
/*** The type of packet. ***/
- int _type;
+ int type;
/*** The port the packet came from or is going to. ***/
int _port;
@@ -169,9 +169,9 @@ public abstract class TFTPPacket
**/
TFTPPacket(final int type, final InetAddress address, final int port)
{
- _type = type;
- _address = address;
- _port = port;
+ this.type = type;
+ this._address = address;
+ this._port = port;
}
/***
@@ -208,7 +208,7 @@ public abstract class TFTPPacket
***/
public final int getType()
{
- return _type;
+ return type;
}
/***
@@ -256,6 +256,6 @@ public abstract class TFTPPacket
*/
@Override
public String toString() {
- return _address + " " + _port + " " + _type;
+ return _address + " " + _port + " " + type;
}
}
diff --git a/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java b/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java
index 871cfe8..8457eed 100644
--- a/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java
+++ b/src/main/java/org/apache/commons/net/tftp/TFTPRequestPacket.java
@@ -60,17 +60,17 @@ public abstract class TFTPRequestPacket extends TFTPPacket
* transfer mode constants. This is convenient for creating the TFTP
* request packets.
***/
- private static final byte[] _modeBytes[] = {
+ private static final byte[] modeBytes[] = {
{ (byte)'n', (byte)'e', (byte)'t', (byte)'a', (byte)'s', (byte)'c',
(byte)'i', (byte)'i', 0 },
{ (byte)'o', (byte)'c', (byte)'t', (byte)'e', (byte)'t', 0 }
};
/*** The transfer mode of the request. ***/
- private final int _mode;
+ private final int mode;
/*** The file name of the request. ***/
- private final String _fileName;
+ private final String fileName;
/***
* Creates a request packet of a given type to be sent to a host at a
@@ -89,8 +89,8 @@ public abstract class TFTPRequestPacket extends TFTPPacket
{
super(type, destination, port);
- _fileName = fileName;
- _mode = mode;
+ this.fileName = fileName;
+ this.mode = mode;
}
/***
@@ -126,7 +126,7 @@ public abstract class TFTPRequestPacket extends TFTPPacket
++index;
}
- _fileName = buffer.toString();
+ this.fileName = buffer.toString();
if (index >= length) {
throw new TFTPPacketException("Bad file name and mode format.");
@@ -153,7 +153,7 @@ public abstract class TFTPRequestPacket extends TFTPPacket
}
}
- _mode = mode;
+ this.mode = mode;
if (index >= length)
{
@@ -181,14 +181,14 @@ public abstract class TFTPRequestPacket extends TFTPPacket
{
int fileLength, modeLength;
- fileLength = _fileName.length();
- modeLength = _modeBytes[_mode].length;
+ fileLength = fileName.length();
+ modeLength = modeBytes[mode].length;
data[0] = 0;
- data[1] = (byte)_type;
- System.arraycopy(_fileName.getBytes(), 0, data, 2, fileLength);
+ data[1] = (byte)type;
+ System.arraycopy(fileName.getBytes(), 0, data, 2, fileLength);
data[fileLength + 2] = 0;
- System.arraycopy(_modeBytes[_mode], 0, data, fileLength + 3,
+ System.arraycopy(modeBytes[mode], 0, data, fileLength + 3,
modeLength);
datagram.setAddress(_address);
@@ -216,15 +216,15 @@ public abstract class TFTPRequestPacket extends TFTPPacket
int fileLength, modeLength;
byte[] data;
- fileLength = _fileName.length();
- modeLength = _modeBytes[_mode].length;
+ fileLength = fileName.length();
+ modeLength = modeBytes[mode].length;
data = new byte[fileLength + modeLength + 4];
data[0] = 0;
- data[1] = (byte)_type;
- System.arraycopy(_fileName.getBytes(), 0, data, 2, fileLength);
+ data[1] = (byte)type;
+ System.arraycopy(fileName.getBytes(), 0, data, 2, fileLength);
data[fileLength + 2] = 0;
- System.arraycopy(_modeBytes[_mode], 0, data, fileLength + 3,
+ System.arraycopy(modeBytes[mode], 0, data, fileLength + 3,
modeLength);
return new DatagramPacket(data, data.length, _address, _port);
@@ -237,7 +237,7 @@ public abstract class TFTPRequestPacket extends TFTPPacket
***/
public final int getMode()
{
- return _mode;
+ return mode;
}
/***
@@ -247,6 +247,6 @@ public abstract class TFTPRequestPacket extends TFTPPacket
***/
public final String getFilename()
{
- return _fileName;
+ return fileName;
}
}
diff --git a/src/main/java/org/apache/commons/net/time/TimeUDPClient.java b/src/main/java/org/apache/commons/net/time/TimeUDPClient.java
index 763e09b..c7e7f2c 100644
--- a/src/main/java/org/apache/commons/net/time/TimeUDPClient.java
+++ b/src/main/java/org/apache/commons/net/time/TimeUDPClient.java
@@ -55,8 +55,8 @@ public final class TimeUDPClient extends DatagramSocketClient
***/
public static final long SECONDS_1900_TO_1970 = 2208988800L;
- private final byte[] __dummyData = new byte[1];
- private final byte[] __timeData = new byte[4];
+ private final byte[] dummyData = new byte[1];
+ private final byte[] timeData = new byte[4];
/***
* Retrieves the time from the specified server and port and
@@ -77,17 +77,17 @@ public final class TimeUDPClient extends DatagramSocketClient
DatagramPacket sendPacket, receivePacket;
sendPacket =
- new DatagramPacket(__dummyData, __dummyData.length, host, port);
- receivePacket = new DatagramPacket(__timeData, __timeData.length);
+ new DatagramPacket(dummyData, dummyData.length, host, port);
+ receivePacket = new DatagramPacket(timeData, timeData.length);
_socket_.send(sendPacket);
_socket_.receive(receivePacket);
time = 0L;
- time |= (((__timeData[0] & 0xff) << 24) & 0xffffffffL);
- time |= (((__timeData[1] & 0xff) << 16) & 0xffffffffL);
- time |= (((__timeData[2] & 0xff) << 8) & 0xffffffffL);
- time |= ((__timeData[3] & 0xff) & 0xffffffffL);
+ time |= (((timeData[0] & 0xff) << 24) & 0xffffffffL);
+ time |= (((timeData[1] & 0xff) << 16) & 0xffffffffL);
+ time |= (((timeData[2] & 0xff) << 8) & 0xffffffffL);
+ time |= ((timeData[3] & 0xff) & 0xffffffffL);
return time;
}
diff --git a/src/main/java/org/apache/commons/net/util/ListenerList.java b/src/main/java/org/apache/commons/net/util/ListenerList.java
index 09c5af8..dcaa541 100644
--- a/src/main/java/org/apache/commons/net/util/ListenerList.java
+++ b/src/main/java/org/apache/commons/net/util/ListenerList.java
@@ -29,26 +29,26 @@ public class ListenerList implements Serializable, Iterable<EventListener>
{
private static final long serialVersionUID = -1934227607974228213L;
- private final CopyOnWriteArrayList<EventListener> __listeners;
+ private final CopyOnWriteArrayList<EventListener> listeners;
public ListenerList()
{
- __listeners = new CopyOnWriteArrayList<>();
+ listeners = new CopyOnWriteArrayList<>();
}
public void addListener(final EventListener listener)
{
- __listeners.add(listener);
+ listeners.add(listener);
}
public void removeListener(final EventListener listener)
{
- __listeners.remove(listener);
+ listeners.remove(listener);
}
public int getListenerCount()
{
- return __listeners.size();
+ return listeners.size();
}
/**
@@ -60,7 +60,7 @@ public class ListenerList implements Serializable, Iterable<EventListener>
*/
@Override
public Iterator<EventListener> iterator() {
- return __listeners.iterator();
+ return listeners.iterator();
}
}
diff --git a/src/test/java/org/apache/commons/net/ftp/FTPClientTest.java b/src/test/java/org/apache/commons/net/ftp/FTPClientTest.java
index 018e0ac..0d0b43c 100644
--- a/src/test/java/org/apache/commons/net/ftp/FTPClientTest.java
+++ b/src/test/java/org/apache/commons/net/ftp/FTPClientTest.java
@@ -62,24 +62,24 @@ public class FTPClientTest extends TestCase {
public void testParseClient() {
for(int i=0; i<TESTS.length; i+=2) {
- assertEquals("Failed to parse",TESTS[i+1], FTPClient.__parsePathname(TESTS[i]));
+ assertEquals("Failed to parse",TESTS[i+1], FTPClient.parsePathname(TESTS[i]));
}
}
public void testParserCachingWithKey() throws Exception {
final FTPClient client = new FTPClient();
assertNull(client.getEntryParser());
- client.__createParser(FTPClientConfig.SYST_UNIX);
+ client.createParser(FTPClientConfig.SYST_UNIX);
final FTPFileEntryParser entryParserSYST = client.getEntryParser();
assertNotNull(entryParserSYST);
- client.__createParser(FTPClientConfig.SYST_UNIX);
+ client.createParser(FTPClientConfig.SYST_UNIX);
assertSame(entryParserSYST, client.getEntryParser()); // the previous entry was cached
- client.__createParser(FTPClientConfig.SYST_VMS);
+ client.createParser(FTPClientConfig.SYST_VMS);
final FTPFileEntryParser entryParserVMS = client.getEntryParser();
assertNotSame(entryParserSYST, entryParserVMS); // the previous entry was replaced
- client.__createParser(FTPClientConfig.SYST_VMS);
+ client.createParser(FTPClientConfig.SYST_VMS);
assertSame(entryParserVMS, client.getEntryParser()); // the previous entry was cached
- client.__createParser(FTPClientConfig.SYST_UNIX); // revert
+ client.createParser(FTPClientConfig.SYST_UNIX); // revert
assertNotSame(entryParserVMS, client.getEntryParser()); // the previous entry was replaced
}
@@ -97,13 +97,13 @@ public class FTPClientTest extends TestCase {
final LocalClient client = new LocalClient();
client.setSystemType(FTPClientConfig.SYST_UNIX);
assertNull(client.getEntryParser());
- client.__createParser(null);
+ client.createParser(null);
final FTPFileEntryParser entryParser = client.getEntryParser();
assertNotNull(entryParser);
- client.__createParser(null);
+ client.createParser(null);
assertSame(entryParser, client.getEntryParser()); // parser was cached
client.setSystemType(FTPClientConfig.SYST_NT);
- client.__createParser(null);
+ client.createParser(null);
assertSame(entryParser, client.getEntryParser()); // parser was cached
}
public void testUnparseableFiles() throws Exception {
diff --git a/src/test/java/org/apache/commons/net/pop3/POP3ConstructorTest.java b/src/test/java/org/apache/commons/net/pop3/POP3ConstructorTest.java
index 6a2656f..726fa85 100644
--- a/src/test/java/org/apache/commons/net/pop3/POP3ConstructorTest.java
+++ b/src/test/java/org/apache/commons/net/pop3/POP3ConstructorTest.java
@@ -81,8 +81,8 @@ public class POP3ConstructorTest extends TestCase
assertEquals(110, pop.getDefaultPort());
assertEquals(POP3.DISCONNECTED_STATE, pop.getState());
- assertNull(pop._reader);
- assertNotNull(pop._replyLines);
+ assertNull(pop.reader);
+ assertNotNull(pop.replyLines);
}
public void testPOP3ClientStateTransition() throws Exception
@@ -92,8 +92,8 @@ public class POP3ConstructorTest extends TestCase
//Initial state
assertEquals(110, pop.getDefaultPort());
assertEquals(POP3.DISCONNECTED_STATE, pop.getState());
- assertNull(pop._reader);
- assertNotNull(pop._replyLines);
+ assertNull(pop.reader);
+ assertNotNull(pop.replyLines);
//Now connect
pop.connect(mailhost);
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServerMain.java b/src/test/java/org/apache/commons/net/tftp/TFTPServerMain.java
index 6947e33..b374b97 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServerMain.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServerMain.java
@@ -94,9 +94,9 @@ public class TFTPServerMain {
if (packet instanceof TFTPDataPacket) {
final TFTPDataPacket data = (TFTPDataPacket) packet;
System.out.println("Change data block num");
- data._blockNumber--;
+ data.blockNumber--;
super.sendData(tftp, packet);
- data._blockNumber++;
+ data.blockNumber++;
}
if (packet instanceof TFTPAckPacket) {
final TFTPAckPacket ack = (TFTPAckPacket) packet;