diff options
author | Felix Kehrer <felix.kehrer@gmail.com> | 2018-05-25 21:55:39 +0200 |
---|---|---|
committer | Tharre <tharre3@gmail.com> | 2018-05-27 14:07:11 +0200 |
commit | 247b0bf9f2b5f503d6bd494df7c4c18db5ead7e4 (patch) | |
tree | 4b35c4a461096ba43ba546e242e91a2fed7e9c99 /src/main | |
parent | dc9955610a07f5522237f14d18798e98eaec7850 (diff) | |
download | sepm-groupproject-247b0bf9f2b5f503d6bd494df7c4c18db5ead7e4.tar.gz sepm-groupproject-247b0bf9f2b5f503d6bd494df7c4c18db5ead7e4.tar.xz sepm-groupproject-247b0bf9f2b5f503d6bd494df7c4c18db5ead7e4.zip |
changed InvalidXExceptions to return a valid german message #27033
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java index 3c3b91c..853e499 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/OperationServiceImpl.java @@ -50,17 +50,17 @@ public class OperationServiceImpl implements OperationService { public long add(Operation o) throws InvalidOperationException, ServiceException { if (o.created() != null) { LOG.info("Invalid Operation: Created must be null"); - throw new InvalidOperationException("Created must not be set"); + throw new InvalidOperationException("Erstellungszeitpunkt darf nicht gesetzt sein"); } if (o.severity() != null) { LOG.info("Invalid Operation: Severity must be null"); - throw new InvalidOperationException("Severity must not be set"); + throw new InvalidOperationException("Der Schweregrad darf nicht gesetzt sein"); } if (o.id() != 0) { LOG.info("Invalid Operation: OperationId must be 0"); - throw new InvalidOperationException("Id must be 0"); + throw new InvalidOperationException("Einsatz-ID muss 0 sein"); } if (o.status() != Status.ACTIVE) @@ -85,7 +85,7 @@ public class OperationServiceImpl implements OperationService { throw new ServiceException(e); } catch (InvalidVehicleException e) { // already logged as invalid vehicle - throw new InvalidOperationException("Enthaltenes Fahrzeug ist invalid", e); + throw new InvalidOperationException("Enthaltenes Fahrzeug ist ungültig", e); } catch (ElementNotFoundException e) { LOG.error( "ElementNotFoundException while adding Operation. Message: {}", e.getMessage()); @@ -101,7 +101,7 @@ public class OperationServiceImpl implements OperationService { try { if (operationId <= 0) { LOG.info("Invalid Operation: OperationId is invalid (<= 0)"); - throw new InvalidOperationException("OperationId ist invalid"); + throw new InvalidOperationException("Einsatz-ID ist ungültig"); } Operation o = operationDAO.get(operationId); validateOperation(o); @@ -109,23 +109,23 @@ public class OperationServiceImpl implements OperationService { if (o.opCode().trim().isEmpty() || extractSeverityFromOpCode(o.opCode()) != o.severity()) { LOG.info("Invalid Operation: OpCode does not match Severity"); - throw new InvalidOperationException("Einsatzcode ist invalid"); + throw new InvalidOperationException("Einsatzcode ist ungültig"); } if (o.status() != Status.ACTIVE) { LOG.info("Invalid Operation: Operation is not active"); - throw new InvalidOperationException("Einsatz ist inaktiv"); + throw new InvalidOperationException("Einsatz ist ungültig"); } if (o.created() == null) { LOG.info("Invalid Operation: Created field is null"); - throw new InvalidOperationException("Created darf nicht leer sein"); + throw new InvalidOperationException("Erstellungszeitpunkt darf nicht leer sein"); } for (Long id : vehicleIds) { if (id <= 0) { LOG.info("Invalid Vehicle: VehicleId is not valid"); - throw new InvalidVehicleException("VehicleId ist invalid"); + throw new InvalidVehicleException("Fahrzeug-ID ist ungültig"); } try { @@ -152,7 +152,7 @@ public class OperationServiceImpl implements OperationService { LOG.error( "ElementNotFoundException while requesting Vehicles. Message: {}", e.getMessage()); - throw new InvalidOperationException("Kein Einsatz mit dieser id existiert"); + throw new InvalidOperationException("Kein Einsatz mit dieser ID existiert"); } catch (PersistenceException e) { LOG.error( "PersistenceException while requesting vehicles. Message: {}", e.getMessage()); |