Accept NULL for vehicle ID field (fix #3)
This commit is contained in:
parent
b9656b386a
commit
1698622fc9
@ -1,5 +1,6 @@
|
||||
## 1.1.3 [unreleased]
|
||||
## 1.1.4 [unreleased]
|
||||
* [fix] Fixed issue with direction ID as `String` instead if `Integer` (#2)
|
||||
* [fix] Fixed issue with vehicle ID being `null` (#3)
|
||||
|
||||
## 1.1.3 [2018-11-13]
|
||||
* [security] Updates Jackson dependency 2.9.4 to 2.9.7 (CVE-2018-7489)
|
||||
|
@ -204,6 +204,8 @@ public final class Trip implements Model {
|
||||
|| raw.get(VEHICLE_ID) instanceof Integer
|
||||
|| raw.get(VEHICLE_ID) instanceof Long) {
|
||||
vehicleID = raw.get(VEHICLE_ID).toString();
|
||||
} else if (raw.get(VEHICLE_ID) == null) { // Only fail of field is not NULL (#3).
|
||||
vehicleID = null;
|
||||
} else {
|
||||
throw Model.typeError(VEHICLE_ID, raw.get(VEHICLE_ID).getClass(), "String/Integer/Long");
|
||||
}
|
||||
@ -287,7 +289,7 @@ public final class Trip implements Model {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The vehicle ID.
|
||||
* @return The vehicle ID or {@code null} if not present.
|
||||
*/
|
||||
public String getVehicleID() {
|
||||
return vehicleID;
|
||||
|
@ -8,4 +8,4 @@
|
||||
[1,"Uniklinik","100600","H.3",0,50.7756388,6.04425,29,"10","3.B","1","Uniklinik-Ponttor-Hbf.","Uniklinik-Ponttor-Hbf.","347",92000053015001,1483363099000]
|
||||
[1,"Uniklinik","100600","H.1",0,50.7756388,6.04425,28,"3","3.A","1","Uniklinik-Schanz-Hbf.","Uniklinik-Schanz-Hbf.","325",92000288012001,1483363080000]
|
||||
[1,"Uniklinik","100600","H.2",0,50.7756388,6.04425,6,"70","70","1","Aachen Adenauerallee","Aachen Adenauerallee","588",92000225009001,1483363346000]
|
||||
[1,"Uniklinik","100600","H.1",0,50.7756388,6.04425,1,"3","3.A","1","Schanz-Hbf.-Ponttor","Schanz-Hbf.-Ponttor","325",92000288013001,1483363380000]
|
||||
[1,"Uniklinik","100600","H.1",0,50.7756388,6.04425,1,"3","3.A","1","Schanz-Hbf.-Ponttor","Schanz-Hbf.-Ponttor",null,92000288013001,1483363380000]
|
||||
|
Loading…
x
Reference in New Issue
Block a user