Browse Source

Invoke super implementation instead of raising error

Anders Carling 10 years ago
parent
commit
3a5f213cca
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java

+ 2 - 2
ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java

@@ -218,7 +218,7 @@ public class RubyMessage extends RubyObject {
             IRubyObject oneofDescriptor = rubyDescriptor.lookupOneof(context, args[0]);
             if (oneofDescriptor.isNil()) {
                 if (!hasField(args[0])) {
-                    throw context.runtime.newNoMethodError("undefined method `" + args[0].toString() + "' for " + metaClass.toString(), args[0].asJavaString(),  metaClass);
+                    return Helpers.invokeSuper(context, this, metaClass, "method_missing", args, Block.NULL_BLOCK);
                 }
                 return index(context, args[0]);
             }
@@ -238,7 +238,7 @@ public class RubyMessage extends RubyObject {
             }
 
             if (!hasField(field)) {
-                throw context.runtime.newNoMethodError("undefined method `" + args[0].asJavaString() + "' for " + metaClass.toString(), args[0].asJavaString(),  metaClass);
+                return Helpers.invokeSuper(context, this, metaClass, "method_missing", args, Block.NULL_BLOCK);
             }
             return indexSet(context, field, args[1]);
         }