diff --git a/src/main/java/io/github/spannm/jackcess/impl/DatabaseImpl.java b/src/main/java/io/github/spannm/jackcess/impl/DatabaseImpl.java index 4ece314..bb6a845 100644 --- a/src/main/java/io/github/spannm/jackcess/impl/DatabaseImpl.java +++ b/src/main/java/io/github/spannm/jackcess/impl/DatabaseImpl.java @@ -742,6 +742,7 @@ public Map getLinkedDatabases() { } @Override + @SuppressWarnings("PMD.SimplifyBooleanReturns") public boolean isLinkedTable(Table table) throws IOException { if (table == null || this == table.getDatabase()) { diff --git a/src/main/java/io/github/spannm/jackcess/impl/IndexCursorImpl.java b/src/main/java/io/github/spannm/jackcess/impl/IndexCursorImpl.java index 4a0c0ed..4f2118e 100644 --- a/src/main/java/io/github/spannm/jackcess/impl/IndexCursorImpl.java +++ b/src/main/java/io/github/spannm/jackcess/impl/IndexCursorImpl.java @@ -210,6 +210,7 @@ protected PositionImpl getRowPosition(RowIdImpl rowId) throws IOException { return new IndexPosition(_entryCursor.getNextEntry()); } + @SuppressWarnings("PMD.SimplifyBooleanReturns") @Override protected boolean findAnotherRowImpl( ColumnImpl columnPattern, Object valuePattern, boolean moveForward, diff --git a/src/main/java/io/github/spannm/jackcess/impl/IndexPageCache.java b/src/main/java/io/github/spannm/jackcess/impl/IndexPageCache.java index 8fa688a..039d169 100644 --- a/src/main/java/io/github/spannm/jackcess/impl/IndexPageCache.java +++ b/src/main/java/io/github/spannm/jackcess/impl/IndexPageCache.java @@ -1323,7 +1323,7 @@ private void validateChildren(DataPageMain dpMain, DataPageExtra dpExtra) throws Integer subPageNumber = e.getSubPageNumber(); DataPageMain childMain = getPageForValidate(subPageNumber); if (childMain != null) { - if (prevPageNumber != null && (int) childMain._prevPageNumber != prevPageNumber) { + if (prevPageNumber != null && !childMain._prevPageNumber.equals(prevPageNumber)) { throw new IllegalStateException(withErrorContext("Child's prevPageNumber is not the previous child for " + childMain + " " + dpExtra._entryView + " " + prevPageNumber)); } if (nextPageNumber != null && childMain._pageNumber != nextPageNumber) { @@ -1388,7 +1388,7 @@ private void validatePeerStatus(DataPageMain dpMain, DataPageMain peerMain) { throw new IllegalStateException(withErrorContext("Mismatched peer status " + dpMain._leaf + " " + peerMain._leaf)); } if (!dpMain._leaf) { - if (dpMain._parentPageNumber != null && peerMain._parentPageNumber != null && (int) dpMain._parentPageNumber != (int) peerMain._parentPageNumber) { + if (dpMain._parentPageNumber != null && peerMain._parentPageNumber != null && !dpMain._parentPageNumber.equals(peerMain._parentPageNumber)) { throw new IllegalStateException(withErrorContext("Mismatched node parents " + dpMain._parentPageNumber + " " + peerMain._parentPageNumber)); } } diff --git a/src/main/java/io/github/spannm/jackcess/impl/OleUtil.java b/src/main/java/io/github/spannm/jackcess/impl/OleUtil.java index 160808f..ae41b7d 100644 --- a/src/main/java/io/github/spannm/jackcess/impl/OleUtil.java +++ b/src/main/java/io/github/spannm/jackcess/impl/OleUtil.java @@ -18,7 +18,7 @@ import io.github.spannm.jackcess.DataType; import io.github.spannm.jackcess.util.OleBlob; -import io.github.spannm.jackcess.util.OleBlob.*; +import io.github.spannm.jackcess.util.OleBlob.*; // NOPMD import io.github.spannm.jackcess.util.ToStringBuilder; import java.io.*; @@ -100,6 +100,7 @@ public static OleBlob parseBlob(byte[] bytes) { /** * Creates a new OlBlob instance using the given information. */ + @SuppressWarnings("PMD.UseTryWithResources") public static OleBlob createBlob(Builder oleBuilder) throws IOException { try { diff --git a/src/main/java/io/github/spannm/jackcess/impl/expr/DefaultFunctions.java b/src/main/java/io/github/spannm/jackcess/impl/expr/DefaultFunctions.java index f5cbbde..7dbe283 100644 --- a/src/main/java/io/github/spannm/jackcess/impl/expr/DefaultFunctions.java +++ b/src/main/java/io/github/spannm/jackcess/impl/expr/DefaultFunctions.java @@ -20,7 +20,7 @@ import io.github.spannm.jackcess.expr.*; import io.github.spannm.jackcess.impl.DatabaseImpl; -import io.github.spannm.jackcess.impl.expr.FunctionSupport.*; +import io.github.spannm.jackcess.impl.expr.FunctionSupport.*; // NOPMD import java.lang.System.Logger; import java.lang.System.Logger.Level; diff --git a/src/main/java/io/github/spannm/jackcess/util/CustomLinkResolver.java b/src/main/java/io/github/spannm/jackcess/util/CustomLinkResolver.java index 6f71525..a07a84c 100644 --- a/src/main/java/io/github/spannm/jackcess/util/CustomLinkResolver.java +++ b/src/main/java/io/github/spannm/jackcess/util/CustomLinkResolver.java @@ -131,7 +131,7 @@ public Database resolveLinkedDatabase(Database linkerDb, String linkeeFileName) return createTempDb(customFile, getDefaultFormat(), isDefaultInMemory(), getDefaultTempDirectory(), readOnly); } - return LinkResolver.DEFAULT.resolveLinkedDatabase(linkerDb, linkeeFileName); + return DEFAULT.resolveLinkedDatabase(linkerDb, linkeeFileName); } /** diff --git a/src/test/java/io/github/spannm/jackcess/BigIndexTest.java b/src/test/java/io/github/spannm/jackcess/BigIndexTest.java index baf3072..ad7a8fd 100644 --- a/src/test/java/io/github/spannm/jackcess/BigIndexTest.java +++ b/src/test/java/io/github/spannm/jackcess/BigIndexTest.java @@ -50,6 +50,7 @@ void testComplexIndex(TestDb testDb) throws IOException { @ParameterizedTest(name = "[{index}] {0}") @TestDbSource(BIG_INDEX) + @SuppressWarnings("PMD.JumbledIncrementer") void testBigIndex(TestDb testDb) throws IOException { // this file has an index with "compressed" entries and node pages try (Database db = testDb.openMem()) { diff --git a/src/test/java/io/github/spannm/jackcess/test/source/DbsInPathSource.java b/src/test/java/io/github/spannm/jackcess/test/source/DbsInPathSource.java index 1fece2e..199b015 100644 --- a/src/test/java/io/github/spannm/jackcess/test/source/DbsInPathSource.java +++ b/src/test/java/io/github/spannm/jackcess/test/source/DbsInPathSource.java @@ -33,7 +33,7 @@ */ String value(); - static class DbsInPathSourceArgumentsProvider implements ArgumentsProvider { + class DbsInPathSourceArgumentsProvider implements ArgumentsProvider { @Override public Stream provideArguments(ExtensionContext _context) throws IOException { diff --git a/src/test/java/io/github/spannm/jackcess/test/source/TestDbReadOnlySource.java b/src/test/java/io/github/spannm/jackcess/test/source/TestDbReadOnlySource.java index 992d83f..b92f596 100644 --- a/src/test/java/io/github/spannm/jackcess/test/source/TestDbReadOnlySource.java +++ b/src/test/java/io/github/spannm/jackcess/test/source/TestDbReadOnlySource.java @@ -30,7 +30,7 @@ */ Basename[] value() default {}; - static class TestDbReadOnlyArgumentsProvider implements ArgumentsProvider { + class TestDbReadOnlyArgumentsProvider implements ArgumentsProvider { @Override public Stream provideArguments(ExtensionContext _context) { TestDbReadOnlySource src = _context.getElement().map(elem -> AnnotationSupport.findAnnotation(elem, TestDbReadOnlySource.class).get()).orElse(null); diff --git a/src/test/java/io/github/spannm/jackcess/test/source/TestDbSource.java b/src/test/java/io/github/spannm/jackcess/test/source/TestDbSource.java index c13f4f5..979a989 100644 --- a/src/test/java/io/github/spannm/jackcess/test/source/TestDbSource.java +++ b/src/test/java/io/github/spannm/jackcess/test/source/TestDbSource.java @@ -40,7 +40,7 @@ */ Basename[] value() default {}; - static class TestDbArgumentsProvider implements ArgumentsProvider { + class TestDbArgumentsProvider implements ArgumentsProvider { /** Charset for access 97 databases. */ private static final Charset ACC97_CHARSET = Charset.forName("windows-1252");