Skip to content

Commit

Permalink
Merge pull request #13109 from DanielBoudreau/master
Browse files Browse the repository at this point in the history
OperationsPro catch type or road name exception
  • Loading branch information
danielb987 committed May 22, 2024
2 parents f97a832 + 6b036b3 commit ec9bfc4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ CarBuiltNameTooLong = Car ({0} {1}) built date ({2}) too long!
CarLocationNameTooLong = Car ({0} {1}) location name ({2}) too long!
CarTrackNameTooLong = Car ({0} {1}) track name ({2}) too long!
CarLocationDoesNotExist = Car ({0} {1}) location ({2}) does not exist!
CarRoadNameWrong = Car road name ({0}) line number {1} is not valid!
CarTypeNameWrong = Car type name ({0}) line number {1} is not valid!
#DoYouWantToCreateLoc = Do you want to create location ({0})?
DoYouWantToAutoCreateLoc = Do you want the program to automatically create new Locations?
CarTrackDoesNotExist = Car ({0} {1}) track ({2}) at location ({3}) does not exist!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,38 @@ public void run() {
JmriJOptionPane.ERROR_MESSAGE);
break;
}
if (carRoad.split(TrainCommon.HYPHEN)[0].length() > Control.max_len_string_attibute) {
JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarRoadNameTooLong",
carRoad, carNumber, carRoad),
Bundle.getMessage("carAttribute",
Control.max_len_string_attibute),
try {
if (carRoad.split(TrainCommon.HYPHEN)[0].length() > Control.max_len_string_attibute) {
JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarRoadNameTooLong",
carRoad, carNumber, carRoad),
Bundle.getMessage("carAttribute",
Control.max_len_string_attibute),
JmriJOptionPane.ERROR_MESSAGE);
break;
}
} catch (ArrayIndexOutOfBoundsException e) {
JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarRoadNameWrong",
carRoad, lineNum),
Bundle.getMessage("CarAttributeMissing"),
JmriJOptionPane.ERROR_MESSAGE);
log.error("Road ({}) name not valid line {}", carRoad, lineNum);
break;
}
if (carType.split(TrainCommon.HYPHEN)[0].length() > Control.max_len_string_attibute) {
JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarTypeNameTooLong",
carRoad, carNumber, carType),
Bundle.getMessage("carAttribute",
Control.max_len_string_attibute),
try {
if (carType.split(TrainCommon.HYPHEN)[0].length() > Control.max_len_string_attibute) {
JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarTypeNameTooLong",
carRoad, carNumber, carType),
Bundle.getMessage("carAttribute",
Control.max_len_string_attibute),
JmriJOptionPane.ERROR_MESSAGE);
break;
}
} catch (ArrayIndexOutOfBoundsException e) {
JmriJOptionPane.showMessageDialog(null, Bundle.getMessage("CarTypeNameWrong",
carType, lineNum),
Bundle.getMessage("CarAttributeMissing"),
JmriJOptionPane.ERROR_MESSAGE);
log.error("Type ({}) name not valid line {}", carType, lineNum);
break;
}
if (!InstanceManager.getDefault(CarTypes.class).containsName(carType)) {
Expand Down

0 comments on commit ec9bfc4

Please sign in to comment.