JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5852

Can't serialize RubyModule, subclass of RubyBasicObject, which extends Serializable

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.2
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 11.04
    • Number of attachments :
      0

      Description

      1. foo.rb

      require 'java'

      list = Java::JavaUtil::ArrayList.new
      list << Java::Null
      list << "foo"

      Marshal.dump(list, open('somenewfile','w'))

      1. IOError: org.jcodings.specific.UTF8Encoding
      2. marshal_dump at org/jruby/java/proxies/JavaProxy.java:366
      3. dump at org/jruby/RubyMarshal.java:96
      4. (root) at foo.rb:9

        Activity

        Hide
        Nick Sieger added a comment -

        I don't think we intend to support marshalling Java objects. It could be implemented using Serializable, but for now it is not implemented at all. Until it is, perhaps the error messaging should be better.

        Show
        Nick Sieger added a comment - I don't think we intend to support marshalling Java objects. It could be implemented using Serializable, but for now it is not implemented at all. Until it is, perhaps the error messaging should be better.
        Hide
        Nick Sieger added a comment -

        Ok, I was mistaken, this is implemented . The question is, what is Java::Null doing?

        Show
        Nick Sieger added a comment - Ok, I was mistaken, this is implemented . The question is, what is Java::Null doing?
        Hide
        Nick Sieger added a comment -

        As far as I can tell, Java::Null is a random synthesized Ruby module. So the problem is that you have a cycle like this:

        Marshal -> Serialize -> Marshal

        Even though our IRubyObject objects implement serialization, they may not be fully serializable. This appears to be the case. jcodings objects aren't serializable.

        I made a slight improvement to error messaging in d915e342.

        Show
        Nick Sieger added a comment - As far as I can tell, Java::Null is a random synthesized Ruby module. So the problem is that you have a cycle like this: Marshal -> Serialize -> Marshal Even though our IRubyObject objects implement serialization, they may not be fully serializable. This appears to be the case. jcodings objects aren't serializable. I made a slight improvement to error messaging in d915e342.

          People

          • Assignee:
            Thomas E Enebo
            Reporter:
            Joshua Hou
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: