RubyString#toString() returns trimmed java.lang.String sequence when the given
sequence is malformed
----------------------------------------------------------------------------------------------------
Key: JRUBY-5519
URL: http://jira.codehaus.org/browse/JRUBY-5519
Project: JRuby
Issue Type: Task
Components: Core Classes/Modules
Affects Versions: JRuby 1.6RC2, JRuby-OSSL 0.7.3
Environment: jruby 1.6.0.RC2 (ruby 1.8.7 patchlevel 330) (2011-02-17
8f3eab6) (Java HotSpot(TM) 64-Bit Server VM 1.7.0-ea) [linux-amd64-java]
Reporter: Hiroshi Nakamura
To avoid things to be unnecessarily complexed, I talk about 1.8 mode only here.
Beside this, JRuby-OSSL doesn't support 1.9 mode now :-(
The commit [master 617654c2] *1 for 1.6.0.RC2 changed RubyString#decodeString()
(UTF8 decoding) to use 'new String(..., encname)' *2 instead of
Charset#decode(), and it affects JRuby-OSSL. From 1.6.0.RC2 the JRuby-OSSL
testsuite starts failing.
JRuby-OSSL is using RubyString#toString() which uses the
RubyString#decodeString(), to get java.lang.String. The String could be a
Base64 encoded ascii data (PEM format) or a binary data (DER format). And the
JRuby-OSSL test failures are for binary data handling.
Charset#decode() which is used before RC2 left unknown UTF8 bytes in decoded
String, but new String(..., encname) does not. According to *1 it is
'unspecified' but on my Ubuntu box, Open JDK 6, 7, J9 and JRockit R28.1 all
trims uknown bytes. So RubyString#toString() returns trimmed byte sequences
packed in java.lang.String from RC2 if JRuby-OSSL tries to handle DER
formatted data (a binary, looks malformed as an UTF8 string.)
JRuby-OSSL should fix to retrieve ByteList from RubyString and I would support
1.6 users to upgrade to newer JRuby-OSSL gem but other JRuby ext developers
would be affected as well I think. Signature RubyString#toString() looks too
promising for an ext developer, no? :-)
Tom, what do you think about this issue? (I'm asking Tom since git log says
you're the author of th
e commit)
*1
https://github.com/jruby/jruby/commit/617654c2da4fc793529fac7a8845b903ae1b6919
*2
http://download.oracle.com/javase/6/docs/api/java/lang/String.html#String(byte[],
int, int, java.lang.String)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email