> On June 6, 2014, 2:54 p.m., daan Hoogland wrote:
> > I was thinking of
> >
> > private void updateVlanUris(Connection conn) {
> > s_logger.debug("updating vlan URIs");
> > try(PreparedStatement selectstatement =
> > conn.prepareStatement("SELECT id, vlan_id FROM `cloud`.`vlan` where vlan_id
> > not like '%:%'");
> > ResultSet results = selectstatement.executeQuery()) {
> >
> > while (results.next()) {
> > long id = results.getLong(1);
> > String vlan = results.getString(2);
> > if (vlan == null || "".equals(vlan)) {
> > continue;
> > }
> > String vlanUri =
> > BroadcastDomainType.Vlan.toUri(vlan).toString();
> > try(PreparedStatement updatestatement =
> > conn.prepareStatement("update `cloud`.`vlan` set vlan_id=? where id=?");)
> > {
> > updatestatement.setString(1, vlanUri);
> > updatestatement.setLong(2, id);
> > updatestatement.executeUpdate();
> > updatestatement.close();
> > } catch (SQLException e) {
> > throw new CloudRuntimeException("Unable to update vlan
> > URI " + vlanUri + " for vlan record " + id, e);
> > }
> > }
> > } catch (SQLException e) {
> > throw new CloudRuntimeException("Unable to update vlan URIs ",
> > e);
> > }
> > s_logger.debug("Done updateing vlan URIs");
> > }
> >
> >
> > I am implementing such a thing for all methods in the update file
>
> Santhosh Edukulla wrote:
> Daan,
> 1. If exception happens before close EX: For updatestatement.close(),
> then updatstatement still not closed.
> 2. selectstatement is not closed yet. Is it a sort of contextlib of
> transaction, where it takes care of autoclose?
>
please read
http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
ad 1. I forgot to remove the close statement for updatestatement it should not
be there, thanks.
ad 2. yes it is closed see the read ref.
- daan
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/22305/#review44897
-----------------------------------------------------------
On June 6, 2014, 2:50 p.m., Santhosh Edukulla wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/22305/
> -----------------------------------------------------------
>
> (Updated June 6, 2014, 2:50 p.m.)
>
>
> Review request for cloudstack, daan Hoogland and Hugo Trippaers.
>
>
> Repository: cloudstack-git
>
>
> Description
> -------
>
> Fixed coverity issue for memory leak reported.
>
>
> Diffs
> -----
>
> engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java a3ac447
>
> Diff: https://reviews.apache.org/r/22305/diff/
>
>
> Testing
> -------
>
> Ran the build with developer profile, and deployed a zone.
>
>
> Thanks,
>
> Santhosh Edukulla
>
>