Permalink
Browse files

mass auto-format

  • Loading branch information...
1 parent d6eb5a0 commit 3267860db400e031f9c2ecbcb32c679c06637198 @shikhar shikhar committed Jul 24, 2011
Showing with 243 additions and 189 deletions.
  1. +1 −1 src/main/java/examples/LocalPF.java
  2. +2 −2 src/main/java/net/schmizz/concurrent/ErrorDeliveryUtil.java
  3. +2 −1 src/main/java/net/schmizz/sshj/AndroidConfig.java
  4. +1 −0 src/main/java/net/schmizz/sshj/Config.java
  5. +1 −1 src/main/java/net/schmizz/sshj/DefaultConfig.java
  6. +3 −7 src/main/java/net/schmizz/sshj/SSHClient.java
  7. +55 −30 src/main/java/net/schmizz/sshj/common/Base64.java
  8. +0 −2 src/main/java/net/schmizz/sshj/common/ByteArrayUtils.java
  9. +1 −0 src/main/java/net/schmizz/sshj/common/ErrorNotifiable.java
  10. +0 −3 src/main/java/net/schmizz/sshj/common/KeyType.java
  11. +1 −0 src/main/java/net/schmizz/sshj/common/SecurityUtils.java
  12. +3 −3 src/main/java/net/schmizz/sshj/connection/Connection.java
  13. +4 −3 src/main/java/net/schmizz/sshj/connection/channel/AbstractChannel.java
  14. +1 −0 src/main/java/net/schmizz/sshj/connection/channel/Channel.java
  15. +2 −2 src/main/java/net/schmizz/sshj/connection/channel/ChannelInputStream.java
  16. +2 −2 src/main/java/net/schmizz/sshj/connection/channel/SocketStreamCopyMonitor.java
  17. +1 −1 src/main/java/net/schmizz/sshj/connection/channel/direct/LocalPortForwarder.java
  18. +5 −2 src/main/java/net/schmizz/sshj/connection/channel/direct/Session.java
  19. +3 −3 src/main/java/net/schmizz/sshj/connection/channel/forwarded/AbstractForwardedChannel.java
  20. +8 −8 src/main/java/net/schmizz/sshj/connection/channel/forwarded/RemotePortForwarder.java
  21. +4 −4 src/main/java/net/schmizz/sshj/sftp/PacketReader.java
  22. +1 −1 src/main/java/net/schmizz/sshj/sftp/RemoteDirectory.java
  23. +11 −11 src/main/java/net/schmizz/sshj/sftp/RemoteFile.java
  24. +4 −2 src/main/java/net/schmizz/sshj/sftp/Response.java
  25. +2 −1 src/main/java/net/schmizz/sshj/sftp/SFTPEngine.java
  26. +1 −1 src/main/java/net/schmizz/sshj/transport/Converter.java
  27. +2 −2 src/main/java/net/schmizz/sshj/transport/Decoder.java
  28. +9 −9 src/main/java/net/schmizz/sshj/transport/NegotiatedAlgorithms.java
  29. +4 −4 src/main/java/net/schmizz/sshj/transport/Transport.java
  30. +12 −9 src/main/java/net/schmizz/sshj/transport/TransportImpl.java
  31. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/AES128CBC.java
  32. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/AES128CTR.java
  33. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/AES192CBC.java
  34. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/AES192CTR.java
  35. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/AES256CBC.java
  36. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/AES256CTR.java
  37. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/BlowfishCBC.java
  38. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/NoneCipher.java
  39. +1 −0 src/main/java/net/schmizz/sshj/transport/cipher/TripleDESCBC.java
  40. +1 −0 src/main/java/net/schmizz/sshj/transport/compression/DelayedZlibCompression.java
  41. +1 −0 src/main/java/net/schmizz/sshj/transport/compression/NoneCompression.java
  42. +2 −1 src/main/java/net/schmizz/sshj/transport/compression/ZlibCompression.java
  43. +2 −1 src/main/java/net/schmizz/sshj/transport/kex/DHG14.java
  44. +10 −10 src/main/java/net/schmizz/sshj/transport/kex/DHGroupData.java
  45. +1 −0 src/main/java/net/schmizz/sshj/transport/random/SingletonRandomFactory.java
  46. +10 −10 src/main/java/net/schmizz/sshj/transport/verification/ConsoleKnownHostsVerifier.java
  47. +6 −3 src/main/java/net/schmizz/sshj/userauth/UserAuthImpl.java
  48. +1 −1 src/main/java/net/schmizz/sshj/userauth/keyprovider/KeyProviderUtil.java
  49. +1 −1 src/main/java/net/schmizz/sshj/userauth/keyprovider/OpenSSHKeyFile.java
  50. +2 −6 src/main/java/net/schmizz/sshj/userauth/keyprovider/PKCS8KeyFile.java
  51. +1 −0 src/main/java/net/schmizz/sshj/userauth/method/AuthKeyboardInteractive.java
  52. +5 −4 src/main/java/net/schmizz/sshj/userauth/method/KeyedAuthMethod.java
  53. +2 −1 src/main/java/net/schmizz/sshj/userauth/password/AccountResource.java
  54. +4 −2 src/main/java/net/schmizz/sshj/userauth/password/PrivateKeyStringResource.java
  55. +0 −2 src/main/java/net/schmizz/sshj/xfer/FileSystemFile.java
  56. +1 −1 src/main/java/net/schmizz/sshj/xfer/FileTransfer.java
  57. +2 −1 src/main/java/net/schmizz/sshj/xfer/LocalSourceFile.java
  58. +1 −0 src/main/java/net/schmizz/sshj/xfer/scp/SCPException.java
  59. +7 −7 src/main/java/net/schmizz/sshj/xfer/scp/SCPFileTransfer.java
  60. +2 −1 src/test/java/net/schmizz/sshj/SmokeTest.java
  61. +2 −3 src/test/java/net/schmizz/sshj/keyprovider/OpenSSHKeyFileTest.java
  62. +1 −0 src/test/java/net/schmizz/sshj/util/BufferTest.java
  63. +23 −19 src/test/java/net/schmizz/sshj/util/KeyUtil.java
@@ -42,7 +42,7 @@ public static void main(String... args)
* google.com:80
*/
ssh.newLocalPortForwarder(new InetSocketAddress("localhost", 8080), "google.com", 80)
- .listen();
+ .listen();
} finally {
ssh.disconnect();
@@ -30,12 +30,12 @@ public static void alertPromises(Throwable x, Collection<? extends Promise> prom
}
public static void alertEvents(Throwable x, Event... events) {
- for (Event e: events)
+ for (Event e : events)
e.deliverError(x);
}
public static void alertEvents(Throwable x, Collection<? extends Event> events) {
- for (Event e: events)
+ for (Event e : events)
e.deliverError(x);
}
@@ -18,7 +18,8 @@
import net.schmizz.sshj.transport.random.JCERandom;
import net.schmizz.sshj.transport.random.SingletonRandomFactory;
-public class AndroidConfig extends DefaultConfig {
+public class AndroidConfig
+ extends DefaultConfig {
@Override
protected void initRandomFactory(boolean ignored) {
@@ -31,6 +31,7 @@
* {@link Compression}, {@link MAC}, {@link Signature}, {@link Random}, and {@link FileKeyProvider}.
*/
public interface Config {
+
/**
* Retrieve the list of named factories for {@code Cipher}.
*
@@ -137,7 +137,7 @@ protected void initCipherFactories() {
boolean warn = false;
// Ref. https://issues.apache.org/jira/browse/SSHD-24
// "AES256 and AES192 requires unlimited cryptography extension"
- for (Iterator<Factory.Named<Cipher>> i = avail.iterator(); i.hasNext();) {
+ for (Iterator<Factory.Named<Cipher>> i = avail.iterator(); i.hasNext(); ) {
final Factory.Named<Cipher> f = i.next();
try {
final Cipher c = f.create();
@@ -16,7 +16,6 @@
package net.schmizz.sshj;
-import net.schmizz.sshj.common.DisconnectReason;
import net.schmizz.sshj.common.Factory;
import net.schmizz.sshj.common.SSHException;
import net.schmizz.sshj.common.SecurityUtils;
@@ -50,7 +49,6 @@
import net.schmizz.sshj.userauth.keyprovider.KeyPairWrapper;
import net.schmizz.sshj.userauth.keyprovider.KeyProvider;
import net.schmizz.sshj.userauth.keyprovider.KeyProviderUtil;
-import net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile;
import net.schmizz.sshj.userauth.method.AuthKeyboardInteractive;
import net.schmizz.sshj.userauth.method.AuthMethod;
import net.schmizz.sshj.userauth.method.AuthPassword;
@@ -65,8 +63,6 @@
import java.io.File;
import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
import java.net.SocketAddress;
import java.security.KeyPair;
import java.security.PublicKey;
@@ -444,7 +440,7 @@ public KeyProvider loadKeys(String location)
/**
* Utility function for createing a {@link KeyProvider} instance from given location on the file system. Creates a
* one-off {@link PasswordFinder} using {@link PasswordUtils#createOneOff(char[])}, and calls {@link
- * #loadKeys(String,PasswordFinder)}.
+ * #loadKeys(String, PasswordFinder)}.
*
* @param location location of the key file
* @param passphrase passphrase as a char-array
@@ -505,8 +501,8 @@ public KeyProvider loadKeys(String location, String passphrase)
}
/**
- * Creates a {@link KeyProvider} instance from passed strings. Currently only PKCS8 format
- * private key files are supported (OpenSSH uses this format).
+ * Creates a {@link KeyProvider} instance from passed strings. Currently only PKCS8 format private key files are
+ * supported (OpenSSH uses this format).
* <p/>
*
* @param privateKey the private key as a string
@@ -32,7 +32,8 @@
* @see Base64
* @since 1.3
*/
- public static class InputStream extends java.io.FilterInputStream {
+ public static class InputStream
+ extends java.io.FilterInputStream {
private final boolean encode; // Encoding or decoding
private int position; // Current position in the buffer
@@ -99,7 +100,8 @@ public InputStream(java.io.InputStream in, int options) {
* @since 1.3
*/
@Override
- public int read() throws java.io.IOException {
+ public int read()
+ throws java.io.IOException {
// Do we need to get data?
if (position < 0)
@@ -197,7 +199,8 @@ else if (i == 0)
* @since 1.3
*/
@Override
- public int read(byte[] dest, int off, int len) throws java.io.IOException {
+ public int read(byte[] dest, int off, int len)
+ throws java.io.IOException {
int i;
int b;
for (i = 0; i < len; i++) {
@@ -222,7 +225,8 @@ else if (i == 0)
* @see Base64
* @since 1.3
*/
- public static class OutputStream extends java.io.FilterOutputStream {
+ public static class OutputStream
+ extends java.io.FilterOutputStream {
private final boolean encode;
private int position;
@@ -289,7 +293,8 @@ public OutputStream(java.io.OutputStream out, int options) {
* @since 1.3
*/
@Override
- public void close() throws java.io.IOException {
+ public void close()
+ throws java.io.IOException {
// 1. Ensure that pending characters are written
flush();
@@ -308,7 +313,8 @@ public void close() throws java.io.IOException {
* @since 2.3
*/
@Override
- public void flush() throws java.io.IOException {
+ public void flush()
+ throws java.io.IOException {
flushBase64();
super.flush();
}
@@ -318,7 +324,8 @@ public void flush() throws java.io.IOException {
*
* @throws java.io.IOException if there's an error.
*/
- public void flushBase64() throws java.io.IOException {
+ public void flushBase64()
+ throws java.io.IOException {
if (position > 0)
if (encode) {
out.write(encode3to4(b4, buffer, position, options));
@@ -346,7 +353,8 @@ public void resumeEncoding() {
* @throws java.io.IOException if there's an error flushing
* @since 1.5.1
*/
- public void suspendEncoding() throws java.io.IOException {
+ public void suspendEncoding()
+ throws java.io.IOException {
flushBase64();
suspendEncoding = true;
} // end suspendEncoding
@@ -361,7 +369,8 @@ public void suspendEncoding() throws java.io.IOException {
* @since 1.3
*/
@Override
- public void write(byte[] theBytes, int off, int len) throws java.io.IOException {
+ public void write(byte[] theBytes, int off, int len)
+ throws java.io.IOException {
// Encoding suspended?
if (suspendEncoding) {
super.out.write(theBytes, off, len);
@@ -383,7 +392,8 @@ public void write(byte[] theBytes, int off, int len) throws java.io.IOException
* @since 1.3
*/
@Override
- public void write(int theByte) throws java.io.IOException {
+ public void write(int theByte)
+ throws java.io.IOException {
// Encoding suspended?
if (suspendEncoding) {
super.out.write(theByte);
@@ -673,7 +683,8 @@ else if (decodabet[theByte & 0x7f] != WHITE_SPACE_ENC)
* @throws java.io.IOException If bogus characters exist in source data
* @since 1.3
*/
- public static byte[] decode(byte[] source, int off, int len, int options) throws java.io.IOException {
+ public static byte[] decode(byte[] source, int off, int len, int options)
+ throws java.io.IOException {
// Lots of error checking and exception throwing
if (source == null)
@@ -725,7 +736,7 @@ else if (len < 4)
else
// There's a bad input character in the Base64 stream.
throw new java.io.IOException(String.format("Bad Base64 input character '%c' in array position %d",
- source[i], i));
+ source[i], i));
} // each input character
byte[] out = new byte[outBuffPosn];
@@ -743,7 +754,8 @@ else if (len < 4)
* @throws java.io.IOException If there is a problem
* @since 1.4
*/
- public static byte[] decode(String s) throws java.io.IOException {
+ public static byte[] decode(String s)
+ throws java.io.IOException {
return decode(s, NO_OPTIONS);
}
@@ -759,7 +771,8 @@ else if (len < 4)
* @throws NullPointerException if <tt>s</tt> is null
* @since 1.4
*/
- public static byte[] decode(String s, int options) throws java.io.IOException {
+ public static byte[] decode(String s, int options)
+ throws java.io.IOException {
if (s == null)
throw new NullPointerException("Input string was null.");
@@ -833,7 +846,8 @@ else if (len < 4)
* @throws java.io.IOException if there is an error
* @since 2.2
*/
- public static void decodeFileToFile(String infile, String outfile) throws java.io.IOException {
+ public static void decodeFileToFile(String infile, String outfile)
+ throws java.io.IOException {
byte[] decoded = Base64.decodeFromFile(infile);
java.io.OutputStream out = null;
@@ -864,7 +878,8 @@ public static void decodeFileToFile(String infile, String outfile) throws java.i
* @throws java.io.IOException if there is an error
* @since 2.1
*/
- public static byte[] decodeFromFile(String filename) throws java.io.IOException {
+ public static byte[] decodeFromFile(String filename)
+ throws java.io.IOException {
byte[] decodedData = null;
Base64.InputStream bis = null;
@@ -878,12 +893,12 @@ public static void decodeFileToFile(String infile, String outfile) throws java.i
// Check for size of file
if (file.length() > Integer.MAX_VALUE)
throw new java.io.IOException("File is too big for this convenience method (" + file.length()
- + " bytes).");
+ + " bytes).");
buffer = new byte[(int) file.length()];
// Open a stream
bis = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(file)),
- Base64.DECODE);
+ Base64.DECODE);
// Read until done
while ((numBytes = bis.read(buffer, length, 4096)) >= 0)
@@ -918,7 +933,8 @@ public static void decodeFileToFile(String infile, String outfile) throws java.i
* @throws java.io.IOException if there is an error
* @since 2.1
*/
- public static void decodeToFile(String dataToDecode, String filename) throws java.io.IOException {
+ public static void decodeToFile(String dataToDecode, String filename)
+ throws java.io.IOException {
Base64.OutputStream bos = null;
try {
@@ -950,8 +966,9 @@ public static void decodeToFile(String dataToDecode, String filename) throws jav
* @throws ClassNotFoundException if the decoded object is of a class that cannot be found by the JVM
* @since 1.5
*/
- public static Object decodeToObject(String encodedObject) throws java.io.IOException,
- java.lang.ClassNotFoundException {
+ public static Object decodeToObject(String encodedObject)
+ throws java.io.IOException,
+ java.lang.ClassNotFoundException {
// Decode and gunzip if necessary
byte[] objBytes = decode(encodedObject);
@@ -1078,7 +1095,8 @@ public static String encodeBytes(byte[] source) {
* @see Base64#DO_BREAK_LINES
* @since 2.0
*/
- public static String encodeBytes(byte[] source, int options) throws java.io.IOException {
+ public static String encodeBytes(byte[] source, int options)
+ throws java.io.IOException {
return encodeBytes(source, 0, source.length, options);
} // end encodeBytes
@@ -1137,7 +1155,8 @@ public static String encodeBytes(byte[] source, int off, int len) {
* @see Base64#DO_BREAK_LINES
* @since 2.0
*/
- public static String encodeBytes(byte[] source, int off, int len, int options) throws java.io.IOException {
+ public static String encodeBytes(byte[] source, int off, int len, int options)
+ throws java.io.IOException {
byte[] encoded = encodeBytesToBytes(source, off, len, options);
// Return value according to relevant encoding.
@@ -1189,7 +1208,8 @@ public static String encodeBytes(byte[] source, int off, int len, int options) t
* @see Base64#DO_BREAK_LINES
* @since 2.3.1
*/
- public static byte[] encodeBytesToBytes(byte[] source, int off, int len, int options) throws java.io.IOException {
+ public static byte[] encodeBytesToBytes(byte[] source, int off, int len, int options)
+ throws java.io.IOException {
if (source == null)
throw new NullPointerException("Cannot serialize a null array.");
@@ -1302,7 +1322,8 @@ public static String encodeBytes(byte[] source, int off, int len, int options) t
* @throws java.io.IOException if there is an error
* @since 2.2
*/
- public static void encodeFileToFile(String infile, String outfile) throws java.io.IOException {
+ public static void encodeFileToFile(String infile, String outfile)
+ throws java.io.IOException {
String encoded = Base64.encodeFromFile(infile);
java.io.OutputStream out = null;
@@ -1333,7 +1354,8 @@ public static void encodeFileToFile(String infile, String outfile) throws java.i
* @throws java.io.IOException if there is an error
* @since 2.1
*/
- public static String encodeFromFile(String filename) throws java.io.IOException {
+ public static String encodeFromFile(String filename)
+ throws java.io.IOException {
String encodedData = null;
Base64.InputStream bis = null;
@@ -1348,7 +1370,7 @@ public static String encodeFromFile(String filename) throws java.io.IOException
// Open a stream
bis = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(file)),
- Base64.ENCODE);
+ Base64.ENCODE);
// Read until done
while ((numBytes = bis.read(buffer, length, 4096)) >= 0)
@@ -1387,7 +1409,8 @@ public static String encodeFromFile(String filename) throws java.io.IOException
* @throws NullPointerException if serializedObject is null
* @since 1.4
*/
- public static String encodeObject(java.io.Serializable serializableObject) throws java.io.IOException {
+ public static String encodeObject(java.io.Serializable serializableObject)
+ throws java.io.IOException {
return encodeObject(serializableObject, NO_OPTIONS);
} // end encodeObject
@@ -1420,7 +1443,8 @@ public static String encodeObject(java.io.Serializable serializableObject) throw
* @see Base64#DO_BREAK_LINES
* @since 2.0
*/
- public static String encodeObject(java.io.Serializable serializableObject, int options) throws java.io.IOException {
+ public static String encodeObject(java.io.Serializable serializableObject, int options)
+ throws java.io.IOException {
if (serializableObject == null)
throw new NullPointerException("Cannot serialize a null object.");
@@ -1481,7 +1505,8 @@ public static String encodeObject(java.io.Serializable serializableObject, int o
* @throws NullPointerException if dataToEncode is null
* @since 2.1
*/
- public static void encodeToFile(byte[] dataToEncode, String filename) throws java.io.IOException {
+ public static void encodeToFile(byte[] dataToEncode, String filename)
+ throws java.io.IOException {
if (dataToEncode == null)
throw new NullPointerException("Data to encode was null.");
@@ -35,8 +35,6 @@
*/
package net.schmizz.sshj.common;
-import java.util.Arrays;
-
/** Utility functions for byte arrays. */
public class ByteArrayUtils {
@@ -22,6 +22,7 @@
/** Utility functions. */
class Util {
+
/** Notify all {@code notifiables} of given {@code error}. */
public static void alertAll(SSHException error, ErrorNotifiable... notifiables) {
for (ErrorNotifiable notifiable : notifiables)
Oops, something went wrong.

0 comments on commit 3267860

Please sign in to comment.