Pārlūkot izejas kodu

Added a check for an empty SASchedules in WaitForChargeParameterDiscoveryRes.java in case EVSEProcessing is set to FINISHED. In that case, SASchedules must be present.

Marc Mültin 7 gadi atpakaļ
vecāks
revīzija
56c88f910e

+ 5 - 2
RISE-V2G-EVCC/src/main/java/com/v2gclarity/risev2g/evcc/states/WaitForChargeParameterDiscoveryRes.java

@@ -61,7 +61,7 @@ public class WaitForChargeParameterDiscoveryRes extends ClientState {
 					(ChargeParameterDiscoveryResType) v2gMessageRes.getBody().getBodyElement().getValue();
 			
 			if (chargeParameterDiscoveryRes.getEVSEProcessing() == null)
-				return new TerminateSession("EVSEProcessing parameter of ChargeParameterDiscoveryRes is null. Parameter is mandatory.");
+				return new TerminateSession("EVSEProcessing field of ChargeParameterDiscoveryRes is null. This field is mandatory.");
 			
 			if (chargeParameterDiscoveryRes.getEVSEProcessing().equals(EVSEProcessingType.ONGOING)) {
 				getLogger().debug("EVSEProcessing was set to ONGOING");
@@ -80,7 +80,7 @@ public class WaitForChargeParameterDiscoveryRes extends ClientState {
 				}
 				
 				return getSendMessage(getCommSessionContext().getChargeParameterDiscoveryReq(), V2GMessages.CHARGE_PARAMETER_DISCOVERY_RES, Math.min((TimeRestrictions.V2G_EVCC_ONGOING_TIMEOUT - (int) elapsedTimeInMs), TimeRestrictions.getV2gEvccMsgTimeout(V2GMessages.CHARGE_PARAMETER_DISCOVERY_RES)));
-			} else {
+			} else {	
 				getLogger().debug("EVSEProcessing was set to FINISHED");
 				
 				getCommSessionContext().setOngoingTimer(0L);
@@ -117,6 +117,9 @@ public class WaitForChargeParameterDiscoveryRes extends ClientState {
 					 * - CurrentDemandRes
 					 */
 					
+					if (chargeParameterDiscoveryRes.getSASchedules() == null) 
+						return new TerminateSession("SASchedules field of ChargeParameterDiscoveryRes is null although EVSEProcessing is set to FINISHED. SASchedules is mandatory in this case.");
+					
 					SAScheduleListType saSchedules = (SAScheduleListType) chargeParameterDiscoveryRes.getSASchedules().getValue();
 					
 					// If TLS is used, verify each sales tariff (if present) with the mobility operator sub 2 certificate