great Rajani, I am having a look at Upgrade43to44 and will backport
the fix to all others that it applies to:
try(PreparedStatement selectstatement =
conn.prepareStatement("SELECT * FROM 1+1");
ResultSet results = selectstatement.executeQuery()) {
}without finally
On Fri, Jun 6, 2014 at 3:55 PM, Rajani Karuturi
<[email protected]> wrote:
> Hi All,
> Of the 1697 issues reported by coverity in the latest scan, about 187 are in
> upgrade###to###.java and many of them are due to RESOURCE_LEAKS because of
> not closing the pstmt properly.
> For ex:
> Resource leak on an exceptional path (RESOURCE_LEAK)
>
> 299 }
> 300 String vlanUri =
> BroadcastDomainType.Vlan.toUri(vlan).toString();
>>>> CID 1220837: Resource leak (RESOURCE_LEAK)
>>>> Overwriting "pstmt" in "pstmt = conn.prepareStatement("update
>>>> `cloud`.`vlan` set vlan_id=? where id=?")" leaks the resource that "pstmt"
>>>> refers to.
> 301 pstmt = conn.prepareStatement("update `cloud`.`vlan`
> set vlan_id=? where id=?");
> 302 pstmt.setString(1, vlanUri);
> 303 pstmt.setLong(2, id);
> 304 pstmt.executeUpdate();
> 305 }
> 306 } catch (SQLException e) {
> /engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java: 321 in
> com.cloud.upgrade.dao.Upgrade430to440.updateVlanUris(java.sql.Connection)()
> 315 pstmt.close();
> 316 }
> 317 } catch (SQLException e) {
> 318 }
> 319 }
>
> $ cut -d"," -f 12 < ./Outstanding+Defects.csv | grep
> "engine/schema/src/com/cloud/upgrade/dao/Upgrade" | sort | uniq -c | sort -n
> | awk '{t+=$1}END{print t,"total"}1'
> 1 /engine/schema/src/com/cloud/upgrade/dao/Upgrade2211to2212.java
> 1 /engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
> 1 /engine/schema/src/com/cloud/upgrade/dao/Upgrade306to307.java
> 1 /engine/schema/src/com/cloud/upgrade/dao/Upgrade30to301.java
> 1 /engine/schema/src/com/cloud/upgrade/dao/Upgrade40to41.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22Premium.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade2212to2213.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade2213to2214.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade225to226.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228Premium.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade228to229.java
> 2 /engine/schema/src/com/cloud/upgrade/dao/Upgrade229to2210.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade218to224DomainVlans.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade227to228.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade301to302.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade303to304.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
> 3 /engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
> 4 /engine/schema/src/com/cloud/upgrade/dao/Upgrade305to306.java
> 4 /engine/schema/src/com/cloud/upgrade/dao/Upgrade420to421.java
> 7 /engine/schema/src/com/cloud/upgrade/dao/Upgrade224to225.java
> 7 /engine/schema/src/com/cloud/upgrade/dao/Upgrade304to305.java
> 10 /engine/schema/src/com/cloud/upgrade/dao/Upgrade2214to30.java
> 12 /engine/schema/src/com/cloud/upgrade/dao/Upgrade302to40.java
> 13 /engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224.java
> 42 /engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java
> 48 /engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
> 187 total
>
> There are 3 new issues reported Upgrade430to440.java
>
> reviewers/contributors please take care to verify this.
>
> ~Rajani
>
>
>
--
Daan