Fix check style
Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/49a26471 Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/49a26471 Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/49a26471 Branch: refs/heads/master Commit: 49a264718f4511ce272260082315e223d1a4615c Parents: 1298881 Author: Sun Dapeng <[email protected]> Authored: Fri Jun 24 16:32:08 2016 +0800 Committer: Sun Dapeng <[email protected]> Committed: Fri Jun 24 16:32:08 2016 +0800 ---------------------------------------------------------------------- .../commons/crypto/cipher/OpensslCipher.java | 2 +- .../crypto/examples/CipherByteArrayExample.java | 12 +++++++++++ .../examples/CipherByteBufferExample.java | 18 ++++++++++++++++ .../commons/crypto/examples/RandomExample.java | 7 +++++++ .../commons/crypto/examples/StreamExample.java | 12 +++++++++++ .../commons/crypto/examples/package-info.java | 22 ++++++++++++++++++++ .../org/apache/commons/crypto/package-info.java | 22 ++++++++++++++++++++ .../commons/crypto/utils/package-info.java | 2 +- 8 files changed, 95 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java b/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java index 1cfd3e8..ab088eb 100644 --- a/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java +++ b/src/main/java/org/apache/commons/crypto/cipher/OpensslCipher.java @@ -50,7 +50,7 @@ public class OpensslCipher implements CryptoCipher { * @param transformation transformation for OpenSSL cipher * @throws GeneralSecurityException if OpenSSL cipher initialize failed */ - public OpensslCipher(Properties props, String transformation) + public OpensslCipher(Properties props, String transformation) // NOPMD throws GeneralSecurityException { this.transformation = transformation; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java b/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java index a0a6ea0..e90a876 100644 --- a/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/CipherByteArrayExample.java @@ -30,10 +30,22 @@ import org.apache.commons.crypto.utils.Utils; public class CipherByteArrayExample { + /** + * Converts String to UTF8 bytes + * + * @param input the input string + * @return UTF8 bytes + */ private static byte[] getUTF8Bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } + /** + * Main method + * + * @param args args of main + * @throws Exception when encryption/decryption failed + */ public static void main(String[] args) throws Exception { final SecretKeySpec key = new SecretKeySpec(getUTF8Bytes("1234567890123456"),"AES"); final IvParameterSpec iv = new IvParameterSpec(getUTF8Bytes("1234567890123456")); http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java b/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java index e614a6c..d804975 100644 --- a/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/CipherByteBufferExample.java @@ -31,10 +31,22 @@ import org.apache.commons.crypto.utils.Utils; public class CipherByteBufferExample { + /** + * Converts String to UTF8 bytes + * + * @param input the input string + * @return UTF8 bytes + */ private static byte[] getUTF8Bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } + /** + * Converts ByteBuffer to String + * + * @param buffer input byte buffer + * @return the converted string + */ private static String asString(ByteBuffer buffer) { final ByteBuffer copy = buffer.duplicate(); final byte[] bytes = new byte[Math.min(copy.remaining(),50)]; @@ -42,6 +54,12 @@ public class CipherByteBufferExample { return new String(bytes, StandardCharsets.UTF_8); } + /** + * Main method + * + * @param args args of main + * @throws Exception when encryption/decryption failed + */ public static void main(String[] args) throws Exception { final SecretKeySpec key = new SecretKeySpec(getUTF8Bytes("1234567890123456"), "AES"); final IvParameterSpec iv = new IvParameterSpec(getUTF8Bytes("1234567890123456")); http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/RandomExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/RandomExample.java b/src/main/java/org/apache/commons/crypto/examples/RandomExample.java index a350d7f..7e0c220 100644 --- a/src/main/java/org/apache/commons/crypto/examples/RandomExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/RandomExample.java @@ -28,6 +28,13 @@ import org.apache.commons.crypto.random.CryptoRandomFactory; public class RandomExample { + /** + * Main method + * + * @param args args of main + * @throws GeneralSecurityException when encryption/decryption failed + * @throws IOException when io failed + */ public static void main(String []args) throws GeneralSecurityException, IOException { //Constructs a byte array to store random data. byte[] key = new byte[16]; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/StreamExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/StreamExample.java b/src/main/java/org/apache/commons/crypto/examples/StreamExample.java index 8904cb1..b92ffca 100644 --- a/src/main/java/org/apache/commons/crypto/examples/StreamExample.java +++ b/src/main/java/org/apache/commons/crypto/examples/StreamExample.java @@ -36,10 +36,22 @@ import org.apache.commons.crypto.stream.CryptoOutputStream; */ public class StreamExample { + /** + * Converts String to UTF8 bytes + * + * @param input the input string + * @return UTF8 bytes + */ private static byte[] getUTF8Bytes(String input) { return input.getBytes(StandardCharsets.UTF_8); } + /** + * Main method + * + * @param args args of main + * @throws IOException when stream encryption/decryption failed + */ public static void main(String []args) throws IOException { final SecretKeySpec key = new SecretKeySpec(getUTF8Bytes("1234567890123456"),"AES"); final IvParameterSpec iv = new IvParameterSpec(getUTF8Bytes("1234567890123456")); http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/examples/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/examples/package-info.java b/src/main/java/org/apache/commons/crypto/examples/package-info.java new file mode 100644 index 0000000..6f9c541 --- /dev/null +++ b/src/main/java/org/apache/commons/crypto/examples/package-info.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Example classes + */ +package org.apache.commons.crypto.examples; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/package-info.java b/src/main/java/org/apache/commons/crypto/package-info.java new file mode 100644 index 0000000..f7434c1 --- /dev/null +++ b/src/main/java/org/apache/commons/crypto/package-info.java @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Crypto classes + */ +package org.apache.commons.crypto; http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/49a26471/src/main/java/org/apache/commons/crypto/utils/package-info.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/crypto/utils/package-info.java b/src/main/java/org/apache/commons/crypto/utils/package-info.java index 20785f2..060117e 100644 --- a/src/main/java/org/apache/commons/crypto/utils/package-info.java +++ b/src/main/java/org/apache/commons/crypto/utils/package-info.java @@ -15,8 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * Utils classes */ package org.apache.commons.crypto.utils; -
