Home Bug Reports

IceRuby bug with propertyToProxy

ctennisctennis Member Caleb TennisOrganization: AEIProject: Project GINA ✭✭✭
I think this might be a bug with IceRuby and propertyToProxy. My irb session is below:

irb(main):001:0> require 'Ice'
=> true

irb(main):002:0> $ic = Ice::initialize
=> #<Ice::CommunicatorI:0xb771d2a4>

irb(main):003:0> prx = $ic.propertyToProxy("Foo")
RuntimeError: unknown Ice exception: IceUtil::NullHandleException
from /usr/lib/ruby/1.8/irb.rb:298:in `inspect'
from /usr/lib/ruby/1.8/irb.rb:298:in `output_value'
from /usr/lib/ruby/1.8/irb.rb:151:in `eval_input'
from /usr/lib/ruby/1.8/irb.rb:259:in `signal_status'
from /usr/lib/ruby/1.8/irb.rb:147:in `eval_input'
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement'
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop'
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement'
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch'
from /usr/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement'
from /usr/lib/ruby/1.8/irb.rb:146:in `eval_input'
from /usr/lib/ruby/1.8/irb.rb:70:in `start'
from /usr/lib/ruby/1.8/irb.rb:69:in `catch'
from /usr/lib/ruby/1.8/irb.rb:69:in `start'
from /usr/bin/irb:13
Maybe IRB bug!!

I noted that in C++, Ice doesn't throw an exception from propertyToProxy if the property isn't specified or is invalid, it just returns a null proxy.

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Caleb,

    Thanks for the bug report. A fix for this problem will be included in the next release. The problem occurs when you call propertyToProxy when the property does not exist. A similar bug exists in stringToProxy if you pass an empty string.

    You can work around these problems by validating your argument, i.e., do not call propertyToProxy unless the property exists. Alternatively, you can modify the Ice extension by editing Communicator.cpp and changing the function IceRuby_Communicator_propertyToProxy as shown below:
            ...
            Ice::ObjectPrx proxy = p->propertyToProxy(s);
            if(proxy)
            {
                return createProxy(proxy);
            }
    
    Take care,
    - Mark
  • ctennisctennis Member Caleb TennisOrganization: AEIProject: Project GINA ✭✭✭
    Thanks Mark - we'll just wait for the next release. It's pretty easy to workaround for the time being.
Sign In or Register to comment.