This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git


The following commit(s) were added to refs/heads/main by this push:
     new 86d77a0  Fix IDE warnings
86d77a0 is described below

commit 86d77a07611487d16bcd4b18db3af6e63804c917
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Sep 7 16:52:00 2026 +0100

    Fix IDE warnings
---
 .../java/org/apache/tomcat/jakartaee/AntHandlerTest.java | 16 ++++++++--------
 .../org/apache/tomcat/jakartaee/MigrationCacheTest.java  | 15 ++++++++++-----
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/src/test/java/org/apache/tomcat/jakartaee/AntHandlerTest.java 
b/src/test/java/org/apache/tomcat/jakartaee/AntHandlerTest.java
index bcf4e95..cb0d722 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/AntHandlerTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/AntHandlerTest.java
@@ -46,7 +46,7 @@ public class AntHandlerTest {
         handler.publish(record);
 
         assertEquals(1, testTask.logMessages.size());
-        assertEquals((int) Project.MSG_ERR, (int) testTask.logLevels.get(0));
+        assertEquals(Project.MSG_ERR, testTask.logLevels.get(0).intValue());
         assertEquals("Severe message", testTask.logMessages.get(0));
     }
 
@@ -57,7 +57,7 @@ public class AntHandlerTest {
         handler.publish(record);
 
         assertEquals(1, testTask.logMessages.size());
-        assertEquals((int) Project.MSG_WARN, (int) testTask.logLevels.get(0));
+        assertEquals(Project.MSG_WARN, testTask.logLevels.get(0).intValue());
         assertEquals("Warning message", testTask.logMessages.get(0));
     }
 
@@ -68,7 +68,7 @@ public class AntHandlerTest {
         handler.publish(record);
 
         assertEquals(1, testTask.logMessages.size());
-        assertEquals((int) Project.MSG_INFO, (int) testTask.logLevels.get(0));
+        assertEquals(Project.MSG_INFO, testTask.logLevels.get(0).intValue());
         assertEquals("Info message", testTask.logMessages.get(0));
     }
 
@@ -79,7 +79,7 @@ public class AntHandlerTest {
         handler.publish(record);
 
         assertEquals(1, testTask.logMessages.size());
-        assertEquals((int) Project.MSG_VERBOSE, (int) 
testTask.logLevels.get(0));
+        assertEquals(Project.MSG_VERBOSE, 
testTask.logLevels.get(0).intValue());
         assertEquals("Fine message", testTask.logMessages.get(0));
     }
 
@@ -90,7 +90,7 @@ public class AntHandlerTest {
         handler.publish(record);
 
         assertEquals(1, testTask.logMessages.size());
-        assertEquals((int) Project.MSG_DEBUG, (int) testTask.logLevels.get(0));
+        assertEquals(Project.MSG_DEBUG, testTask.logLevels.get(0).intValue());
         assertEquals("Finer message", testTask.logMessages.get(0));
     }
 
@@ -101,7 +101,7 @@ public class AntHandlerTest {
         handler.publish(record);
 
         assertEquals(1, testTask.logMessages.size());
-        assertEquals((int) Project.MSG_DEBUG, (int) testTask.logLevels.get(0));
+        assertEquals(Project.MSG_DEBUG, testTask.logLevels.get(0).intValue());
         assertEquals("Finest message", testTask.logMessages.get(0));
     }
 
@@ -179,14 +179,14 @@ public class AntHandlerTest {
         @Override
         public void log(String message, int level) {
             logMessages.add(message);
-            logLevels.add(level);
+            logLevels.add(Integer.valueOf(level));
             logThrown.add(null);
         }
 
         @Override
         public void log(String message, Throwable throwable, int level) {
             logMessages.add(message);
-            logLevels.add(level);
+            logLevels.add(Integer.valueOf(level));
             logThrown.add(throwable);
         }
 
diff --git a/src/test/java/org/apache/tomcat/jakartaee/MigrationCacheTest.java 
b/src/test/java/org/apache/tomcat/jakartaee/MigrationCacheTest.java
index 3e1f772..df5dcf3 100644
--- a/src/test/java/org/apache/tomcat/jakartaee/MigrationCacheTest.java
+++ b/src/test/java/org/apache/tomcat/jakartaee/MigrationCacheTest.java
@@ -249,7 +249,8 @@ public class MigrationCacheTest {
     @Test
     public void testCacheNullDirectory() throws Exception {
         try {
-            new MigrationCache(null, 30);
+            @SuppressWarnings("unused")
+            Object obj = new MigrationCache(null, 30);
             fail("Should throw IllegalArgumentException for null directory");
         } catch (IllegalArgumentException e) {
             assertTrue("Error message should mention null", 
e.getMessage().contains("null") || e.getMessage().contains("Null"));
@@ -262,7 +263,8 @@ public class MigrationCacheTest {
         Files.createFile(regularFile.toPath());
 
         try {
-            new MigrationCache(regularFile, 30);
+            @SuppressWarnings("unused")
+            Object obj = new MigrationCache(regularFile, 30);
             fail("Should throw IOException when path is not a directory");
         } catch (IOException e) {
             // Expected
@@ -336,7 +338,8 @@ public class MigrationCacheTest {
         assertTrue("Temp file should exist before cleanup", tempFile.exists());
 
         // Create cache - should clean up temp files
-        new MigrationCache(tempCacheDir, 30);
+        @SuppressWarnings("unused")
+        Object obj = new MigrationCache(tempCacheDir, 30);
 
         assertFalse("Temp file should be cleaned up on cache init", 
tempFile.exists());
     }
@@ -395,7 +398,8 @@ public class MigrationCacheTest {
         }
 
         // Should handle corrupt metadata gracefully
-        new MigrationCache(tempCacheDir, 30);
+        @SuppressWarnings("unused")
+        Object obj = new MigrationCache(tempCacheDir, 30);
     }
 
     @Test
@@ -409,7 +413,8 @@ public class MigrationCacheTest {
         }
 
         // Should handle invalid dates gracefully
-        new MigrationCache(tempCacheDir, 30);
+        @SuppressWarnings("unused")
+        Object obj = new MigrationCache(tempCacheDir, 30);
     }
 
     @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to