Skip to content

Commit 9902998

Browse files
committed
Fix missing Javadoc
Add Javadoc to classes that were missing it to pass the checkstyle validation.
1 parent b4e6699 commit 9902998

23 files changed

+215
-8
lines changed

config/checkstyle/checkstyle.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
<module name="WhitespaceAround">
2424
<property name="allowEmptyMethods" value="true" />
2525
</module>
26+
<!-- Javadoc checks for public classes only -->
27+
<module name="JavadocType">
28+
<property name="scope" value="public" />
29+
</module>
2630
<!-- No trailing whitespace -->
2731
<module name="Regexp">
2832
<property name="format" value="[ \t]+$" />

config/checkstyle/suppressions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@
4343
checks="RegexpSinglelineJavaCheck" />
4444
<suppress files="sshlib/src/main/java/de/mud/.+\.java"
4545
checks=".*" />
46+
<!-- Test files don't need Javadoc -->
47+
<suppress files="sshlib/src/test/java/.+\.java"
48+
checks="JavadocType" />
4649
</suppressions>

src/main/java/com/trilead/ssh2/SCPClient.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@
1818
* This scp client is thread safe - you can download (and upload) different sets
1919
* of files concurrently without any troubles. The <code>SCPClient</code> is
2020
* actually mapping every request to a distinct {@link Session}.
21+
* <p>
22+
* Basic example - copy a file to the remote server:
23+
* <pre>{@code
24+
* Connection conn = new Connection("hostname");
25+
* conn.connect();
26+
* conn.authenticateWithPassword("username", "password");
27+
*
28+
* SCPClient scp = new SCPClient(conn);
29+
* scp.put("local.txt", "/remote/path/");
30+
*
31+
* conn.close();
32+
* }</pre>
2133
*
2234
* @author Christian Plattner, plattner@trilead.com
2335
* @version $Id: SCPClient.java,v 1.2 2008/04/01 12:38:09 cplattne Exp $
36+
* @see Connection
37+
* @see Session
2438
*/
2539

2640
public class SCPClient

src/main/java/com/trilead/ssh2/SFTPv3Client.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,28 @@
2828
* Note: this is experimental code.
2929
* <p>
3030
* Error handling: the methods of this class throw IOExceptions. However, unless
31-
* there is catastrophic failure, exceptions of the type {@link SFTPv3Client} will
31+
* there is catastrophic failure, exceptions of the type {@link SFTPException} will
3232
* be thrown (a subclass of IOException). Therefore, you can implement more verbose
3333
* behavior by checking if a thrown exception if of this type. If yes, then you
3434
* can cast the exception and access detailed information about the failure.
3535
* <p>
36+
* Basic example - upload a file:
37+
* <pre>{@code
38+
* Connection conn = new Connection("hostname");
39+
* conn.connect();
40+
* conn.authenticateWithPassword("username", "password");
41+
*
42+
* SFTPv3Client sftp = new SFTPv3Client(conn);
43+
*
44+
* SFTPv3FileHandle handle = sftp.createFile("remote.txt");
45+
* byte[] data = "Hello, SFTP!".getBytes();
46+
* sftp.write(handle, 0, data, 0, data.length);
47+
* sftp.closeFile(handle);
48+
*
49+
* sftp.close();
50+
* conn.close();
51+
* }</pre>
52+
* <p>
3653
* Notes about file names, directory names and paths, copy-pasted
3754
* from the specs:
3855
* <ul>
@@ -57,6 +74,8 @@
5774
*
5875
* @author Christian Plattner, plattner@trilead.com
5976
* @version $Id: SFTPv3Client.java,v 1.3 2008/04/01 12:38:09 cplattne Exp $
77+
* @see Connection
78+
* @see SFTPException
6079
*/
6180
public class SFTPv3Client
6281
{

src/main/java/com/trilead/ssh2/Session.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,30 @@
1616
* in this context either a shell, an application or a system command. The
1717
* program may or may not have a tty. Only one single program can be started on
1818
* a session. However, multiple sessions can be active simultaneously.
19+
* <p>
20+
* Basic example - execute a command and read output:
21+
* <pre>{@code
22+
* Connection conn = new Connection("hostname");
23+
* conn.connect();
24+
* conn.authenticateWithPassword("username", "password");
25+
*
26+
* Session sess = conn.openSession();
27+
* sess.execCommand("uname -a");
28+
*
29+
* InputStream stdout = sess.getStdout();
30+
* BufferedReader br = new BufferedReader(new InputStreamReader(stdout));
31+
* while (true) {
32+
* String line = br.readLine();
33+
* if (line == null) break;
34+
* System.out.println(line);
35+
* }
36+
* sess.close();
37+
* conn.close();
38+
* }</pre>
1939
*
2040
* @author Christian Plattner, plattner@trilead.com
2141
* @version $Id: Session.java,v 1.2 2008/03/03 07:01:36 cplattne Exp $
42+
* @see Connection#openSession()
2243
*/
2344
public class Session implements AutoCloseable
2445
{

src/main/java/com/trilead/ssh2/auth/SignatureProxy.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
import java.io.IOException;
88
import java.security.PublicKey;
99

10+
/**
11+
* Proxy for signing operations using external private keys.
12+
* <p>
13+
* Enables SSH authentication with keys stored in external systems
14+
* (hardware tokens, key managers) by delegating the signing operation.
15+
*
16+
* @see AuthenticationManager
17+
*/
1018
public abstract class SignatureProxy
1119
{
1220
public static final String SHA1 = "SHA-1";

src/main/java/com/trilead/ssh2/channel/ChannelManager.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,33 @@
3030
import com.trilead.ssh2.transport.MessageHandler;
3131

3232
/**
33-
* ChannelManager. Please read the comments in Channel.java.
33+
* ChannelManager coordinates all SSH channels over a single transport connection.
3434
* <p>
35-
* Besides the crypto part, this is the core of the library.
35+
* This class is the core of the SSH channel layer, managing:
36+
* <ul>
37+
* <li>Channel lifecycle (open, close, EOF)</li>
38+
* <li>Data transmission and flow control</li>
39+
* <li>Channel requests (PTY, X11, exec, shell, subsystem)</li>
40+
* <li>Global requests (port forwarding, ping)</li>
41+
* <li>SSH message routing to appropriate channel handlers</li>
42+
* </ul>
43+
* <p>
44+
* Architecture: ChannelManager implements {@link MessageHandler} to receive
45+
* SSH packets in the range 80-100 (channel-related messages) from the
46+
* {@link com.trilead.ssh2.transport.TransportManager}. It maintains a registry
47+
* of active channels and routes messages to the appropriate channel instance.
48+
* <p>
49+
* The manager handles both synchronous operations (like opening a session channel)
50+
* and asynchronous message processing (incoming data, window adjustments, channel close).
51+
* <p>
52+
* Thread safety: All channel operations are synchronized on the channels list or
53+
* individual channel objects to ensure proper concurrency control.
3654
*
3755
* @author Christian Plattner, plattner@trilead.com
3856
* @version $Id: ChannelManager.java,v 1.2 2008/03/03 07:01:36 cplattne Exp $
57+
* @see Channel
58+
* @see MessageHandler
59+
* @see com.trilead.ssh2.transport.ITransportConnection
3960
*/
4061
public class ChannelManager implements MessageHandler
4162
{

src/main/java/com/trilead/ssh2/crypto/cipher/AES.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public void transformBlock(byte[] src, int srcoff, byte[] dst, int dstoff) {
4444
}
4545
}
4646

47+
/**
48+
* AES in CBC (Cipher Block Chaining) mode for SSH.
49+
*/
4750
public static class CBC extends AES {
4851
public CBC() throws IllegalArgumentException {
4952
try {
@@ -54,6 +57,9 @@ public CBC() throws IllegalArgumentException {
5457
}
5558
}
5659

60+
/**
61+
* AES in CTR (Counter) mode for SSH.
62+
*/
5763
public static class CTR extends AES {
5864
public CTR() throws IllegalArgumentException {
5965
try {

src/main/java/com/trilead/ssh2/crypto/cipher/BlowFish.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ public void transformBlock(byte[] src, int srcoff, byte[] dst, int dstoff) {
415415
}
416416
}
417417

418+
/**
419+
* BlowFish in CBC mode.
420+
*/
418421
public static class CBC extends Wrapper {
419422
@Override
420423
public void init(boolean forEncryption, byte[] key, byte[] iv) throws IllegalArgumentException {
@@ -424,6 +427,9 @@ public void init(boolean forEncryption, byte[] key, byte[] iv) throws IllegalArg
424427
}
425428
}
426429

430+
/**
431+
* BlowFish in CTR mode.
432+
*/
427433
public static class CTR extends Wrapper {
428434
@Override
429435
public void init(boolean forEncryption, byte[] key, byte[] iv) throws IllegalArgumentException {

src/main/java/com/trilead/ssh2/crypto/cipher/DES.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
*/
2929

3030
/**
31-
* DES.
31+
* A class that provides a basic DES engine.
3232
*
3333
* @author See comments in the source file
3434
* @version $Id: DES.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
35-
*
3635
*/
3736
public class DES implements BlockCipher
3837
{
@@ -369,6 +368,9 @@ protected void desFunc(int[] wKey, byte[] in, int inOff, byte[] out, int outOff)
369368
out[outOff + 7] = (byte) (left & 0xff);
370369
}
371370

371+
/**
372+
* DES in CBC mode.
373+
*/
372374
public static class CBC implements BlockCipher {
373375
protected BlockCipher bc;
374376

0 commit comments

Comments
 (0)