"Assertion failed: locale data for current locale must exist" when trying to use systemLocale

18 views
Skip to first unread message

Colin Bartolome

unread,
Apr 18, 2017, 9:51:50 PM4/18/17
to ceylon-users
For some reason, when I'm in Windows, I get this error when I try to use ceylon.locale::systemLocale:

Exception in thread "main" ceylon.language.AssertionError "Assertion failed: locale data for current locale must exist
    violated exists systemLocaleCache"
    at ceylon.locale.systemLocale_.get_(Locale.ceylon:187)
    at localeTest.run_.run(run.ceylon:8)
    at localeTest.run_.main(run.ceylon)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
    at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
    at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:68)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:105)
    at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:101)
    at ceylon.modules.Main.execute(Main.java:69)
    at ceylon.modules.Main.main(Main.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.jboss.modules.Module.run(Module.java:308)
    at org.jboss.modules.Main.main(Main.java:487)
    at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:355)
    at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547)
    at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38)
    at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31)
    at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:24)

When I print system.locale, it shows my locale as en-US. This error doesn't happen on my other computer, which is running Linux. Anybody else run into this before?

Gavin King

unread,
Apr 19, 2017, 2:04:15 AM4/19/17
to ceylon...@googlegroups.com
I've never seen that, and I don't have a Windows box here to test, but
I just improved the message from that assertion failure, to make it
easier to troubleshoot:

https://github.com/ceylon/ceylon-sdk/commit/6bc538e59d72cc006dc33bfc41c88f76c8907cc8
> --
> You received this message because you are subscribed to the Google Groups
> "ceylon-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ceylon-users...@googlegroups.com.
> To post to this group, send email to ceylon...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ceylon-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ceylon-users/abfd5671-bce1-4513-b8d9-805c6aea649b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Gavin King
ga...@ceylon-lang.org
http://profiles.google.com/gavin.king
http://ceylon-lang.org
http://hibernate.org
http://seamframework.org

Colin Bartolome

unread,
May 1, 2017, 3:58:16 PM5/1/17
to ceylon-users
I think I figured out what's causing the problem. In com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ModuleImpl.resourceByPath(), there's this line:

fullPath = JVMModuleUtil.quoteJavaKeywordsInFilename(fullPath);

That variable is "ceylon/locale/en-US.txt" before that line and "ceylon\\locale\\en-US.txt" after that line. A few lines down, that value is passed to RuntimeModuleLoader.getContents(), which eventually passes it to CachedTOCJar.containsFile(). That last method checks to see if the given path is in the CachedTOCJar.contents set. That set contains a list of paths that use forward slashes as the separator, so the check always fails.

As far as I can tell, JVMModuleUtil.quoteJavaKaywordsInFilename() is used in one other place and that place does this:

            String quotedFileName = JVMModuleUtil.quoteJavaKeywordsInFilename(fileName);
           
String entryName = handleResourceRoot(quotedFileName.replace(File.separatorChar, '/'));

Should JVMModuleUtil.quoteJavaKaywordsInFilename() just always use forward slashes?

Tako Schotanus

unread,
May 1, 2017, 4:41:07 PM5/1/17
to ceylon-users
Perhaps, but at least it should leave the slashes alone IMO.

-Tako

Colin Bartolome

unread,
May 1, 2017, 5:26:08 PM5/1/17
to ceylon-users, ta...@codejive.org
Now that I look again, it's because the path is converted to a File object, so it's not quite as simple as using a forward slash instead of File.separator. I'll file an issue, because this seems to completely break the ceylon.locale module in Windows. I'll also see if I can figure out a quick fix, since I'm currently on a Windows machine.

Colin Bartolome

unread,
May 1, 2017, 7:39:15 PM5/1/17
to ceylon-users
I couldn't make any headway on a quick fix. Filed here:

https://github.com/ceylon/ceylon/issues/7052
Reply all
Reply to author
Forward
0 new messages