[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Re: Release of libvirt-java-0.2.0



On Mon, Jul 21, 2008 at 09:12:51PM +0200, Tóth István wrote:
> I've finally  hunted down the problem.

  haha :-)

> It stems from the way we (I) handle errors, and is not openAuth 
> specific, it just triggered here.
> 
> When the virConnectOpen* function encounters an error, it calls the 
> error handler we set in the initializer, which in turn handles the 
> error, and sets a java exception, but DOES NOT RETURN to java land.

  okay

> Next, we try to get the error, which seems to have been cleared after 
> calling the handler. (The deleted code was plain broken anyway, because 
> the error struct is allocated by the virCopyLastError, not the caller), 
> Then we call our error handler function with the uninitialized junk 
> error object, which results in interesting errors.

  oh, right copying over uninitialized data

> The solution is quite simple, we simply need to return if we are 
> unsuccessful (get NULL vc), and the previously set exception is 
> magically thrown.

  Okay i see the patch, and applying it makes things work as expected:

wei:~/libvirt-java/src -> java -classpath .:/usr/share/java/libvirt-0.2.0.jar test
exception caught:org.libvirt.LibvirtException: Connection refused
level:VIR_ERR_ERROR
code:VIR_ERR_SYSTEM_ERROR
domain:VIR_FROM_REMOTE
hasConn:false
hasDom:false
hasNet:false
message:Connection refused
str1:%s
str2:Connection refused
str3:null
int1:0
int2:0

virNodeInfo.model:i686
 ....

Now I have to understand why test+tcp URL are not accepted but it's not a 
java binding issue, oh and find the double free you reported yesterday !

> Generally, we should be much more careful with handling errors and 
> exceptions, but 1.0 is a long way. :-)

  I'm commiting the fix, I just re-added the cast to jlong as we got a warning
otherwise, some of those jlong/pointer/int casts are fishy but as you say
1.0 is a long way :-)

  in the meantime, enjoy your vacations !

   thanks again,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]