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 2025/03/01 00:02:18 UTC
(commons-net) 15/24: Add Checkstyle RightCurly
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 4fc48470c08d356a53ffe7bdf368594e8cac7912
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Feb 28 18:52:37 2025 -0500
Add Checkstyle RightCurly
---
src/conf/checkstyle.xml | 1 +
.../org/apache/commons/net/examples/ftp/FTPClientExample.java | 5 ++---
.../java/org/apache/commons/net/examples/unix/chargen.java | 11 +++++------
src/main/java/org/apache/commons/net/examples/unix/echo.java | 11 +++++------
.../net/ftp/parser/DefaultFTPFileEntryParserFactory.java | 5 ++---
.../org/apache/commons/net/ftp/parser/MLSxEntryParser.java | 4 ++--
src/main/java/org/apache/commons/net/nntp/Threader.java | 7 ++-----
.../org/apache/commons/net/telnet/TelnetOutputStream.java | 8 ++++----
8 files changed, 23 insertions(+), 29 deletions(-)
diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 7d95aa9d..b82d334d 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -87,6 +87,7 @@ limitations under the License.
<module name="NeedBraces"/>
<module name="ParenPad"/>
<module name="RedundantImport"/>
+ <module name="RightCurly" />
<module name="UnusedImports"/>
<module name="SuppressionCommentFilter"/>
<!--
diff --git a/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java b/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
index 67a27b1e..2fa697c6 100644
--- a/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
+++ b/src/main/java/org/apache/commons/net/examples/ftp/FTPClientExample.java
@@ -412,9 +412,8 @@ public final class FTPClientExample {
if (keepAliveTimeoutSeconds > 0) {
showCslStats(ftp);
}
- }
- // Allow multiple list types for single invocation
- else if (listFiles || mlsd || mdtm || mlst || listNames || size) {
+ } else if (listFiles || mlsd || mdtm || mlst || listNames || size) {
+ // Allow multiple list types for single invocation
if (mlsd) {
for (final FTPFile f : ftp.mlistDir(remote)) {
System.out.println(f.getRawListing());
diff --git a/src/main/java/org/apache/commons/net/examples/unix/chargen.java b/src/main/java/org/apache/commons/net/examples/unix/chargen.java
index 9ad9371b..bf6c7f7e 100644
--- a/src/main/java/org/apache/commons/net/examples/unix/chargen.java
+++ b/src/main/java/org/apache/commons/net/examples/unix/chargen.java
@@ -79,12 +79,11 @@ public final class chargen {
try {
data = client.receive();
- }
- // Here we catch both SocketException and InterruptedIOException,
- // because even though the JDK 1.1 docs claim that
- // InterruptedIOException is thrown on a timeout, it seems
- // SocketException is also thrown.
- catch (final SocketException e) {
+ } catch (final SocketException e) {
+ // Here we catch both SocketException and InterruptedIOException,
+ // because even though the JDK 1.1 docs claim that
+ // InterruptedIOException is thrown on a timeout, it seems
+ // SocketException is also thrown.
// We timed out and assume the packet is lost.
System.err.println("SocketException: Timed out and dropped packet");
continue;
diff --git a/src/main/java/org/apache/commons/net/examples/unix/echo.java b/src/main/java/org/apache/commons/net/examples/unix/echo.java
index 44703cda..83193e43 100644
--- a/src/main/java/org/apache/commons/net/examples/unix/echo.java
+++ b/src/main/java/org/apache/commons/net/examples/unix/echo.java
@@ -92,12 +92,11 @@ public final class echo {
do {
try {
length = client.receive(data);
- }
- // Here we catch both SocketException and InterruptedIOException,
- // because even though the JDK 1.1 docs claim that
- // InterruptedIOException is thrown on a timeout, it seems
- // SocketException is also thrown.
- catch (final SocketException e) {
+ } catch (final SocketException e) {
+ // Here we catch both SocketException and InterruptedIOException,
+ // because even though the JDK 1.1 docs claim that
+ // InterruptedIOException is thrown on a timeout, it seems
+ // SocketException is also thrown.
// We timed out and assume the packet is lost.
System.err.println("SocketException: Timed out and dropped packet");
break;
diff --git a/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java b/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
index 4fa00f3d..d36234ad 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
@@ -131,9 +131,8 @@ public class DefaultFTPFileEntryParserFactory implements FTPFileEntryParserFacto
final String upperKey = key.toUpperCase(Locale.ENGLISH);
if (upperKey.contains(FTPClientConfig.SYST_UNIX_TRIM_LEADING)) {
parser = new UnixFTPEntryParser(config, true);
- }
- // must check this after SYST_UNIX_TRIM_LEADING as it is a substring of it
- else if (upperKey.contains(FTPClientConfig.SYST_UNIX)) {
+ // must check this after SYST_UNIX_TRIM_LEADING as it is a substring of it
+ } else if (upperKey.contains(FTPClientConfig.SYST_UNIX)) {
parser = new UnixFTPEntryParser(config, false);
} else if (upperKey.contains(FTPClientConfig.SYST_VMS)) {
parser = new VMSVersioningFTPEntryParser(config);
diff --git a/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java
index feeb87b0..7c80293e 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java
@@ -287,8 +287,8 @@ public class MLSxEntryParser extends FTPFileEntryParserImpl {
default:
break;
} // mode
- } // unix.
- else if (!hasUnixMode && "perm".equals(factname)) { // skip if we have the UNIX.mode
+ // unix.
+ } else if (!hasUnixMode && "perm".equals(factname)) { // skip if we have the UNIX.mode
doUnixPerms(file, valueLowerCase);
}
break;
diff --git a/src/main/java/org/apache/commons/net/nntp/Threader.java b/src/main/java/org/apache/commons/net/nntp/Threader.java
index 44173893..287f984a 100644
--- a/src/main/java/org/apache/commons/net/nntp/Threader.java
+++ b/src/main/java/org/apache/commons/net/nntp/Threader.java
@@ -319,13 +319,10 @@ public class Threader {
} else {
prev.next = container.next;
}
-
// Set container to prev so that prev keeps its same value the next time through the loop
container = prev;
- }
-
- // Else if empty, with kids, and (not at root or only one kid)
- else if (container.threadable == null && (container.parent != null || container.child.next == null)) {
+ // Else if empty, with kids, and (not at root or only one kid)
+ } else if (container.threadable == null && (container.parent != null || container.child.next == null)) {
// We have an invalid/expired message with kids. Promote the kids to this level.
NntpThreadContainer tail;
final NntpThreadContainer kids = container.child;
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 596f93dd..1870a7d1 100644
--- a/src/main/java/org/apache/commons/net/telnet/TelnetOutputStream.java
+++ b/src/main/java/org/apache/commons/net/telnet/TelnetOutputStream.java
@@ -102,8 +102,8 @@ final class TelnetOutputStream extends OutputStream {
lastWasCR = false;
return;
}
- } // __convertCRtoCRLF
- else if (ch != '\n') {
+ } else if (ch != '\n') {
+ // convertCRtoCRLF
client.sendByte(Telnet.NUL); // RFC854 requires CR NUL for bare CR
}
}
@@ -130,8 +130,8 @@ final class TelnetOutputStream extends OutputStream {
lastWasCR = false;
break;
}
- } // end ASCII
- else if (ch == TelnetCommand.IAC) {
+ // end ASCII
+ } else if (ch == TelnetCommand.IAC) {
client.sendByte(ch);
client.sendByte(TelnetCommand.IAC);
} else {