zDevelopers/UHPlugin

change lang in config.yml causes exceptions

chiu01 opened this issue · 3 comments

Environment

  • Minecraft version: 1.9.4
  • Plateform used: Paper Spigot
  • Bukkit or Spigot version: paper-750 (latest)
  • Plugin version: UHCReloaded-1.3-SNAPSHOT.jar
  • Plugin build number: #357 (2016/5/22 上午 09:41:41)

Problem description

change lang to zh_CN, or en_US or fr_FR cause exception list below:

[03:05:00 ERROR]: [Craft Scheduler Thread - 0] Invalid plural script for language : “n !”
[03:05:00 ERROR]: [Craft Scheduler Thread - 0] Exception : 
javax.script.ScriptException: <eval>:1:2 Expected ; but found !
n !
  ^ in <eval> at line number 1 at column number 2
        at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467) ~[n
ashorn.jar:?]
        at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:534) ~[nashorn.jar:
?]
        at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:521) ~[nashorn.jar:
?]
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:399) ~[nashorn.jar:?]
        at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155) ~[nashorn.jar:?]
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) ~[?:1.8.0_91]
        at eu.carrade.amaury.UHCReloaded.zlib.components.i18n.translators.gettext.GettextPOTranslator.getPluralIn
dex(GettextPOTranslator.java:100) [UHCReloaded-1.3-SNAPSHOT.jar:?]
        at eu.carrade.amaury.UHCReloaded.zlib.components.i18n.translators.Translator.translate(Translator.java:96
) [UHCReloaded-1.3-SNAPSHOT.jar:?]
        at eu.carrade.amaury.UHCReloaded.zlib.components.i18n.I18n.translate(I18n.java:561) [UHCReloaded-1.3-SNAP
SHOT.jar:?]
        at eu.carrade.amaury.UHCReloaded.zlib.components.i18n.I.tn(I.java:109) [UHCReloaded-1.3-SNAPSHOT.jar:?]
        at eu.carrade.amaury.UHCReloaded.scoreboard.GameSidebar.preRender(GameSidebar.java:149) [UHCReloaded-1.3-
SNAPSHOT.jar:?]
        at eu.carrade.amaury.UHCReloaded.zlib.components.scoreboard.Sidebar.refresh(Sidebar.java:277) [UHCReloade
d-1.3-SNAPSHOT.jar:?]
        at eu.carrade.amaury.UHCReloaded.zlib.components.scoreboard.Sidebar$1.run(Sidebar.java:342) [UHCReloaded-
1.3-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_9_R2.scheduler.CraftTask.run(CraftTask.java:58) [patched_1.9.4.jar:git-Paper
-750]
        at org.bukkit.craftbukkit.v1_9_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53) [patched_1.9.4.jar
:git-Paper-750]
        at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) [
patched_1.9.4.jar:git-Paper-750]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]
Caused by: jdk.nashorn.internal.runtime.ParserException: <eval>:1:2 Expected ; but found !
n !
  ^
        at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:292) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.AbstractParser.error(AbstractParser.java:277) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.AbstractParser.expectDontAdvance(AbstractParser.java:348) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.AbstractParser.expect(AbstractParser.java:335) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.endOfLine(Parser.java:3372) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.expressionStatement(Parser.java:1160) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.statement(Parser.java:967) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.sourceElements(Parser.java:773) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.program(Parser.java:709) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.parse(Parser.java:283) ~[nashorn.jar:?]
        at jdk.nashorn.internal.parser.Parser.parse(Parser.java:249) ~[nashorn.jar:?]
        at jdk.nashorn.internal.runtime.Context.compile(Context.java:1286) ~[nashorn.jar:?]
        at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1253) ~[nashorn.jar:?]        
        at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:625) ~[nashorn.jar:?]
        at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:532) ~[nashorn.jar:
?]
        ... 17 more

Steps to reproduce

stop server
start server
exception occurs

zLib related.

I already seen this problem once, but only once and I was not able to explain exactly how it occurs. Can I know your Java version, distribution (OpenJDK or Oracle); also, did you experienced encoding issues?

Thanks.

My environment:

  • OS Debian 3.16.7-ckt20-1+deb8u3~bpo70+1 (2016-01-19) x86_64 GNU/Linux
  • JDK Oracle JDK 1.8.0_91 Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
  • run on term set | grep LANG, got:
    LANG=en_US.UTF-8, the .po files are UTF-8 encoded and i can see chinese there.

pastebin log [http://pastebin.com/ySnBhfpi]

Thanks; I'll try to understand then fix the problem.