org.jooq.exception.DataAccessException when adding a Unknown Charge Point with ChargeBox ID starting by a space
Checklist
- [ ] I checked other issues already, but found no answer/solution
- [ ] I checked the documentation and wiki, but found no answer/solution
- [ ] I am running the latest version and the issue still occurs
- [ ] I am sure that this issue is about SteVe (and not about the charging station software or something unrelated to SteVe)
Specifications
SteVe Version : 3.4.9
Operating system : Linux
JDK : 17
Database : MySQL 8.0
Expected Behavior
The unknown charge point is added.
Actual Behavior
Steps to Reproduce the Problem
- Create a new charge point with ChargeBox ID (ie:
TEST) - Create a new unknown charge point with the previous ChargeBox ID starting by a space (ie:
%20TEST) - Add the unknown charge point
Additional context
...
this is because String fields go through org.springframework.beans.propertyeditors.StringTrimmerEditor as registered here in order to sanitize and clean the input within the web/controller layer. this editor internally calls String.trim() which removes leading and trailing spaces.
i can understand the confusion because what you expect is not what you get but some input sanitation is necessary, don't you think? suggestion?
some input sanitation is necessary, don't you think? suggestion?
Yes, I totally agree it is often good that human inputs are sanitized. I think it is also part of the business logic and could be better placed near the business code.
Space is a legit char for chargebox id and I didn't find any exceptions for the first or last char.

I think the design issue here and #836 is the inconsistency in the way the chargebox id is managed between the ocpp part and the UI part.
My suggestion:
- if space is a good first/last char then it should be managed in the whole application
- if space is not a good first/last char then it should not be shown as an Unknown Charge Point (maybe HTTP 400 on the websocket connection).
WDYT?
this is because String fields go through org.springframework.beans.propertyeditors.StringTrimmerEditor as registered here in order to sanitize and clean the input within the web/controller layer. this editor internally calls String.trim() which removes leading and trailing spaces.
Does it mean passwords are trimmed too?
Does it mean passwords are trimmed too?
which passwords (plural) you mean? the sign in credentials of the web ui are not affected by this.
If password is kept as it, why not chargebox_id? At least, when it comes from a station event.