Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ArithmeticException (0.98 sec)

  1. src/main/java/jcifs/util/InputValidator.java

         * @param operation the operation name
         * @throws ArithmeticException if operation would overflow
         */
        public static void validateIntegerAddition(int a, int b, String operation) {
            long result = (long) a + (long) b;
            if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) {
                throw new ArithmeticException(operation + " would cause integer overflow: " + a + " + " + b);
            }
        }
    Registered: Sat Dec 20 13:44:44 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 13.5K bytes
    - Viewed (0)
  2. src/test/java/jcifs/util/InputValidatorTest.java

            assertEquals(100, InputValidator.safeAdd(50, 50));
            assertEquals(0, InputValidator.safeAdd(-50, 50));
    
            assertThrows(ArithmeticException.class, () -> InputValidator.safeAdd(Integer.MAX_VALUE, 1));
            assertThrows(ArithmeticException.class, () -> InputValidator.safeAdd(Integer.MIN_VALUE, -1));
        }
    
        @Test
        @DisplayName("Test safe integer multiplication")
    Registered: Sat Dec 20 13:44:44 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 11.9K bytes
    - Viewed (0)
Back to top