From 4b77b0773e2060986094d06108ff7a45ef268752 Mon Sep 17 00:00:00 2001 From: Starlight220 <53231611+Starlight220@users.noreply.github.com> Date: Fri, 24 Apr 2020 07:27:48 +0300 Subject: [PATCH] [wpilibj] SensorUtil: change exception type (#2490) Use IllegalArgumentException instead of IndexOutOfBoundsException. --- .../edu/wpi/first/wpilibj/SensorUtil.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SensorUtil.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SensorUtil.java index 4f2b8b5bb8..22aa7bdea6 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/SensorUtil.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/SensorUtil.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -84,7 +84,7 @@ public final class SensorUtil { .append(kPCMModules) .append(", Requested: ") .append(moduleNumber); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -101,7 +101,7 @@ public final class SensorUtil { .append(kDigitalChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -118,7 +118,7 @@ public final class SensorUtil { .append(kRelayChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -135,7 +135,7 @@ public final class SensorUtil { .append(kPwmChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -152,7 +152,7 @@ public final class SensorUtil { .append(kAnalogInputChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -169,7 +169,7 @@ public final class SensorUtil { .append(kAnalogOutputChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -185,7 +185,7 @@ public final class SensorUtil { .append(kSolenoidChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -202,7 +202,7 @@ public final class SensorUtil { .append(kPDPChannels) .append(", Requested: ") .append(channel); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } } @@ -218,7 +218,7 @@ public final class SensorUtil { .append(kPDPModules) .append(", Requested: ") .append(module); - throw new IndexOutOfBoundsException(buf.toString()); + throw new IllegalArgumentException(buf.toString()); } }