Objects returned from Java library call not fully unwrapped
-----------------------------------------------------------
Key: JRUBY-3816
URL: http://jira.codehaus.org/browse/JRUBY-3816
Project: JRuby
Issue Type: Bug
Components: Java Integration
Affects Versions: JRuby 1.3.1
Environment: Linux 2.6.29-custom-xs5.5.0.14 #1 SMP Thu Jun 25 11:49:59
BST 2009 i686 GNU/Linux
jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) Client VM
1.6.0_14) [i386-java]
Reporter: John Snowdon
A collection of objects returned from a call to the Java SVNKit library are not
fully unwrapped to their correct class, but are instead left as an array of
Java::JavaObject which must be manually converted to their correct Java class
(org.tmatesoft.svn.core.SVNDirEntry) via a call to Java.java_to_ruby(object).
Code to reproduce:
require "java"
import "org.tmatesoft.svn.core.SVNURL"
import "org.tmatesoft.svn.core.SVNDirEntry"
import "org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory"
import "org.tmatesoft.svn.core.auth.ISVNAuthenticationManager"
import "org.tmatesoft.svn.core.wc.SVNWCUtil"
import "org.tmatesoft.svn.core.SVNProperties"
username = "username"
password = "password"
url = "url"
davfactory = DAVRepositoryFactory.setup
davRepository = DAVRepositoryFactory.create(SVNURL.parseURIDecoded(url));
davAuthManager = SVNWCUtil.createDefaultAuthenticationManager(username,
password);
davRepository.setAuthenticationManager(davAuthManager)
entries = []
props = SVNProperties.new
entry = davRepository.getDir("", -1, props, entries)
entry.each {|e|
puts "class of object is " + e.class.to_s
puts "java class of object is " + e.java_class.to_s
er = Java.java_to_ruby(e)
puts "unwrapped class of object is " + er.class.to_s
}
Output is:
class of object is Java::JavaObject
java class of object is org.tmatesoft.svn.core.SVNDirEntry
unwrapped class of object is Java::OrgTmatesoftSvnCore::SVNDirEntry
The call to respository.getDir should return a Collection of SVNDirEntry
objects
(http://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email