Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre2
    • Component/s: Windows
    • Labels:
      None
    • Environment:
      Windows7, jdk1.7.0_04
    • Number of attachments :
      0

      Description

      I've downloaded and unzipped jruby1.7.0preview1
      After that I've tried "jruby -e 'i = 1'" and have got NPE

      c:\ruby\jruby-1.7.0.preview1\bin>jruby -e 'i = 1'
      RubyEncoding.java:178:in `encode': java.lang.NullPointerException
      from RubyString.java:393:in `<init>'
      from RubyString.java:482:in `newString'
      from Ruby.java:3086:in `newString'
      from Ruby.java:1338:in `initCore'
      from Ruby.java:1206:in `bootstrap'
      from Ruby.java:1165:in `init'
      from Ruby.java:262:in `newInstance'
      from Main.java:248:in `internalRun'
      from Main.java:230:in `run'
      from Main.java:214:in `run'
      from Main.java:194:in `main'

      I've tried with both 32bits and 64bits jdk.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Interesting. Perhaps not finding a Charset for a specific encoding? Can you tell me more about your environment?

        In this particular code path, we are creating a new Ruby String from a Java String using the "local" encoding or UTF8 if that is null. Then we attempt to use the Charset associated with that encoding to encode the Java String into Ruby bytes:

                Encoding defaultEncoding = runtime.getEncodingService().getLocaleEncoding();
                if (defaultEncoding == null) defaultEncoding = UTF8;
        
                charset = defaultEncoding.getCharset();
                byte[] bytes = RubyEncoding.encode(value, charset);
        

        There are encodings for which we have no Charset. That's likely what's happening here.

        Perhaps you could try this on a Java 6 setup (assuming that runs ok) and we can see what encoding it is trying to use?

        require 'jruby'
        puts JRuby.runtime.encoding_service.locale_encoding
        
        Show
        Charles Oliver Nutter added a comment - Interesting. Perhaps not finding a Charset for a specific encoding? Can you tell me more about your environment? In this particular code path, we are creating a new Ruby String from a Java String using the "local" encoding or UTF8 if that is null. Then we attempt to use the Charset associated with that encoding to encode the Java String into Ruby bytes: Encoding defaultEncoding = runtime.getEncodingService().getLocaleEncoding(); if (defaultEncoding == null) defaultEncoding = UTF8; charset = defaultEncoding.getCharset(); byte[] bytes = RubyEncoding.encode(value, charset); There are encodings for which we have no Charset. That's likely what's happening here. Perhaps you could try this on a Java 6 setup (assuming that runs ok) and we can see what encoding it is trying to use? require 'jruby' puts JRuby.runtime.encoding_service.locale_encoding
        Hide
        Oleg Sukhodolsky added a comment -

        It looks like it is Windows-1252.

        C:\Users\Oleg.Sukhodolsky>java -version
        java version "1.6.0_32"
        Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
        Java HotSpot(TM) Client VM (build 20.7-b02, mixed mode, sharing)

        C:\Users\Oleg.Sukhodolsky>cd c:\ruby\jruby-1.7.0.preview1

        c:\ruby\jruby-1.7.0.preview1>cd bin

        c:\ruby\jruby-1.7.0.preview1\bin>irb
        irb(main):001:0> require 'jruby'
        => true
        irb(main):002:0> puts JRuby.runtime.encoding_service.locale_encoding
        Windows-1252
        => nil

        Show
        Oleg Sukhodolsky added a comment - It looks like it is Windows-1252. C:\Users\Oleg.Sukhodolsky>java -version java version "1.6.0_32" Java(TM) SE Runtime Environment (build 1.6.0_32-b05) Java HotSpot(TM) Client VM (build 20.7-b02, mixed mode, sharing) C:\Users\Oleg.Sukhodolsky>cd c:\ruby\jruby-1.7.0.preview1 c:\ruby\jruby-1.7.0.preview1>cd bin c:\ruby\jruby-1.7.0.preview1\bin>irb irb(main):001:0> require 'jruby' => true irb(main):002:0> puts JRuby.runtime.encoding_service.locale_encoding Windows-1252 => nil
        Hide
        Charles Oliver Nutter added a comment -

        Works ok for me on a US-localized Windows XP VM. I may have to just add some defensive null checks in this code path and hope that does it.

        Show
        Charles Oliver Nutter added a comment - Works ok for me on a US-localized Windows XP VM. I may have to just add some defensive null checks in this code path and hope that does it.
        Hide
        Charles Oliver Nutter added a comment -

        It also occurs to me that Windows-1252 should work ok here. Is this a standard Oracle Java install?

        Show
        Charles Oliver Nutter added a comment - It also occurs to me that Windows-1252 should work ok here. Is this a standard Oracle Java install?
        Hide
        Charles Oliver Nutter added a comment -

        Here's on my Windows system:

        C:\>jirb
        irb(main):001:0> require 'jruby'
        => true
        irb(main):002:0> puts JRuby.runtime.encoding_service.locale_encoding
        Windows-1252
        => nil
        irb(main):003:0> puts JRuby.runtime.encoding_service.locale_encoding.charset
        windows-1252
        => nil
        irb(main):004:0>
        

        Can you run the following so we can see what charsets your Java install supports?

        irb(main):007:0> puts java.nio.charset.Charset.available_charsets.map{|x| x.to_s
        }.sort
        ["Big5", #<Java::SunNioCsExt::Big5:0x6e7443>]
        ["Big5-HKSCS", #<Java::SunNioCsExt::Big5_HKSCS:0x140a4b5>]
        ["EUC-JP", #<Java::SunNioCsExt::EUC_JP:0x58da92>]
        ["EUC-KR", #<Java::SunNioCsExt::EUC_KR:0x1778db3>]
        ["GB18030", #<Java::SunNioCsExt::GB18030:0x19c25e8>]
        ["GB2312", #<Java::SunNioCsExt::EUC_CN:0x955cf3>]
        ["GBK", #<Java::SunNioCsExt::GBK:0x1360f8e>]
        ["IBM-Thai", #<Java::SunNioCsExt::IBM838:0x15f1201>]
        ["IBM00858", #<Java::SunNioCs::IBM858:0xd737ca>]
        ["IBM01140", #<Java::SunNioCsExt::IBM1140:0x7ea386>]
        ["IBM01141", #<Java::SunNioCsExt::IBM1141:0x5a40f>]
        ["IBM01142", #<Java::SunNioCsExt::IBM1142:0x120fbae>]
        ["IBM01143", #<Java::SunNioCsExt::IBM1143:0x15bd222>]
        ["IBM01144", #<Java::SunNioCsExt::IBM1144:0x10ab6fa>]
        ["IBM01145", #<Java::SunNioCsExt::IBM1145:0xebeb19>]
        ["IBM01146", #<Java::SunNioCsExt::IBM1146:0xa18af>]
        ["IBM01147", #<Java::SunNioCsExt::IBM1147:0x51c1ad>]
        ["IBM01148", #<Java::SunNioCsExt::IBM1148:0x79c429>]
        ["IBM01149", #<Java::SunNioCsExt::IBM1149:0x1e2a2c0>]
        ["IBM037", #<Java::SunNioCsExt::IBM037:0xd392d3>]
        ["IBM1026", #<Java::SunNioCsExt::IBM1026:0x1b6f764>]
        ["IBM1047", #<Java::SunNioCsExt::IBM1047:0x1f54855>]
        ["IBM273", #<Java::SunNioCsExt::IBM273:0xc8148f>]
        ["IBM277", #<Java::SunNioCsExt::IBM277:0x39afbd>]
        ["IBM278", #<Java::SunNioCsExt::IBM278:0x157a4ee>]
        ["IBM280", #<Java::SunNioCsExt::IBM280:0x688c5d>]
        ["IBM284", #<Java::SunNioCsExt::IBM284:0xec4446>]
        ["IBM285", #<Java::SunNioCsExt::IBM285:0x1107e52>]
        ["IBM297", #<Java::SunNioCsExt::IBM297:0x14736cd>]
        ["IBM420", #<Java::SunNioCsExt::IBM420:0x51001e>]
        ["IBM424", #<Java::SunNioCsExt::IBM424:0x343545>]
        ["IBM437", #<Java::SunNioCs::IBM437:0x1e33a92>]
        ["IBM500", #<Java::SunNioCsExt::IBM500:0x5da0b0>]
        ["IBM775", #<Java::SunNioCs::IBM775:0x6e248a>]
        ["IBM850", #<Java::SunNioCs::IBM850:0x9f2f25>]
        ["IBM852", #<Java::SunNioCs::IBM852:0x1b06d7d>]
        ["IBM855", #<Java::SunNioCs::IBM855:0x159836e>]
        ["IBM857", #<Java::SunNioCs::IBM857:0x4735c>]
        ["IBM860", #<Java::SunNioCsExt::IBM860:0x1060c96>]
        ["IBM861", #<Java::SunNioCsExt::IBM861:0x463e88>]
        ["IBM862", #<Java::SunNioCs::IBM862:0xe04c26>]
        ["IBM863", #<Java::SunNioCsExt::IBM863:0x667ed7>]
        ["IBM864", #<Java::SunNioCsExt::IBM864:0x16308ac>]
        ["IBM865", #<Java::SunNioCsExt::IBM865:0x996815>]
        ["IBM866", #<Java::SunNioCs::IBM866:0x312a17>]
        ["IBM868", #<Java::SunNioCsExt::IBM868:0x1bd744c>]
        ["IBM869", #<Java::SunNioCsExt::IBM869:0x181ab43>]
        ["IBM870", #<Java::SunNioCsExt::IBM870:0x7665b1>]
        ["IBM871", #<Java::SunNioCsExt::IBM871:0x8f9533>]
        ["IBM918", #<Java::SunNioCsExt::IBM918:0x15818dd>]
        ["ISO-2022-CN", #<Java::SunNioCsExt::ISO2022_CN:0xfb8996>]
        ["ISO-2022-JP", #<Java::SunNioCsExt::ISO2022_JP:0x11ebf1e>]
        ["ISO-2022-JP-2", #<Java::SunNioCsExt::ISO2022_JP_2:0xad032a>]
        ["ISO-2022-KR", #<Java::SunNioCsExt::ISO2022_KR:0x1eb9b15>]
        ["ISO-8859-1", #<#<Class:0x1a5519c>:0x169fe0a>]
        ["ISO-8859-13", #<Java::SunNioCs::ISO_8859_13:0x1dbc76d>]
        ["ISO-8859-15", #<Java::SunNioCs::ISO_8859_15:0x1ec234f>]
        ["ISO-8859-2", #<Java::SunNioCs::ISO_8859_2:0xbfcbfa>]
        ["ISO-8859-3", #<Java::SunNioCsExt::ISO_8859_3:0x92b5e6>]
        ["ISO-8859-4", #<Java::SunNioCs::ISO_8859_4:0x1903e34>]
        ["ISO-8859-5", #<Java::SunNioCs::ISO_8859_5:0x17591de>]
        ["ISO-8859-6", #<Java::SunNioCsExt::ISO_8859_6:0x1ad59b5>]
        ["ISO-8859-7", #<Java::SunNioCs::ISO_8859_7:0x6e8c5>]
        ["ISO-8859-8", #<Java::SunNioCsExt::ISO_8859_8:0x1ebe1e5>]
        ["ISO-8859-9", #<Java::SunNioCs::ISO_8859_9:0x18d7173>]
        ["JIS_X0201", #<Java::SunNioCsExt::JIS_X_0201:0x184178e>]
        ["JIS_X0212-1990", #<Java::SunNioCsExt::JIS_X_0212:0xce745b>]
        ["KOI8-R", #<Java::SunNioCs::KOI8_R:0x1eb0dfd>]
        ["KOI8-U", #<Java::SunNioCs::KOI8_U:0x121f357>]
        ["Shift_JIS", #<Java::SunNioCsExt::SJIS:0x635827>]
        ["TIS-620", #<Java::SunNioCsExt::TIS_620:0x1be6e23>]
        ["US-ASCII", #<Java::SunNioCs::US_ASCII:0x16932af>]
        ["UTF-16", #<#<Class:0x129608e>:0x1ae7f53>]
        ["UTF-16BE", #<#<Class:0x157f40a>:0x16f5a0>]
        ["UTF-16LE", #<#<Class:0x7cfb78>:0x1763895>]
        ["UTF-32", #<Java::SunNioCs::UTF_32:0x2fce9c>]
        ["UTF-32BE", #<Java::SunNioCs::UTF_32BE:0x1aa1e4d>]
        ["UTF-32LE", #<Java::SunNioCs::UTF_32LE:0x18e54e8>]
        ["UTF-8", #<#<Class:0x1c2b545>:0x72f8c>]
        ["X-UTF-32BE-BOM", #<Java::SunNioCs::UTF_32BE_BOM:0x50dd8d>]
        ["X-UTF-32LE-BOM", #<Java::SunNioCs::UTF_32LE_BOM:0x19db378>]
        ["windows-1250", #<Java::SunNioCs::MS1250:0x6d7f85>]
        ["windows-1251", #<Java::SunNioCs::MS1251:0x18f3d03>]
        ["windows-1252", #<Java::SunNioCs::MS1252:0x1bcc22a>]
        ["windows-1253", #<Java::SunNioCs::MS1253:0x26d26e>]
        ["windows-1254", #<Java::SunNioCs::MS1254:0x19238df>]
        ["windows-1255", #<Java::SunNioCsExt::MS1255:0x60d7ea>]
        ["windows-1256", #<Java::SunNioCsExt::MS1256:0x17f29c6>]
        ["windows-1257", #<Java::SunNioCs::MS1257:0xafa388>]
        ["windows-1258", #<Java::SunNioCsExt::MS1258:0x16ab38f>]
        ["windows-31j", #<Java::SunNioCsExt::MS932:0x17f2fe3>]
        ["x-Big5-HKSCS-2001", #<Java::SunNioCsExt::Big5_HKSCS_2001:0x35c6f>]
        ["x-Big5-Solaris", #<Java::SunNioCsExt::Big5_Solaris:0x509dc6>]
        ["x-EUC-TW", #<Java::SunNioCsExt::EUC_TW:0x15bd7c5>]
        ["x-IBM1006", #<Java::SunNioCsExt::IBM1006:0xee7d2a>]
        ["x-IBM1025", #<Java::SunNioCsExt::IBM1025:0xa6b6be>]
        ["x-IBM1046", #<Java::SunNioCsExt::IBM1046:0x5e3212>]
        ["x-IBM1097", #<Java::SunNioCsExt::IBM1097:0x69757f>]
        ["x-IBM1098", #<Java::SunNioCsExt::IBM1098:0x1adbf85>]
        ["x-IBM1112", #<Java::SunNioCsExt::IBM1112:0x12563c6>]
        ["x-IBM1122", #<Java::SunNioCsExt::IBM1122:0x1e44cc9>]
        ["x-IBM1123", #<Java::SunNioCsExt::IBM1123:0x12342d9>]
        ["x-IBM1124", #<Java::SunNioCsExt::IBM1124:0x113283f>]
        ["x-IBM1364", #<Java::SunNioCsExt::IBM1364:0x13192a1>]
        ["x-IBM1381", #<Java::SunNioCsExt::IBM1381:0x193fb44>]
        ["x-IBM1383", #<Java::SunNioCsExt::IBM1383:0x115cfb9>]
        ["x-IBM33722", #<Java::SunNioCsExt::IBM33722:0x19b264>]
        ["x-IBM737", #<Java::SunNioCs::IBM737:0x13fa6c5>]
        ["x-IBM833", #<Java::SunNioCsExt::IBM833:0x55afdd>]
        ["x-IBM834", #<Java::SunNioCsExt::IBM834:0x1b83ca2>]
        ["x-IBM856", #<Java::SunNioCsExt::IBM856:0x11afda9>]
        ["x-IBM874", #<Java::SunNioCs::IBM874:0x43a905>]
        ["x-IBM875", #<Java::SunNioCsExt::IBM875:0x15054f0>]
        ["x-IBM921", #<Java::SunNioCsExt::IBM921:0x1d414c5>]
        ["x-IBM922", #<Java::SunNioCsExt::IBM922:0x1617246>]
        ["x-IBM930", #<Java::SunNioCsExt::IBM930:0x1e8c241>]
        ["x-IBM933", #<Java::SunNioCsExt::IBM933:0xe68f59>]
        ["x-IBM935", #<Java::SunNioCsExt::IBM935:0x35d824>]
        ["x-IBM937", #<Java::SunNioCsExt::IBM937:0x5094ec>]
        ["x-IBM939", #<Java::SunNioCsExt::IBM939:0xe8a936>]
        ["x-IBM942", #<Java::SunNioCsExt::IBM942:0x104bddd>]
        ["x-IBM942C", #<Java::SunNioCsExt::IBM942C:0x63acc>]
        ["x-IBM943", #<Java::SunNioCsExt::IBM943:0x3b7044>]
        ["x-IBM943C", #<Java::SunNioCsExt::IBM943C:0x1a9fb56>]
        ["x-IBM948", #<Java::SunNioCsExt::IBM948:0x4f4560>]
        ["x-IBM949", #<Java::SunNioCsExt::IBM949:0x60a95>]
        ["x-IBM949C", #<Java::SunNioCsExt::IBM949C:0x156bbcf>]
        ["x-IBM950", #<Java::SunNioCsExt::IBM950:0x4b38f9>]
        ["x-IBM964", #<Java::SunNioCsExt::IBM964:0x7bd3c0>]
        ["x-IBM970", #<Java::SunNioCsExt::IBM970:0x1f12964>]
        ["x-ISCII91", #<Java::SunNioCsExt::ISCII91:0xdfb821>]
        ["x-ISO-2022-CN-CNS", #<Java::SunNioCsExt::ISO2022_CN_CNS:0x1de2bea>]
        ["x-ISO-2022-CN-GB", #<Java::SunNioCsExt::ISO2022_CN_GB:0x10d8215>]
        ["x-JIS0208", #<Java::SunNioCsExt::JIS_X_0208:0xcea9a9>]
        ["x-JISAutoDetect", #<Java::SunNioCsExt::JISAutoDetect:0x13cf8b2>]
        ["x-Johab", #<Java::SunNioCsExt::Johab:0x177ec7b>]
        ["x-MS932_0213", #<Java::SunNioCsExt::MS932_0213:0x10bc1d5>]
        ["x-MS950-HKSCS", #<Java::SunNioCsExt::MS950_HKSCS:0x67e8f5>]
        ["x-MS950-HKSCS-XP", #<Java::SunNioCsExt::MS950_HKSCS_XP:0x198f101>]
        ["x-MacArabic", #<Java::SunNioCsExt::MacArabic:0x33b0>]
        ["x-MacCentralEurope", #<Java::SunNioCsExt::MacCentralEurope:0xe9dfdb>]
        ["x-MacCroatian", #<Java::SunNioCsExt::MacCroatian:0x2e3a59>]
        ["x-MacCyrillic", #<Java::SunNioCsExt::MacCyrillic:0xf5f77>]
        ["x-MacDingbat", #<Java::SunNioCsExt::MacDingbat:0x217540>]
        ["x-MacGreek", #<Java::SunNioCsExt::MacGreek:0x1ae9aa5>]
        ["x-MacHebrew", #<Java::SunNioCsExt::MacHebrew:0xaa1162>]
        ["x-MacIceland", #<Java::SunNioCsExt::MacIceland:0x15abfe1>]
        ["x-MacRoman", #<Java::SunNioCsExt::MacRoman:0x10a9a1>]
        ["x-MacRomania", #<Java::SunNioCsExt::MacRomania:0x178cb51>]
        ["x-MacSymbol", #<Java::SunNioCsExt::MacSymbol:0x1855788>]
        ["x-MacThai", #<Java::SunNioCsExt::MacThai:0x2a6d5a>]
        ["x-MacTurkish", #<Java::SunNioCsExt::MacTurkish:0x2fd667>]
        ["x-MacUkraine", #<Java::SunNioCsExt::MacUkraine:0x1cc2562>]
        ["x-PCK", #<Java::SunNioCsExt::PCK:0x9788bf>]
        ["x-SJIS_0213", #<Java::SunNioCsExt::SJIS_0213:0x12d7308>]
        ["x-UTF-16LE-BOM", #<#<Class:0x16d5c52>:0xae8c0f>]
        ["x-euc-jp-linux", #<Java::SunNioCsExt::EUC_JP_LINUX:0x1a64af3>]
        ["x-eucJP-Open", #<Java::SunNioCsExt::EUC_JP_Open:0x14cce33>]
        ["x-iso-8859-11", #<Java::SunNioCsExt::ISO_8859_11:0x1e16a1c>]
        ["x-mswin-936", #<Java::SunNioCsExt::MS936:0x193eb05>]
        ["x-windows-50220", #<Java::SunNioCsExt::MS50220:0x4d2f21>]
        ["x-windows-50221", #<Java::SunNioCsExt::MS50221:0x177f01d>]
        ["x-windows-874", #<Java::SunNioCsExt::MS874:0x12b2d25>]
        ["x-windows-949", #<Java::SunNioCsExt::MS949:0x4fcfde>]
        ["x-windows-950", #<Java::SunNioCsExt::MS950:0xc1884e>]
        ["x-windows-iso2022jp", #<Java::SunNioCsExt::MSISO2022JP:0x1130699>]
        => nil
        
        Show
        Charles Oliver Nutter added a comment - Here's on my Windows system: C:\>jirb irb(main):001:0> require 'jruby' => true irb(main):002:0> puts JRuby.runtime.encoding_service.locale_encoding Windows-1252 => nil irb(main):003:0> puts JRuby.runtime.encoding_service.locale_encoding.charset windows-1252 => nil irb(main):004:0> Can you run the following so we can see what charsets your Java install supports? irb(main):007:0> puts java.nio.charset.Charset.available_charsets.map{|x| x.to_s }.sort ["Big5", #<Java::SunNioCsExt::Big5:0x6e7443>] ["Big5-HKSCS", #<Java::SunNioCsExt::Big5_HKSCS:0x140a4b5>] ["EUC-JP", #<Java::SunNioCsExt::EUC_JP:0x58da92>] ["EUC-KR", #<Java::SunNioCsExt::EUC_KR:0x1778db3>] ["GB18030", #<Java::SunNioCsExt::GB18030:0x19c25e8>] ["GB2312", #<Java::SunNioCsExt::EUC_CN:0x955cf3>] ["GBK", #<Java::SunNioCsExt::GBK:0x1360f8e>] ["IBM-Thai", #<Java::SunNioCsExt::IBM838:0x15f1201>] ["IBM00858", #<Java::SunNioCs::IBM858:0xd737ca>] ["IBM01140", #<Java::SunNioCsExt::IBM1140:0x7ea386>] ["IBM01141", #<Java::SunNioCsExt::IBM1141:0x5a40f>] ["IBM01142", #<Java::SunNioCsExt::IBM1142:0x120fbae>] ["IBM01143", #<Java::SunNioCsExt::IBM1143:0x15bd222>] ["IBM01144", #<Java::SunNioCsExt::IBM1144:0x10ab6fa>] ["IBM01145", #<Java::SunNioCsExt::IBM1145:0xebeb19>] ["IBM01146", #<Java::SunNioCsExt::IBM1146:0xa18af>] ["IBM01147", #<Java::SunNioCsExt::IBM1147:0x51c1ad>] ["IBM01148", #<Java::SunNioCsExt::IBM1148:0x79c429>] ["IBM01149", #<Java::SunNioCsExt::IBM1149:0x1e2a2c0>] ["IBM037", #<Java::SunNioCsExt::IBM037:0xd392d3>] ["IBM1026", #<Java::SunNioCsExt::IBM1026:0x1b6f764>] ["IBM1047", #<Java::SunNioCsExt::IBM1047:0x1f54855>] ["IBM273", #<Java::SunNioCsExt::IBM273:0xc8148f>] ["IBM277", #<Java::SunNioCsExt::IBM277:0x39afbd>] ["IBM278", #<Java::SunNioCsExt::IBM278:0x157a4ee>] ["IBM280", #<Java::SunNioCsExt::IBM280:0x688c5d>] ["IBM284", #<Java::SunNioCsExt::IBM284:0xec4446>] ["IBM285", #<Java::SunNioCsExt::IBM285:0x1107e52>] ["IBM297", #<Java::SunNioCsExt::IBM297:0x14736cd>] ["IBM420", #<Java::SunNioCsExt::IBM420:0x51001e>] ["IBM424", #<Java::SunNioCsExt::IBM424:0x343545>] ["IBM437", #<Java::SunNioCs::IBM437:0x1e33a92>] ["IBM500", #<Java::SunNioCsExt::IBM500:0x5da0b0>] ["IBM775", #<Java::SunNioCs::IBM775:0x6e248a>] ["IBM850", #<Java::SunNioCs::IBM850:0x9f2f25>] ["IBM852", #<Java::SunNioCs::IBM852:0x1b06d7d>] ["IBM855", #<Java::SunNioCs::IBM855:0x159836e>] ["IBM857", #<Java::SunNioCs::IBM857:0x4735c>] ["IBM860", #<Java::SunNioCsExt::IBM860:0x1060c96>] ["IBM861", #<Java::SunNioCsExt::IBM861:0x463e88>] ["IBM862", #<Java::SunNioCs::IBM862:0xe04c26>] ["IBM863", #<Java::SunNioCsExt::IBM863:0x667ed7>] ["IBM864", #<Java::SunNioCsExt::IBM864:0x16308ac>] ["IBM865", #<Java::SunNioCsExt::IBM865:0x996815>] ["IBM866", #<Java::SunNioCs::IBM866:0x312a17>] ["IBM868", #<Java::SunNioCsExt::IBM868:0x1bd744c>] ["IBM869", #<Java::SunNioCsExt::IBM869:0x181ab43>] ["IBM870", #<Java::SunNioCsExt::IBM870:0x7665b1>] ["IBM871", #<Java::SunNioCsExt::IBM871:0x8f9533>] ["IBM918", #<Java::SunNioCsExt::IBM918:0x15818dd>] ["ISO-2022-CN", #<Java::SunNioCsExt::ISO2022_CN:0xfb8996>] ["ISO-2022-JP", #<Java::SunNioCsExt::ISO2022_JP:0x11ebf1e>] ["ISO-2022-JP-2", #<Java::SunNioCsExt::ISO2022_JP_2:0xad032a>] ["ISO-2022-KR", #<Java::SunNioCsExt::ISO2022_KR:0x1eb9b15>] ["ISO-8859-1", #<#<Class:0x1a5519c>:0x169fe0a>] ["ISO-8859-13", #<Java::SunNioCs::ISO_8859_13:0x1dbc76d>] ["ISO-8859-15", #<Java::SunNioCs::ISO_8859_15:0x1ec234f>] ["ISO-8859-2", #<Java::SunNioCs::ISO_8859_2:0xbfcbfa>] ["ISO-8859-3", #<Java::SunNioCsExt::ISO_8859_3:0x92b5e6>] ["ISO-8859-4", #<Java::SunNioCs::ISO_8859_4:0x1903e34>] ["ISO-8859-5", #<Java::SunNioCs::ISO_8859_5:0x17591de>] ["ISO-8859-6", #<Java::SunNioCsExt::ISO_8859_6:0x1ad59b5>] ["ISO-8859-7", #<Java::SunNioCs::ISO_8859_7:0x6e8c5>] ["ISO-8859-8", #<Java::SunNioCsExt::ISO_8859_8:0x1ebe1e5>] ["ISO-8859-9", #<Java::SunNioCs::ISO_8859_9:0x18d7173>] ["JIS_X0201", #<Java::SunNioCsExt::JIS_X_0201:0x184178e>] ["JIS_X0212-1990", #<Java::SunNioCsExt::JIS_X_0212:0xce745b>] ["KOI8-R", #<Java::SunNioCs::KOI8_R:0x1eb0dfd>] ["KOI8-U", #<Java::SunNioCs::KOI8_U:0x121f357>] ["Shift_JIS", #<Java::SunNioCsExt::SJIS:0x635827>] ["TIS-620", #<Java::SunNioCsExt::TIS_620:0x1be6e23>] ["US-ASCII", #<Java::SunNioCs::US_ASCII:0x16932af>] ["UTF-16", #<#<Class:0x129608e>:0x1ae7f53>] ["UTF-16BE", #<#<Class:0x157f40a>:0x16f5a0>] ["UTF-16LE", #<#<Class:0x7cfb78>:0x1763895>] ["UTF-32", #<Java::SunNioCs::UTF_32:0x2fce9c>] ["UTF-32BE", #<Java::SunNioCs::UTF_32BE:0x1aa1e4d>] ["UTF-32LE", #<Java::SunNioCs::UTF_32LE:0x18e54e8>] ["UTF-8", #<#<Class:0x1c2b545>:0x72f8c>] ["X-UTF-32BE-BOM", #<Java::SunNioCs::UTF_32BE_BOM:0x50dd8d>] ["X-UTF-32LE-BOM", #<Java::SunNioCs::UTF_32LE_BOM:0x19db378>] ["windows-1250", #<Java::SunNioCs::MS1250:0x6d7f85>] ["windows-1251", #<Java::SunNioCs::MS1251:0x18f3d03>] ["windows-1252", #<Java::SunNioCs::MS1252:0x1bcc22a>] ["windows-1253", #<Java::SunNioCs::MS1253:0x26d26e>] ["windows-1254", #<Java::SunNioCs::MS1254:0x19238df>] ["windows-1255", #<Java::SunNioCsExt::MS1255:0x60d7ea>] ["windows-1256", #<Java::SunNioCsExt::MS1256:0x17f29c6>] ["windows-1257", #<Java::SunNioCs::MS1257:0xafa388>] ["windows-1258", #<Java::SunNioCsExt::MS1258:0x16ab38f>] ["windows-31j", #<Java::SunNioCsExt::MS932:0x17f2fe3>] ["x-Big5-HKSCS-2001", #<Java::SunNioCsExt::Big5_HKSCS_2001:0x35c6f>] ["x-Big5-Solaris", #<Java::SunNioCsExt::Big5_Solaris:0x509dc6>] ["x-EUC-TW", #<Java::SunNioCsExt::EUC_TW:0x15bd7c5>] ["x-IBM1006", #<Java::SunNioCsExt::IBM1006:0xee7d2a>] ["x-IBM1025", #<Java::SunNioCsExt::IBM1025:0xa6b6be>] ["x-IBM1046", #<Java::SunNioCsExt::IBM1046:0x5e3212>] ["x-IBM1097", #<Java::SunNioCsExt::IBM1097:0x69757f>] ["x-IBM1098", #<Java::SunNioCsExt::IBM1098:0x1adbf85>] ["x-IBM1112", #<Java::SunNioCsExt::IBM1112:0x12563c6>] ["x-IBM1122", #<Java::SunNioCsExt::IBM1122:0x1e44cc9>] ["x-IBM1123", #<Java::SunNioCsExt::IBM1123:0x12342d9>] ["x-IBM1124", #<Java::SunNioCsExt::IBM1124:0x113283f>] ["x-IBM1364", #<Java::SunNioCsExt::IBM1364:0x13192a1>] ["x-IBM1381", #<Java::SunNioCsExt::IBM1381:0x193fb44>] ["x-IBM1383", #<Java::SunNioCsExt::IBM1383:0x115cfb9>] ["x-IBM33722", #<Java::SunNioCsExt::IBM33722:0x19b264>] ["x-IBM737", #<Java::SunNioCs::IBM737:0x13fa6c5>] ["x-IBM833", #<Java::SunNioCsExt::IBM833:0x55afdd>] ["x-IBM834", #<Java::SunNioCsExt::IBM834:0x1b83ca2>] ["x-IBM856", #<Java::SunNioCsExt::IBM856:0x11afda9>] ["x-IBM874", #<Java::SunNioCs::IBM874:0x43a905>] ["x-IBM875", #<Java::SunNioCsExt::IBM875:0x15054f0>] ["x-IBM921", #<Java::SunNioCsExt::IBM921:0x1d414c5>] ["x-IBM922", #<Java::SunNioCsExt::IBM922:0x1617246>] ["x-IBM930", #<Java::SunNioCsExt::IBM930:0x1e8c241>] ["x-IBM933", #<Java::SunNioCsExt::IBM933:0xe68f59>] ["x-IBM935", #<Java::SunNioCsExt::IBM935:0x35d824>] ["x-IBM937", #<Java::SunNioCsExt::IBM937:0x5094ec>] ["x-IBM939", #<Java::SunNioCsExt::IBM939:0xe8a936>] ["x-IBM942", #<Java::SunNioCsExt::IBM942:0x104bddd>] ["x-IBM942C", #<Java::SunNioCsExt::IBM942C:0x63acc>] ["x-IBM943", #<Java::SunNioCsExt::IBM943:0x3b7044>] ["x-IBM943C", #<Java::SunNioCsExt::IBM943C:0x1a9fb56>] ["x-IBM948", #<Java::SunNioCsExt::IBM948:0x4f4560>] ["x-IBM949", #<Java::SunNioCsExt::IBM949:0x60a95>] ["x-IBM949C", #<Java::SunNioCsExt::IBM949C:0x156bbcf>] ["x-IBM950", #<Java::SunNioCsExt::IBM950:0x4b38f9>] ["x-IBM964", #<Java::SunNioCsExt::IBM964:0x7bd3c0>] ["x-IBM970", #<Java::SunNioCsExt::IBM970:0x1f12964>] ["x-ISCII91", #<Java::SunNioCsExt::ISCII91:0xdfb821>] ["x-ISO-2022-CN-CNS", #<Java::SunNioCsExt::ISO2022_CN_CNS:0x1de2bea>] ["x-ISO-2022-CN-GB", #<Java::SunNioCsExt::ISO2022_CN_GB:0x10d8215>] ["x-JIS0208", #<Java::SunNioCsExt::JIS_X_0208:0xcea9a9>] ["x-JISAutoDetect", #<Java::SunNioCsExt::JISAutoDetect:0x13cf8b2>] ["x-Johab", #<Java::SunNioCsExt::Johab:0x177ec7b>] ["x-MS932_0213", #<Java::SunNioCsExt::MS932_0213:0x10bc1d5>] ["x-MS950-HKSCS", #<Java::SunNioCsExt::MS950_HKSCS:0x67e8f5>] ["x-MS950-HKSCS-XP", #<Java::SunNioCsExt::MS950_HKSCS_XP:0x198f101>] ["x-MacArabic", #<Java::SunNioCsExt::MacArabic:0x33b0>] ["x-MacCentralEurope", #<Java::SunNioCsExt::MacCentralEurope:0xe9dfdb>] ["x-MacCroatian", #<Java::SunNioCsExt::MacCroatian:0x2e3a59>] ["x-MacCyrillic", #<Java::SunNioCsExt::MacCyrillic:0xf5f77>] ["x-MacDingbat", #<Java::SunNioCsExt::MacDingbat:0x217540>] ["x-MacGreek", #<Java::SunNioCsExt::MacGreek:0x1ae9aa5>] ["x-MacHebrew", #<Java::SunNioCsExt::MacHebrew:0xaa1162>] ["x-MacIceland", #<Java::SunNioCsExt::MacIceland:0x15abfe1>] ["x-MacRoman", #<Java::SunNioCsExt::MacRoman:0x10a9a1>] ["x-MacRomania", #<Java::SunNioCsExt::MacRomania:0x178cb51>] ["x-MacSymbol", #<Java::SunNioCsExt::MacSymbol:0x1855788>] ["x-MacThai", #<Java::SunNioCsExt::MacThai:0x2a6d5a>] ["x-MacTurkish", #<Java::SunNioCsExt::MacTurkish:0x2fd667>] ["x-MacUkraine", #<Java::SunNioCsExt::MacUkraine:0x1cc2562>] ["x-PCK", #<Java::SunNioCsExt::PCK:0x9788bf>] ["x-SJIS_0213", #<Java::SunNioCsExt::SJIS_0213:0x12d7308>] ["x-UTF-16LE-BOM", #<#<Class:0x16d5c52>:0xae8c0f>] ["x-euc-jp-linux", #<Java::SunNioCsExt::EUC_JP_LINUX:0x1a64af3>] ["x-eucJP-Open", #<Java::SunNioCsExt::EUC_JP_Open:0x14cce33>] ["x-iso-8859-11", #<Java::SunNioCsExt::ISO_8859_11:0x1e16a1c>] ["x-mswin-936", #<Java::SunNioCsExt::MS936:0x193eb05>] ["x-windows-50220", #<Java::SunNioCsExt::MS50220:0x4d2f21>] ["x-windows-50221", #<Java::SunNioCsExt::MS50221:0x177f01d>] ["x-windows-874", #<Java::SunNioCsExt::MS874:0x12b2d25>] ["x-windows-949", #<Java::SunNioCsExt::MS949:0x4fcfde>] ["x-windows-950", #<Java::SunNioCsExt::MS950:0xc1884e>] ["x-windows-iso2022jp", #<Java::SunNioCsExt::MSISO2022JP:0x1130699>] => nil
        Hide
        Charles Oliver Nutter added a comment -
        commit ae453fe5582fafccdfb945eeab6c77297f28077e
        Author: Charles Oliver Nutter <headius@headius.com>
        Date:   Mon Jul 2 12:35:39 2012 -0500
        
            Fix JRUBY-6717
            
            jruby1.7.0preview1 doesn't work on Windows with jdk7
            
            On some Windows systems (such as the reporter's) it appears that
            the default Windows-1252 jcodings encoding does returns null for
            getCharset(). I'm not sure why, but in this particular path I
            believe it is safe to simply fall back on the Java default Charset
            for transcoding.
        
        :100644 100644 0166d57... a34e02a... M	src/org/jruby/RubyString.java
        
        Show
        Charles Oliver Nutter added a comment - commit ae453fe5582fafccdfb945eeab6c77297f28077e Author: Charles Oliver Nutter <headius@headius.com> Date: Mon Jul 2 12:35:39 2012 -0500 Fix JRUBY-6717 jruby1.7.0preview1 doesn't work on Windows with jdk7 On some Windows systems (such as the reporter's) it appears that the default Windows-1252 jcodings encoding does returns null for getCharset(). I'm not sure why, but in this particular path I believe it is safe to simply fall back on the Java default Charset for transcoding. :100644 100644 0166d57... a34e02a... M src/org/jruby/RubyString.java
        Hide
        Oleg Sukhodolsky added a comment -

        Just to add more information: I've tried on my another Windows7 machine and it looks like defaultEncoding is Windows-1251 and for this encoding (org.jcodings.specific.CP1251Encoding) getCharset() always returns null because Encoding.getCharset() looks like:

        public Charset getCharset() {
        if (!isDummy() && charset == null && getCharsetName() != null)

        { charset = Charset.forName(getCharsetName()); }

        return charset;
        }

        but getCharsetName() for the encoding returns null

        Hope this helps.

        BTW, the check you've added does resolve the problem, but I have a feeling that we may get the same NPE in some other place.

        Show
        Oleg Sukhodolsky added a comment - Just to add more information: I've tried on my another Windows7 machine and it looks like defaultEncoding is Windows-1251 and for this encoding (org.jcodings.specific.CP1251Encoding) getCharset() always returns null because Encoding.getCharset() looks like: public Charset getCharset() { if (!isDummy() && charset == null && getCharsetName() != null) { charset = Charset.forName(getCharsetName()); } return charset; } but getCharsetName() for the encoding returns null Hope this helps. BTW, the check you've added does resolve the problem, but I have a feeling that we may get the same NPE in some other place.
        Hide
        Dmitry Jemerov added a comment -

        FWIW it doesn't seem to be Java 7 specific. I'm running JDK 1.6.0_31 on a Windows 7 machine with windows-1251 default encoding, and I also see the same problem.
        By the way, isn't it something that needs to be fixed in jcodings rather than JRuby itself?

        Show
        Dmitry Jemerov added a comment - FWIW it doesn't seem to be Java 7 specific. I'm running JDK 1.6.0_31 on a Windows 7 machine with windows-1251 default encoding, and I also see the same problem. By the way, isn't it something that needs to be fixed in jcodings rather than JRuby itself?

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Oleg Sukhodolsky
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: