Forum: JRuby Java Class losing its array attributes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hany Mesha (Guest)
on 2009-03-10 19:12
(Received via mailing list)
Hi all,


I'm working with JRuby 1.2RC1 where I ran into an issue that I don't
know
whether it's JRuby issue or otherwise so please be patient with me as I
explain the issue.

I have a ruby script calls a Java class that was generated by Axis2
which
uses xmlbeans v.2.3. I'm able to instantiate the class fine through it's
Factory inner class
<code>
begin
   geocodingInput =
ArrayOfRecognitionBaseInputType::Factory.newInstance()
           puts "geocoding input #{geocodingInput.class}"
rescue Exception => e
   puts e.backtrace
end
</code>

running the above I get the following output: geocoding input
Java::ComDmtispatialServicesTypesRecognitionBaseImpl::ArrayOfRecognitionBaseInputTypeImpl

which is correct however when I try to access the array elements, after
executing some code to populate the instance with data, through a method
on
the class by executing the following call

<code>
     puts "#{geocodingInput.getRecognitionBaseInputTypeArray()}"
</code>

I get the memory location of the object

[Lcom.dmtispatial.services.types.recognition.base.RecognitionBaseInputType;@67f797

P.S. the same code written straight in Java executs fine.

Am I missing something here or there's this is a bug?

If my question is not clear, please let me know and I'll send more
details.

Thanks,

-Hany Mesha

P Before printing this e-mail please consider if it's really necessary.
The
environment belongs to everybody
Charles Oliver N. (Guest)
on 2009-03-12 19:15
(Received via mailing list)
Hany Mesha wrote:
> Hi all,
>
>
> I'm working with JRuby 1.2RC1 where I ran into an issue that I don't
> know whether it's JRuby issue or otherwise so please be patient with me
> as I explain the issue.

I think we managed to resolve this for you on IRC, right? Can you
explain what the problem was?

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Hany Mesha (Guest)
on 2009-03-13 19:50
(Received via mailing list)
That's true Charlie.

The idea to reslove this issue was to use to_a on the Java array
instance to
get back an equivlant Ruby array instance that will then be able to
retrieve
or add elements to it.

Thanks all for your help.

-Hany

On Thu, Mar 12, 2009 at 1:13 PM, Charles Oliver N. <
removed_email_address@domain.invalid> wrote:

> I think we managed to resolve this for you on IRC, right? Can you explain
>
--
-Hany Mesha
Telephone : 416-456-6945
email: removed_email_address@domain.invalid

P Before printing this e-mail please consider if it's really necessary.
The
environment belongs to everybody
This topic is locked and can not be replied to.