On Nov 22, 2007 11:30 AM, Martin D. [email protected] wrote:
Could any one tell me the related exception in ruby. I am in process of
porting java methods. As java uses lots of inbuilt exception its very
difficult for me to port. could any one help me to tell the related
things in ruby
Unfortunately a matching will not be possible, I am not sure if the
following list does you any good
but in some situations similar exceptions might be raised in Ruby, it
of course depends a lot
of how you translate, I still maintain my statement from the other
tread, Java cannot be translated to Ruby as
such, you need to rethink the code, maybe the following examples show
better what I meant:
ArrayIndexOutOfBoundsException
IndexError, but this cannot be ported easily, it is
only raised in specific situations
e.g. x=[]; x[12] → nil
RuntimeException
same name
XmlPullParserException
depends on your XML Toolkit, unlikely to find a
correspondance
IllegalArgumentException
ParameterError
UnsupportedEncodingException
RobertHasNoClueException_SORRY ;)
IndexOutOfBoundsException
IndexError
IOException
IOError
EOFException
EOFError
NullPointerException
NoMethodError in some cases, there is no such thing
in reality, I assume that the receiver is
nil but you believe it is something else
ClassNotFoundException
depends on the context, NameError in some cases
ConcurrentModificationException (Iterators throw them)
I believe there is none
Thanks in advance
Posted via http://www.ruby-forum.com/.
Robert