serversigns / ServerSigns

ServerSigns (SVS) provides the ability to bind player-dispatched and server-disptached commands, messages and actions to signs and every other block in Minecraft.
https://dev.bukkit.org/projects/serversigns
GNU Affero General Public License v3.0
13 stars 13 forks source link

Plugin not loaded due to exception thrown during startup #14

Closed c-goldschmidt closed 4 years ago

c-goldschmidt commented 4 years ago

Looks like the embedded translation files are somewhat corrupt?

[14:38:50] [Server thread/WARN]:        at java.nio.charset.CoderResult.throwException(CoderResult.java:282)
[14:38:50] [Server thread/WARN]:        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:285)
[14:38:50] [Server thread/WARN]:        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
[14:38:50] [Server thread/WARN]:        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
[14:38:50] [Server thread/WARN]:        at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
[14:38:50] [Server thread/WARN]:        at java.io.BufferedWriter.write(BufferedWriter.java:230)
[14:38:50] [Server thread/WARN]:        at java.io.Writer.write(Writer.java:157)
[14:38:50] [Server thread/WARN]:        at de.czymm.serversigns.translations.MessageHandler.copyEmbedded(MessageHandler.java:165)
[14:38:50] [Server thread/WARN]:        at de.czymm.serversigns.translations.MessageHandler.<init>(MessageHandler.java:83)
[14:38:50] [Server thread/WARN]:        at de.czymm.serversigns.ServerSignsPlugin.loadConfig(ServerSignsPlugin.java:150)
[14:38:50] [Server thread/WARN]:        at de.czymm.serversigns.ServerSignsPlugin.onEnable(ServerSignsPlugin.java:89)
[14:38:50] [Server thread/WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263)
[14:38:50] [Server thread/WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:344)
[14:38:50] [Server thread/WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:416)
[14:38:50] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugin(CraftServer.java:448)
[14:38:50] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugins(CraftServer.java:374)
[14:38:50] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:447)
[14:38:50] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:253)
[14:38:50] [Server thread/WARN]:        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:761)
[14:38:50] [Server thread/WARN]:        at java.lang.Thread.run(Thread.java:748)
[14:38:50] [Server thread/WARN]:        Suppressed: java.nio.charset.UnmappableCharacterException: Input length = 1
[14:38:50] [Server thread/WARN]:                at java.nio.charset.CoderResult.throwException(CoderResult.java:282)
[14:38:50] [Server thread/WARN]:                at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:285)
[14:38:50] [Server thread/WARN]:                at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
[14:38:50] [Server thread/WARN]:                at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
[14:38:50] [Server thread/WARN]:                at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
[14:38:50] [Server thread/WARN]:                at java.io.BufferedWriter.close(BufferedWriter.java:265)
[14:38:50] [Server thread/WARN]:                at de.czymm.serversigns.translations.MessageHandler.$closeResource(MessageHandler.java:168)
[14:38:50] [Server thread/WARN]:                at de.czymm.serversigns.translations.MessageHandler.copyEmbedded(MessageHandler.java:168)
[14:38:50] [Server thread/WARN]:                ... 12 more
EpiCanard commented 4 years ago

Hello,

What is the value of config variable "language" ?

Someone got the same error one month ago. https://www.spigotmc.org/threads/serversigns.84210/page-11#post-3619505

It's a really strange bug, maybe one of files has the wrong file encoding.

I will try to reproduce the bug.

Best regards, EpiCanard

c-goldschmidt commented 4 years ago

@EpiCanard it's set to "en_default". Maybe it's worth mentioning that i am running my server on Ubuntu 16.04.6 LTS (in a VM)

[EDIT]

file -i en_default.yml
en_default.yml: text/plain; charset=us-ascii

the written file seems to be ascii encoded

EpiCanard commented 4 years ago

If you try to encode it in utf-8 ?

c-goldschmidt commented 4 years ago

That won't work as the files are rewritten on startup. Also it happens during writing the french file. It crashes as soon as the first non-ascii character is written to the file.

EpiCanard commented 4 years ago

It seems that defaultCharset you changed inside PR is affected by operating system

c-goldschmidt commented 4 years ago

Not only that, probably it's also affected by the system language, as i guess a french unbuntu would be able to output the french file. But yea, after the change it's always using UTF-8. You should maybe also check for other uses of defaultCharset, as on english systems this seems to be us-ascii by default. No idea if any other uses would try to write non-english text though, because i think they just write config, which contains only english data.

EpiCanard commented 4 years ago

Review done

EpiCanard commented 4 years ago

Merged, It will maybe take time before release I have a feature to finish first. Thanks for your contribution :)

EpiCanard commented 4 years ago

Fixed and released in v4.6.0