Browse Source

The field 'ReceiptRequired' in the ChargingStatusRes message is optional. Fixed the code in EVCC's class WaitForChargingStatusRes.java so that it does not necessarily expect the field 'ReceiptRequired' to be set (otherwise a NullPointerException would be thrown). Also made sure that WaitForChargingStatusRes.java only sends a MeteringReceiptReq message if the connection is secured by TLS - as signed MeteringReceiptReq messages are only possible with Plug & Charge that demands TLS to be used.

Marc Mültin 7 years ago
parent
commit
cc26d2a239

+ 1 - 1
RISE-V2G-EVCC/src/main/java/com/v2gclarity/risev2g/evcc/states/WaitForChargingStatusRes.java

@@ -56,7 +56,7 @@ public class WaitForChargingStatusRes extends ClientState {
 			 * a MeteringReceiptRequest. If no TLS is used, a MeteringReceiptRequest may not be sent because
 			 * a signature cannot be applied without private key of the contract certificate.
 			 */
-			if (chargingStatusRes.isReceiptRequired() && getCommSessionContext().isTlsConnection()) {
+			if (chargingStatusRes.isReceiptRequired() != null & chargingStatusRes.isReceiptRequired() && getCommSessionContext().isTlsConnection()) {
 				MeteringReceiptReqType meteringReceiptReq = new MeteringReceiptReqType();
 				/*
 				 * Experience from the test symposium in San Diego (April 2016):

+ 1 - 1
RISE-V2G-EVCC/src/main/java/com/v2gclarity/risev2g/evcc/states/WaitForCurrentDemandRes.java

@@ -50,7 +50,7 @@ public class WaitForCurrentDemandRes extends ClientState {
 					(CurrentDemandResType) v2gMessageRes.getBody().getBodyElement().getValue();
 			
 			// ReceiptRequired has higher priority than a possible EVSENotification=Renegotiate
-			if (currentDemandRes.isReceiptRequired() != null && currentDemandRes.isReceiptRequired()) {
+			if (currentDemandRes.isReceiptRequired() != null && currentDemandRes.isReceiptRequired() && getCommSessionContext().isTlsConnection()) {
 				MeteringReceiptReqType meteringReceiptReq = new MeteringReceiptReqType();
 				/*
 				 * Experience from the test symposium in San Diego (April 2016):