From: Jérôme Benoit Date: Wed, 25 Jan 2023 22:42:33 +0000 (+0100) Subject: Empty string handling fixes X-Git-Tag: v1.1.92~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=27e40a3b65c82807a3bf15a0e56b6f24fceb89f8;hp=c78355e4f754d07a9d150b10b11ad925946b5c5a;p=e-mobility-charging-stations-simulator.git Empty string handling fixes Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AuthorizedTagsCache.ts b/src/charging-station/AuthorizedTagsCache.ts index 5808f02b..a2b180e3 100644 --- a/src/charging-station/AuthorizedTagsCache.ts +++ b/src/charging-station/AuthorizedTagsCache.ts @@ -35,7 +35,7 @@ export default class AuthorizedTagsCache { file, null, (event, filename) => { - if (filename && event === 'change') { + if (!Utils.isEmptyString(filename) && event === 'change') { try { logger.debug( `${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload` diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index ddaff652..276c8368 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -511,7 +511,7 @@ export default class ChargingStation { this.templateFile, null, (event, filename): void => { - if (filename && event === 'change') { + if (!Utils.isEmptyString(filename) && event === 'change') { try { logger.debug( `${this.logPrefix()} ${FileType.ChargingStationTemplate} ${ diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 9b371d14..e73f4d50 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -210,7 +210,7 @@ export class ChargingStationUtils { if (!Utils.isUndefined(template[key])) { logger.warn( `${logPrefix} Deprecated template key '${key}' usage in file '${templateFile}'${ - logMsgToAppend && `. ${logMsgToAppend}` + !Utils.isEmptyString(logMsgToAppend) && `. ${logMsgToAppend}` }` ); } diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 5df7bdc5..b1926e16 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -336,13 +336,13 @@ export default class Configuration { ) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage in section '${sectionName}'${ - logMsgToAppend && `. ${logMsgToAppend}` + logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}` }}` ); } else if (!Configuration.isUndefined(Configuration.getConfig()[key])) { console.error( chalk`{green ${Configuration.logPrefix()}} {red Deprecated configuration key '${key}' usage${ - logMsgToAppend && `. ${logMsgToAppend}` + logMsgToAppend.trim().length !== 0 && `. ${logMsgToAppend}` }}` ); }