EssentialsX

EssentialsX

2M Downloads

null message key causes blank line in console and log file

Bobcat00 opened this issue ยท 1 comments

commented

Type of bug

Other unexpected behaviour

/ess dump all output

https://essentialsx.net/dump.html?id=1a5680cbd1624985abb0c7674828cc93

Error log (if applicable)

No response

Bug description

I have the following in my messages_en.properties file:
whoisWhitelist=
When doing /eseen Th3Galacticwolf when the player is offline, I get the following output in the console and log file:

2024-02-27 17:24:57 [INFO] [Essentials] CONSOLE issued server command: /eseen Th3Galacticwolf
2024-02-27 17:24:57 [INFO] Player Th3Galacticwolf has been offline since 1 month 14 days 8 hours.
2024-02-27 17:24:57 [INFO]  - UUID: 03e28312-b2c8-40cb-899d-02ec09bbe1ad
2024-02-27 17:24:57 [INFO] 
2024-02-27 17:24:57 [INFO]  - Banned: Hacking attempts
2024-02-27 17:24:57 [INFO]  - Location: [redacted]
2024-02-27 17:24:57 [INFO]  - IP Address: [redacted]
2024-02-27 17:24:57 [INFO]  - Location: (plotworld, 226, 115, -246)

The blank line is where the whoisWhitelist output would appear. The blank line does not appear when the command is issued by a player in-game.

Cause seems to be missing checks for an empty string post-translation.

User.java has a check:

if (translation.trim().isEmpty()) {

A similar check is missing in CommandSource.java and Console.java:

final String translation = tlLiteral(tlKey, args);

final String translation = tlLiteral(tlKey, args);

I'm not sure if both those files need to be modified or not.

Steps to reproduce

  1. Set a message key for seen or whois to null.
  2. Issue a command to cause that message to be output.
  3. Observe a blank line for that message in the console and in the log file, but not in-game.

Expected behaviour

No blank line on the console or in the log file.

Actual behaviour

Blank line for that message in the console and in the log file, but not in-game.

commented

Can confirm. Thank you for pointing out a few specific areas in the code, it looks like those indeed need to be patched. Maybe other places too, but for now let's just do those two and we can fix any other instances that crop up if there are any.