Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransasctionEvent req w/o meterValues fails to be FormationViolation #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KSR-Yasuda
Copy link

TransactionEvent request with no meterValues property fails to be replied FormationViolation.

// Request to OCPP.Core
// Has no `meterValues` prop.
[
    2,
    "OCPP_MSG_3735759508",
    "TransactionEvent",
    {
        "eventType": "Started",
        "timestamp": "2022-12-31T23:00:06",
        "triggerReason": "CablePluggedIn",
        "seqNo": 6270,
        "transactionInfo": {
            "transactionId": "test-id"
        }
    }
]

// Response from OCPP.Core
[
    4,
    "OCPP_MSG_3735759508",
    "FormationViolation",
    "",
    {}
]
// `OCPP.Core.Server.dll` Log

info: OCPPMiddleware.OCPP20[0]
      OCPPMiddleware.Receive20 => OCPP-Message: Type=2 / ID=OCPP_MSG_3735759508 / Action=TransactionEvent)

fail: OCPP.Core.Server.ControllerOCPP20[0]
      TransactionEvent => Exception: Object reference not set to an instance of an object.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at OCPP.Core.Server.ControllerOCPP20.GetMeterValues(ICollection`1 meterValues, Double& meterKWH, Double& currentChargeKW, Double& stateOfCharge, Nullable`1& meterTime) in /xxxxxx/OCPP.Core/OCPP.Core.Server/ControllerOCPP20.TransactionEvent.cs:line 331
         at OCPP.Core.Server.ControllerOCPP20.HandleTransactionEvent(OCPPMessage msgIn, OCPPMessage msgOut) in /xxxxxx/OCPP.Core/OCPP.Core.Server/ControllerOCPP20.TransactionEvent.cs:line 60

meterValues prop of TransactionEvent req is optional, however, without it,
it fails in GetMeterValues() in foreach for meterValues of null-reference.

Besides, ahead of there, it can fail if ChargeTag ct is null, too.

At least, these two parts should be null-value considered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant