Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix JRUBY-5875: extending Struct and override initialize would make M…

…arshal fail

* Ruby 1.9 does not call initialize on unmarshaled structs.
  • Loading branch information...
commit d0c7547f4687d443bd6d4c6bff4f24f9865772b0 1 parent 8010b08
@headius headius authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/org/jruby/RubyStruct.java
View
9 src/org/jruby/RubyStruct.java
@@ -678,8 +678,15 @@ public static RubyStruct unmarshalFrom(UnmarshalStream input) throws java.io.IOE
}
// FIXME: This could all be more efficient, but it's how struct works
- RubyStruct result = newStruct(rbClass, values, Block.NULL_BLOCK);
+ RubyStruct result;
+ if (runtime.is1_9()) {
+ // 1.9 does not appear to call initialize (JRUBY-5875)
+ result = new RubyStruct(runtime, rbClass);
+ } else {
+ result = newStruct(rbClass, values, Block.NULL_BLOCK);
+ }
input.registerLinkTarget(result);
+
for(int i = 0; i < len; i++) {
IRubyObject slot = input.unmarshalObject(false);
if(!mem.eltInternal(i).toString().equals(slot.toString())) {
Please sign in to comment.
Something went wrong with that request. Please try again.