chore: PMD warnings clean-up

Signed-off-by: Leo Galambos <lg@hq.egothor.org>
This commit is contained in:
2025-12-24 21:41:44 +01:00
parent eba163dd21
commit 0b4b4de603
4 changed files with 7 additions and 7 deletions

View File

@@ -247,7 +247,7 @@ abstract class AbstractChaChaCipherContext<S extends ChaChaBaseSpec> implements
if (nonce == null) { if (nonce == null) {
nonce = new byte[NONCE_LEN]; nonce = new byte[NONCE_LEN];
rnd.nextBytes(nonce); rnd.nextBytes(nonce);
if (ctx != null) { if (ctx != null) { // NOPMD
ctx.put(ConfluxKeys.iv(id), nonce); ctx.put(ConfluxKeys.iv(id), nonce);
} }
} else if (nonce.length != NONCE_LEN) { } else if (nonce.length != NONCE_LEN) {

View File

@@ -229,9 +229,9 @@ public abstract class TailStrippingInputStream extends InputStream {
emitPos += chunk; emitPos += chunk;
if (emitPos == emitLen) { if (emitPos == emitLen) {
// Emission finished; now it's safe to compact tail to start. // Emission finished; now it's safe to compact tail to start.
if (needCompactAfterEmit) { if (needCompactAfterEmit) { // NOPMD
int remaining = accLen - emitLen; // this is the withheld tail (<= tailLen) int remaining = accLen - emitLen; // this is the withheld tail (<= tailLen)
if (remaining > 0) { // NOPMD if (remaining > 0) {
System.arraycopy(window, emitLen, window, 0, remaining); System.arraycopy(window, emitLen, window, 0, remaining);
} }
accLen = remaining; accLen = remaining;
@@ -251,7 +251,7 @@ public abstract class TailStrippingInputStream extends InputStream {
// Whatever remains in window are the final tail bytes (<= tailLen). // Whatever remains in window are the final tail bytes (<= tailLen).
byte[] tail = Arrays.copyOf(window, accLen); byte[] tail = Arrays.copyOf(window, accLen);
if (LOG.isLoggable(Level.FINE)) { if (LOG.isLoggable(Level.FINE)) { // NOPMD
LOG.log(Level.FINE, "tail found {0}", Strings.toShortString(tail)); LOG.log(Level.FINE, "tail found {0}", Strings.toShortString(tail));
} }
tailProcessed = true; tailProcessed = true;
@@ -286,7 +286,7 @@ public abstract class TailStrippingInputStream extends InputStream {
System.arraycopy(window, emitPos, b, off, chunk); System.arraycopy(window, emitPos, b, off, chunk);
emitPos += chunk; emitPos += chunk;
if (emitPos == emitLen) { if (emitPos == emitLen) {
if (needCompactAfterEmit) { if (needCompactAfterEmit) { // NOPMD
int remaining = accLen - emitLen; int remaining = accLen - emitLen;
if (remaining > 0) { if (remaining > 0) {
System.arraycopy(window, emitLen, window, 0, remaining); System.arraycopy(window, emitLen, window, 0, remaining);

View File

@@ -451,7 +451,7 @@ public final class ChaChaDataContentBuilder implements DataContentBuilder<DataCo
ctx.put(ConfluxKeys.iv(algId), nonce); ctx.put(ConfluxKeys.iv(algId), nonce);
} }
if (v == Variant.AEAD) { if (v == Variant.AEAD) {
if (aad != null) { if (aad != null) { // NOPMD
ctx.put(ConfluxKeys.aad(algId), aad); ctx.put(ConfluxKeys.aad(algId), aad);
} }
} else { } else {

View File

@@ -129,7 +129,7 @@ final class Decryptor implements PlainContent {
byte[] maybe = op.tryOpen(id, blob, material); byte[] maybe = op.tryOpen(id, blob, material);
if (maybe != null) { if (maybe != null) {
if (maybe.length > keyBytes) { if (maybe.length > keyBytes) {
if (LOG.isLoggable(Level.WARNING)) { if (LOG.isLoggable(Level.WARNING)) { // NOPMD
LOG.log(Level.WARNING, LOG.log(Level.WARNING,
"Suspicious material in field {0}: {1}/{2} finds the secret of length {3}, while {4} is a limit. Ignoring.", "Suspicious material in field {0}: {1}/{2} finds the secret of length {3}, while {4} is a limit. Ignoring.",
new Object[] { i, id, op.toString(), maybe.length, keyBytes }); // NOPMD new Object[] { i, id, op.toString(), maybe.length, keyBytes }); // NOPMD