RootCauseFinder changed to runtime exceptions
This commit is contained in:
parent
f369ca1b0b
commit
b9e437b77f
|
@ -30,7 +30,7 @@ public class RootCauseFinder {
|
||||||
private AgeCalculator() {
|
private AgeCalculator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int calculateAge(String birthDate) throws CalculationException {
|
public static int calculateAge(String birthDate) {
|
||||||
if (birthDate == null || birthDate.isEmpty()) {
|
if (birthDate == null || birthDate.isEmpty()) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class RootCauseFinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LocalDate parseDate(String birthDateAsString) throws DateParseException {
|
private static LocalDate parseDate(String birthDateAsString) {
|
||||||
|
|
||||||
LocalDate birthDate;
|
LocalDate birthDate;
|
||||||
try {
|
try {
|
||||||
|
@ -62,14 +62,14 @@ public class RootCauseFinder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static class CalculationException extends Exception {
|
static class CalculationException extends RuntimeException {
|
||||||
|
|
||||||
CalculationException(DateParseException ex) {
|
CalculationException(DateParseException ex) {
|
||||||
super(ex);
|
super(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class DateParseException extends Exception {
|
static class DateParseException extends RuntimeException {
|
||||||
|
|
||||||
DateParseException(String input) {
|
DateParseException(String input) {
|
||||||
super(input);
|
super(input);
|
||||||
|
|
Loading…
Reference in New Issue