Skip to content

Commit b9e437b

Browse files
committed
RootCauseFinder changed to runtime exceptions
1 parent f369ca1 commit b9e437b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

core-java-modules/core-java/src/main/java/com/baeldung/exceptions/RootCauseFinder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static class AgeCalculator {
3030
private AgeCalculator() {
3131
}
3232

33-
public static int calculateAge(String birthDate) throws CalculationException {
33+
public static int calculateAge(String birthDate) {
3434
if (birthDate == null || birthDate.isEmpty()) {
3535
throw new IllegalArgumentException();
3636
}
@@ -44,7 +44,7 @@ public static int calculateAge(String birthDate) throws CalculationException {
4444
}
4545
}
4646

47-
private static LocalDate parseDate(String birthDateAsString) throws DateParseException {
47+
private static LocalDate parseDate(String birthDateAsString) {
4848

4949
LocalDate birthDate;
5050
try {
@@ -62,14 +62,14 @@ private static LocalDate parseDate(String birthDateAsString) throws DateParseExc
6262

6363
}
6464

65-
static class CalculationException extends Exception {
65+
static class CalculationException extends RuntimeException {
6666

6767
CalculationException(DateParseException ex) {
6868
super(ex);
6969
}
7070
}
7171

72-
static class DateParseException extends Exception {
72+
static class DateParseException extends RuntimeException {
7373

7474
DateParseException(String input) {
7575
super(input);

0 commit comments

Comments
 (0)