You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sd...@apache.org on 2016/11/21 01:29:20 UTC
commons-crypto git commit: CRYPTO-129: Change access of instance
variables [Forced Update!]
Repository: commons-crypto
Updated Branches:
refs/heads/master 5150681c3 -> dc1769ed6 (forced update)
CRYPTO-129: Change access of instance variables
Closes #73 from jianguotian/CRYPTO-129
Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/dc1769ed
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/dc1769ed
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/dc1769ed
Branch: refs/heads/master
Commit: dc1769ed66b762646cdc7d2f5b268f274485f6b3
Parents: 8fcb6e2
Author: Tian Jianguo <ji...@intel.com>
Authored: Mon Nov 21 09:16:07 2016 +0800
Committer: Sun Dapeng <sd...@apache.org>
Committed: Mon Nov 21 09:20:58 2016 +0800
----------------------------------------------------------------------
pom.xml | 4 ++++
.../commons/crypto/stream/CryptoInputStream.java | 14 +++++++-------
.../commons/crypto/stream/CryptoOutputStream.java | 14 +++++++-------
.../commons/crypto/cipher/AbstractCipherTest.java | 8 ++++----
.../stream/PositionedCryptoInputStreamTest.java | 12 ++++++------
5 files changed, 28 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1d5c6af..e0b7cb9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -180,6 +180,10 @@ The following provides more details on the included cryptographic software:
<name>George Kankava </name>
<email>george.kankava@devfactory.com</email>
</contributor>
+ <contributor>
+ <name>Tian Jianguo</name>
+ <email>jianguo.tian@intel.com</email>
+ </contributor>
</contributors>
<properties>
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java b/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
index c3441fd..5c2bb14 100644
--- a/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
+++ b/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
@@ -58,16 +58,16 @@ public class CryptoInputStream extends InputStream implements
+ "stream.buffer.size";
/** The CryptoCipher instance. */
- final CryptoCipher cipher;
+ protected final CryptoCipher cipher;
/** The buffer size. */
- final int bufferSize;
+ private final int bufferSize;
/** Crypto key for the cipher. */
- final Key key;
+ protected final Key key;
/** the algorithm parameters */
- final AlgorithmParameterSpec params;
+ private final AlgorithmParameterSpec params;
/** Flag to mark whether the input stream is closed. */
private boolean closed;
@@ -78,19 +78,19 @@ public class CryptoInputStream extends InputStream implements
private boolean finalDone = false;
/** The input data. */
- Input input;
+ protected Input input;
/**
* Input data buffer. The data starts at inBuffer.position() and ends at to
* inBuffer.limit().
*/
- ByteBuffer inBuffer;
+ protected ByteBuffer inBuffer;
/**
* The decrypted data buffer. The data starts at outBuffer.position() and
* ends at outBuffer.limit().
*/
- ByteBuffer outBuffer;
+ protected ByteBuffer outBuffer;
// stream related configuration keys
/**
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java b/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
index bb59e2f..7e86809 100644
--- a/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
+++ b/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
@@ -50,19 +50,19 @@ public class CryptoOutputStream extends OutputStream implements
private final byte[] oneByteBuf = new byte[1];
/** The output. */
- Output output;
+ protected Output output;
/** the CryptoCipher instance */
- final CryptoCipher cipher;
+ protected final CryptoCipher cipher;
/** The buffer size. */
- final int bufferSize;
+ private final int bufferSize;
/** Crypto key for the cipher. */
- final Key key;
+ protected final Key key;
/** the algorithm parameters */
- final AlgorithmParameterSpec params;
+ private final AlgorithmParameterSpec params;
/** Flag to mark whether the output stream is closed. */
private boolean closed;
@@ -71,13 +71,13 @@ public class CryptoOutputStream extends OutputStream implements
* Input data buffer. The data starts at inBuffer.position() and ends at
* inBuffer.limit().
*/
- ByteBuffer inBuffer;
+ protected ByteBuffer inBuffer;
/**
* Encrypted data buffer. The data starts at outBuffer.position() and ends
* at outBuffer.limit().
*/
- ByteBuffer outBuffer;
+ protected ByteBuffer outBuffer;
/**
* Constructs a {@link CryptoOutputStream}.
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java b/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
index 0c422f2..785fd15 100644
--- a/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
+++ b/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
@@ -46,16 +46,16 @@ public abstract class AbstractCipherTest {
public static final int BYTEBUFFER_SIZE = 1000;
public String[] cipherTests = null;
- Properties props = null;
+ private Properties props = null;
protected String cipherClass = null;
protected String[] transformations = null;
// cipher
- static final byte[] KEY = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ protected static final byte[] KEY = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 };
- static final byte[] IV = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ protected static final byte[] IV = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
- CryptoCipher enc, dec;
+ private CryptoCipher enc, dec;
@Before
public void setup() {
http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java b/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
index 0d6ce16..7ac7e89 100644
--- a/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
+++ b/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
@@ -47,12 +47,12 @@ public class PositionedCryptoInputStreamTest {
private Properties props = new Properties();
private byte[] key = new byte[16];
private byte[] iv = new byte[16];
- int bufferSize = 2048;
- int bufferSizeLess = bufferSize - 1;
- int bufferSizeMore = bufferSize + 1;
- int length = 1024;
- int lengthLess = length - 1;
- int lengthMore = length + 1;
+ private int bufferSize = 2048;
+ private int bufferSizeLess = bufferSize - 1;
+ private int bufferSizeMore = bufferSize + 1;
+ private int length = 1024;
+ private int lengthLess = length - 1;
+ private int lengthMore = length + 1;
private String transformation = "AES/CTR/NoPadding";
Re: commons-crypto git commit: CRYPTO-129: Change access of instance
variables [Forced Update!]
Posted by sebb <se...@gmail.com>.
-1
See comments on JIRA
Only true constants should be protected or public.
On 21 November 2016 at 01:29, <sd...@apache.org> wrote:
> Repository: commons-crypto
> Updated Branches:
> refs/heads/master 5150681c3 -> dc1769ed6 (forced update)
>
>
> CRYPTO-129: Change access of instance variables
>
> Closes #73 from jianguotian/CRYPTO-129
>
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
> Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/dc1769ed
> Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/dc1769ed
> Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/dc1769ed
>
> Branch: refs/heads/master
> Commit: dc1769ed66b762646cdc7d2f5b268f274485f6b3
> Parents: 8fcb6e2
> Author: Tian Jianguo <ji...@intel.com>
> Authored: Mon Nov 21 09:16:07 2016 +0800
> Committer: Sun Dapeng <sd...@apache.org>
> Committed: Mon Nov 21 09:20:58 2016 +0800
>
> ----------------------------------------------------------------------
> pom.xml | 4 ++++
> .../commons/crypto/stream/CryptoInputStream.java | 14 +++++++-------
> .../commons/crypto/stream/CryptoOutputStream.java | 14 +++++++-------
> .../commons/crypto/cipher/AbstractCipherTest.java | 8 ++++----
> .../stream/PositionedCryptoInputStreamTest.java | 12 ++++++------
> 5 files changed, 28 insertions(+), 24 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/pom.xml
> ----------------------------------------------------------------------
> diff --git a/pom.xml b/pom.xml
> index 1d5c6af..e0b7cb9 100644
> --- a/pom.xml
> +++ b/pom.xml
> @@ -180,6 +180,10 @@ The following provides more details on the included cryptographic software:
> <name>George Kankava </name>
> <email>george.kankava@devfactory.com</email>
> </contributor>
> + <contributor>
> + <name>Tian Jianguo</name>
> + <email>jianguo.tian@intel.com</email>
> + </contributor>
> </contributors>
>
> <properties>
>
> http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
> ----------------------------------------------------------------------
> diff --git a/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java b/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
> index c3441fd..5c2bb14 100644
> --- a/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
> +++ b/src/main/java/org/apache/commons/crypto/stream/CryptoInputStream.java
> @@ -58,16 +58,16 @@ public class CryptoInputStream extends InputStream implements
> + "stream.buffer.size";
>
> /** The CryptoCipher instance. */
> - final CryptoCipher cipher;
> + protected final CryptoCipher cipher;
>
> /** The buffer size. */
> - final int bufferSize;
> + private final int bufferSize;
>
> /** Crypto key for the cipher. */
> - final Key key;
> + protected final Key key;
>
> /** the algorithm parameters */
> - final AlgorithmParameterSpec params;
> + private final AlgorithmParameterSpec params;
>
> /** Flag to mark whether the input stream is closed. */
> private boolean closed;
> @@ -78,19 +78,19 @@ public class CryptoInputStream extends InputStream implements
> private boolean finalDone = false;
>
> /** The input data. */
> - Input input;
> + protected Input input;
>
> /**
> * Input data buffer. The data starts at inBuffer.position() and ends at to
> * inBuffer.limit().
> */
> - ByteBuffer inBuffer;
> + protected ByteBuffer inBuffer;
>
> /**
> * The decrypted data buffer. The data starts at outBuffer.position() and
> * ends at outBuffer.limit().
> */
> - ByteBuffer outBuffer;
> + protected ByteBuffer outBuffer;
>
> // stream related configuration keys
> /**
>
> http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
> ----------------------------------------------------------------------
> diff --git a/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java b/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
> index bb59e2f..7e86809 100644
> --- a/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
> +++ b/src/main/java/org/apache/commons/crypto/stream/CryptoOutputStream.java
> @@ -50,19 +50,19 @@ public class CryptoOutputStream extends OutputStream implements
> private final byte[] oneByteBuf = new byte[1];
>
> /** The output. */
> - Output output;
> + protected Output output;
>
> /** the CryptoCipher instance */
> - final CryptoCipher cipher;
> + protected final CryptoCipher cipher;
>
> /** The buffer size. */
> - final int bufferSize;
> + private final int bufferSize;
>
> /** Crypto key for the cipher. */
> - final Key key;
> + protected final Key key;
>
> /** the algorithm parameters */
> - final AlgorithmParameterSpec params;
> + private final AlgorithmParameterSpec params;
>
> /** Flag to mark whether the output stream is closed. */
> private boolean closed;
> @@ -71,13 +71,13 @@ public class CryptoOutputStream extends OutputStream implements
> * Input data buffer. The data starts at inBuffer.position() and ends at
> * inBuffer.limit().
> */
> - ByteBuffer inBuffer;
> + protected ByteBuffer inBuffer;
>
> /**
> * Encrypted data buffer. The data starts at outBuffer.position() and ends
> * at outBuffer.limit().
> */
> - ByteBuffer outBuffer;
> + protected ByteBuffer outBuffer;
>
> /**
> * Constructs a {@link CryptoOutputStream}.
>
> http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
> ----------------------------------------------------------------------
> diff --git a/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java b/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
> index 0c422f2..785fd15 100644
> --- a/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
> +++ b/src/test/java/org/apache/commons/crypto/cipher/AbstractCipherTest.java
> @@ -46,16 +46,16 @@ public abstract class AbstractCipherTest {
> public static final int BYTEBUFFER_SIZE = 1000;
>
> public String[] cipherTests = null;
> - Properties props = null;
> + private Properties props = null;
> protected String cipherClass = null;
> protected String[] transformations = null;
>
> // cipher
> - static final byte[] KEY = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
> + protected static final byte[] KEY = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
> 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16 };
> - static final byte[] IV = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
> + protected static final byte[] IV = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
arrays have mutable entries and should NEVER be exposed.
This is a test class so it is less important, but it is bad practise.
> - CryptoCipher enc, dec;
> + private CryptoCipher enc, dec;
>
> @Before
> public void setup() {
>
> http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/dc1769ed/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
> ----------------------------------------------------------------------
> diff --git a/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java b/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
> index 0d6ce16..7ac7e89 100644
> --- a/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
> +++ b/src/test/java/org/apache/commons/crypto/stream/PositionedCryptoInputStreamTest.java
> @@ -47,12 +47,12 @@ public class PositionedCryptoInputStreamTest {
> private Properties props = new Properties();
> private byte[] key = new byte[16];
> private byte[] iv = new byte[16];
> - int bufferSize = 2048;
> - int bufferSizeLess = bufferSize - 1;
> - int bufferSizeMore = bufferSize + 1;
> - int length = 1024;
> - int lengthLess = length - 1;
> - int lengthMore = length + 1;
> + private int bufferSize = 2048;
> + private int bufferSizeLess = bufferSize - 1;
> + private int bufferSizeMore = bufferSize + 1;
> + private int length = 1024;
> + private int lengthLess = length - 1;
> + private int lengthMore = length + 1;
>
> private String transformation = "AES/CTR/NoPadding";
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org