[libvirt] [[PATCH libvirt-java]] Implement Connect.listAllDomains

Claudio Bley claudio.bley at gmail.com
Thu Nov 6 21:24:17 UTC 2014


Sorry for answering so late. But, nowadays, I only get to read emails
every other day, if at all.

At Mon, 03 Nov 2014 13:26:44 +0100,
Cedric Bosdonnat wrote:
> 
> Hello Claudio,
> 
> On Fri, 2014-10-31 at 23:40 +0100, Claudio Bley wrote:
> > At Sat, 25 Oct 2014 16:25:48 -0700,
> > Cédric Bosdonnat wrote:
> > I'd prefer an enum instead of these (ugly) constants.
> > 
> > As a side node, these constants are useless since the
> > ListAllDomainsFlags is not public.
> 
> Ok, I mimicked similar code in the Domain class... Just changed it to
> use an enum.

Good.

> > You leak the memory of the array here.
> 
> Arf, with all those Java things, I forgot about the hidden C pointers
> behind. I guess a
> 
> Library.free(domainsRef.getValue());
> 
> inside a finally block would do the trick.
> 
> In your other mail you mention freeing the domains pointers, but the
> only method that could throw an exception is virConnectListAllDomains...
> unless we need to catch also any other exception like those thrown by a
> new.

Yup, catching on "RuntimeException" and all other checked exceptions
(if any are thrown) should be good enough.

Claudio




More information about the libvir-list mailing list