Skip to content

Commit 5c9ed92

Browse files
committed
Fix validation bug in fake OCPP 2.1 CSMS
The fake OCPP 2.1 CSMS checkConfirmation() implementation missed calling the super method for older protocol versions, causing the check to be omitted for these. Add the missing super call.
1 parent 5935ba9 commit 5c9ed92

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

ocpp-v2-test/src/main/java/eu/chargetime/ocpp/test/OCPP21MultiProtocolFakeCSMS.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,16 @@ public void sendGetVariablesRequest() {
8989

9090
@Override
9191
void checkConfirmation(Confirmation confirmation) {
92-
if (confirmation instanceof GetVariablesResponse) {
93-
GetVariablesResponse getVariablesResponse = (GetVariablesResponse) confirmation;
94-
if (getVariablesResponse.getGetVariableResult().length != 1) {
95-
throw new PropertyConstraintException(
96-
getVariablesResponse.getGetVariableResult().length,
97-
"GetVariablesResponse getVariableResult length must be 1");
92+
if (!OCPP2_1.equals(getDummyHandlers().getCurrentProtocolVersion())) {
93+
super.checkConfirmation(confirmation);
94+
} else {
95+
if (confirmation instanceof GetVariablesResponse) {
96+
GetVariablesResponse getVariablesResponse = (GetVariablesResponse) confirmation;
97+
if (getVariablesResponse.getGetVariableResult().length != 1) {
98+
throw new PropertyConstraintException(
99+
getVariablesResponse.getGetVariableResult().length,
100+
"GetVariablesResponse getVariableResult length must be 1");
101+
}
98102
}
99103
}
100104
}

0 commit comments

Comments
 (0)