Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalCharsetNameException: -Dfile.encoding=UTF-8UTF-8 #5273

Closed
matthiasr opened this issue Aug 3, 2018 · 1 comment · Fixed by #5277
Closed

IllegalCharsetNameException: -Dfile.encoding=UTF-8UTF-8 #5273

matthiasr opened this issue Aug 3, 2018 · 1 comment · Fixed by #5277
Milestone

Comments

@matthiasr
Copy link

Environment

Flags

-J-Dfile.encoding=UTF-8

The problem is with parsing this flag.

Versions affected

  • jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 10.0.1+10-Ubuntu-3ubuntu1 on 10.0.1+10-Ubuntu-3ubuntu1 +jit [linux-x86_64]
  • jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 OpenJDK 64-Bit Server VM 10.0.1+10-Ubuntu-3ubuntu1 on 10.0.1+10-Ubuntu-3ubuntu1 +jit [linux-x86_64]
  • jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 10.0.2+13 on 10.0.2+13 +jit [darwin-x86_64]

Presumably this affects 9.1.17.0 and 9.2.0.0 on all platforms that use the bash start script.

Platforms affected

Linux – for demonstration, I tested in the plain ubuntu Docker container, just installing openjdk-11-jdk and curl and then downloading the dist tarballs: Linux df62e87ad0af 4.9.93-boot2docker #1 SMP Thu May 10 16:27:54 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Darwin: Darwin mr-2.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 21 20:07:39 PDT 2018; root:xnu-3789.73.14~1/RELEASE_X86_64 x86_64

Installed or activated gems

none

Application/framework version (e.g. Rails, Sinatra)

none

Environment variables

none specifically, locale in the container is POSIX, on Darwin en_US.UTF-8.

Expected Behavior

JRuby honors the file.encoding set on the command line, as 9.1.16.0 does.

Actual Behavior

root@df62e87ad0af:/# ./jruby-9.1.16.0/bin/jruby -e "puts java.lang.System.getProperty('file.encoding')"
ANSI_X3.4-1968
root@df62e87ad0af:/# ./jruby-9.1.16.0/bin/jruby -J-Dfile.encoding=UTF-8 -e "puts java.lang.System.getProperty('file.encoding')"
UTF-8
root@df62e87ad0af:/# ./jruby-9.1.17.0/bin/jruby -e "puts java.lang.System.getProperty('file.encoding')"
ANSI_X3.4-1968
root@df62e87ad0af:/# ./jruby-9.1.17.0/bin/jruby -J-Dfile.encoding=UTF-8 -e "puts java.lang.System.getProperty('file.encoding')"
Error occurred during initialization of VM
java.nio.charset.IllegalCharsetNameException: -Dfile.encoding=UTF-8UTF-8
	at java.nio.charset.Charset.checkName(java.base/Charset.java:309)
	at java.nio.charset.Charset.lookup2(java.base/Charset.java:482)
	at java.nio.charset.Charset.lookup(java.base/Charset.java:462)
	at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:608)
	at sun.nio.cs.StreamEncoder.forOutputStreamWriter(java.base/StreamEncoder.java:56)
	at java.io.OutputStreamWriter.<init>(java.base/OutputStreamWriter.java:110)
	at java.io.PrintStream.<init>(java.base/PrintStream.java:110)
	at java.io.PrintStream.<init>(java.base/PrintStream.java:148)
	at java.lang.System.newPrintStream(java.base/System.java:1901)
	at java.lang.System.initPhase1(java.base/System.java:1976)

root@df62e87ad0af:/# ./jruby-9.2.0.0/bin/jruby -e "puts java.lang.System.getProperty('file.encoding')"
ANSI_X3.4-1968
root@df62e87ad0af:/# ./jruby-9.2.0.0/bin/jruby -J-Dfile.encoding=UTF-8 -e "puts java.lang.System.getProperty('file.encoding')"
Error occurred during initialization of VM
java.nio.charset.IllegalCharsetNameException: -Dfile.encoding=UTF-8UTF-8
	at java.nio.charset.Charset.checkName(java.base/Charset.java:309)
	at java.nio.charset.Charset.lookup2(java.base/Charset.java:482)
	at java.nio.charset.Charset.lookup(java.base/Charset.java:462)
	at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:608)
	at sun.nio.cs.StreamEncoder.forOutputStreamWriter(java.base/StreamEncoder.java:56)
	at java.io.OutputStreamWriter.<init>(java.base/OutputStreamWriter.java:110)
	at java.io.PrintStream.<init>(java.base/PrintStream.java:110)
	at java.io.PrintStream.<init>(java.base/PrintStream.java:148)
	at java.lang.System.newPrintStream(java.base/System.java:1901)
	at java.lang.System.initPhase1(java.base/System.java:1976)

I believe this is a regression, introduced in fda229c.

@matthiasr
Copy link
Author

cc @headius

@enebo enebo added this to the JRuby 9.2.1.0 milestone Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants