Skip to content

Commit

Permalink
Fix static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
farleyb-amazon committed Oct 26, 2021
1 parent 37d57b5 commit 9470ce1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ private int parseComplete(final byte[] b, final int off) throws ParseException {
return 0;
}


/**
* Deserialize the provided bytes starting at the specified offset to construct an instance of
* this class. Uses the default value for maxEncryptedDataKeys, which results in no limit.
Expand All @@ -520,20 +519,20 @@ public int deserialize(final byte[] b, final int off) throws ParseException {
return deserialize(b, off, NO_MAX_ENCRYPTED_DATA_KEYS);
}

/**
* Deserialize the provided bytes starting at the specified offset to construct an instance of
* this class.
*
* <p>This method parses the provided bytes for the individual fields in this class. This method
* also supports partial parsing where not all the bytes required for parsing the fields
* successfully are available.
*
* @param b the byte array to deserialize.
* @param off the offset in the byte array to use for deserialization.
* @param maxEncryptedDataKeys the maximum number of EDKs to deserialize; zero indicates no
* maximum
* @return the number of bytes consumed in deserialization.
*/
/**
* Deserialize the provided bytes starting at the specified offset to construct an instance of
* this class.
*
* <p>This method parses the provided bytes for the individual fields in this class. This method
* also supports partial parsing where not all the bytes required for parsing the fields
* successfully are available.
*
* @param b the byte array to deserialize.
* @param off the offset in the byte array to use for deserialization.
* @param maxEncryptedDataKeys the maximum number of EDKs to deserialize; zero indicates no
* maximum
* @return the number of bytes consumed in deserialization.
*/
public int deserialize(final byte[] b, final int off, int maxEncryptedDataKeys)
throws ParseException {
if (b == null) {
Expand Down Expand Up @@ -853,8 +852,7 @@ public void setSuiteData(byte[] suiteData) {
}

/**
* Return max encrypted data keys
* Package scope for unit testing.
* Return max encrypted data keys. Package scope for unit testing.
*
* @return int
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public void serializeDeserialize() {

final byte[] headerBytes = ciphertextHeaders.toByteArray();
final CiphertextHeaders reconstructedHeaders = new CiphertextHeaders();
reconstructedHeaders.deserialize(
headerBytes, 0, maxEncryptedDataKeys);
reconstructedHeaders.deserialize(headerBytes, 0, maxEncryptedDataKeys);
final byte[] reconstructedHeaderBytes = reconstructedHeaders.toByteArray();

assertEquals(reconstructedHeaders.getMaxEncryptedDataKeys(), maxEncryptedDataKeys);
Expand All @@ -83,7 +82,9 @@ public void serializeDeserializeDefaultMaxEncryptedDataKeys() {
reconstructedHeaders.deserialize(headerBytes, 0);
final byte[] reconstructedHeaderBytes = reconstructedHeaders.toByteArray();

assertEquals(reconstructedHeaders.getMaxEncryptedDataKeys(), CiphertextHeaders.NO_MAX_ENCRYPTED_DATA_KEYS);
assertEquals(
reconstructedHeaders.getMaxEncryptedDataKeys(),
CiphertextHeaders.NO_MAX_ENCRYPTED_DATA_KEYS);
assertArrayEquals(headerBytes, reconstructedHeaderBytes);
}
}
Expand Down

0 comments on commit 9470ce1

Please sign in to comment.