Hi,
Please find the latest report on new defect(s) introduced to cloudstack found
with Coverity Scan.
17 new defect(s) introduced to cloudstack found with Coverity Scan.
55 defect(s), reported by Coverity Scan earlier, were marked fixed in the
recent build analyzed by Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 17 of 17 defect(s)
** CID 1114596: Class hierarchy inconsistencies (CALL_SUPER)
/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java: 475 in
com.cloud.bridge.io.DimeDelimitedInputStream.close()()
________________________________________________________________________________________________________
*** CID 1114596: Class hierarchy inconsistencies (CALL_SUPER)
/awsapi/src/com/cloud/bridge/io/DimeDelimitedInputStream.java: 475 in
com.cloud.bridge.io.DimeDelimitedInputStream.close()()
469 * This will take care of flushing any remaining data to the stream.
470 * Multiple calls to this method will result in the stream being
closed once
471 * and then all subsequent calls being ignored.
472 *
473 * @throws IOException if the stream could not be closed
474 */
>>> CID 1114596: Class hierarchy inconsistencies (CALL_SUPER)
>>> Missing call to "java.io.FilterInputStream.close()" (as is done
>>> elsewhere 5 out of 7 times).
475 public void close() throws IOException {
476 synchronized (this) {
477 if (closed)
478 return;
479 closed = true; //mark it closed.
480 }
** CID 1315774: Resource leaks (RESOURCE_LEAK)
/framework/db/src/com/cloud/utils/db/DbUtil.java: 257 in
com.cloud.utils.db.DbUtil.releaseGlobalLock(java.lang.String)()
________________________________________________________________________________________________________
*** CID 1315774: Resource leaks (RESOURCE_LEAK)
/framework/db/src/com/cloud/utils/db/DbUtil.java: 257 in
com.cloud.utils.db.DbUtil.releaseGlobalLock(java.lang.String)()
251 } catch (Throwable e) {
252 s_logger.error("RELEASE_LOCK() throws exception ", e);
253 } finally {
254 closeResultSet(rs);
255 closeStatement(pstmt);
256 closeConnection(conn);
>>> CID 1315774: Resource leaks (RESOURCE_LEAK)
>>> Variable "pstmt" going out of scope leaks the resource it refers to.
257 }
258 return false;
259 }
260
261 public static void closeResources(final Connection connection,
final Statement statement, final ResultSet resultSet) {
262
** CID 1315775: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 51 in
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
java.lang.String)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 52 in
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
java.lang.String)()
________________________________________________________________________________________________________
*** CID 1315775: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 51 in
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
java.lang.String)()
45 }
46 } catch (SQLException e) {
47 throw new CloudRuntimeException("Unable to fetch network
label from configuration", e);
48 } finally {
49 closeAutoCloseable(rs);
50 closeAutoCloseable(pstmt);
>>> CID 1315775: (RESOURCE_LEAK)
>>> Variable "pstmt" going out of scope leaks the resource it refers to.
51 }
52 return networkLabel;
53 }
54
55 protected long addPhysicalNetworkToZone(Connection conn, long
zoneId, String zoneName, String networkType, String vnet, Long domainId) {
56
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 52 in
com.cloud.upgrade.dao.Upgrade30xBase.getNetworkLabelFromConfig(java.sql.Connection,
java.lang.String)()
46 } catch (SQLException e) {
47 throw new CloudRuntimeException("Unable to fetch network
label from configuration", e);
48 } finally {
49 closeAutoCloseable(rs);
50 closeAutoCloseable(pstmt);
51 }
>>> CID 1315775: (RESOURCE_LEAK)
>>> Variable "pstmt" going out of scope leaks the resource it refers to.
52 return networkLabel;
53 }
54
55 protected long addPhysicalNetworkToZone(Connection conn, long
zoneId, String zoneName, String networkType, String vnet, Long domainId) {
56
57 String getNextNetworkSequenceSql = "SELECT value from
`cloud`.`sequence` where name='physical_networks_seq'";
** CID 1315776: Exceptional resource leaks (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 135 in
com.cloud.upgrade.dao.Upgrade30xBase.addTrafficType(java.sql.Connection, long,
java.lang.String, java.lang.String, java.lang.String, java.lang.String)()
________________________________________________________________________________________________________
*** CID 1315776: Exceptional resource leaks (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 135 in
com.cloud.upgrade.dao.Upgrade30xBase.addTrafficType(java.sql.Connection, long,
java.lang.String, java.lang.String, java.lang.String, java.lang.String)()
129 pstmtUpdate.executeUpdate();
130 pstmtUpdate.close();
131 } catch (SQLException e) {
132 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
133 } finally {
134 closeAutoCloseable(pstmtUpdate);
>>> CID 1315776: Exceptional resource leaks (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
135 }
136 }
137
138 protected void addDefaultSGProvider(Connection conn, long
physicalNetworkId, long zoneId, String networkType, boolean is304) {
139 PreparedStatement pstmtUpdate = null, pstmt2 = null;
140 try {
** CID 1315777: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 257 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNtwk_To_Ntwk_IP_Vlan(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 257 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNtwk_To_Ntwk_IP_Vlan(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 257 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNtwk_To_Ntwk_IP_Vlan(java.sql.Connection,
long, long)()
________________________________________________________________________________________________________
*** CID 1315777: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 257 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNtwk_To_Ntwk_IP_Vlan(java.sql.Connection,
long, long)()
251 pstmtUpdate.executeUpdate();
252 pstmtUpdate.close();
253 } catch (SQLException e) {
254 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
255 } finally {
256 closeAutoCloseable(pstmtUpdate);
>>> CID 1315777: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
257 }
258
259 }
260
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 257 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNtwk_To_Ntwk_IP_Vlan(java.sql.Connection,
long, long)()
251 pstmtUpdate.executeUpdate();
252 pstmtUpdate.close();
253 } catch (SQLException e) {
254 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
255 } finally {
256 closeAutoCloseable(pstmtUpdate);
>>> CID 1315777: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
257 }
258
259 }
260
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 257 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNtwk_To_Ntwk_IP_Vlan(java.sql.Connection,
long, long)()
251 pstmtUpdate.executeUpdate();
252 pstmtUpdate.close();
253 } catch (SQLException e) {
254 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
255 } finally {
256 closeAutoCloseable(pstmtUpdate);
>>> CID 1315777: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
257 }
258
259 }
260
** CID 1315778: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 112 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNetworkToZone(java.sql.Connection,
long, java.lang.String, java.lang.String, java.lang.String, java.lang.Long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 112 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNetworkToZone(java.sql.Connection,
long, java.lang.String, java.lang.String, java.lang.String, java.lang.Long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 112 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNetworkToZone(java.sql.Connection,
long, java.lang.String, java.lang.String, java.lang.String, java.lang.Long)()
________________________________________________________________________________________________________
*** CID 1315778: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 112 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNetworkToZone(java.sql.Connection,
long, java.lang.String, java.lang.String, java.lang.String, java.lang.Long)()
106 return physicalNetworkId;
107 } catch (SQLException e) {
108 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
109 } finally {
110 closeAutoCloseable(pstmt2);
111 closeAutoCloseable(pstmtUpdate);
>>> CID 1315778: (RESOURCE_LEAK)
>>> Variable "pstmt2" going out of scope leaks the resource it refers to.
112 }
113 }
114
115 protected void addTrafficType(Connection conn, long
physicalNetworkId, String trafficType, String xenPublicLabel, String
kvmPublicLabel, String vmwarePublicLabel) {
116 // add traffic types
117 PreparedStatement pstmtUpdate = null;
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 112 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNetworkToZone(java.sql.Connection,
long, java.lang.String, java.lang.String, java.lang.String, java.lang.Long)()
106 return physicalNetworkId;
107 } catch (SQLException e) {
108 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
109 } finally {
110 closeAutoCloseable(pstmt2);
111 closeAutoCloseable(pstmtUpdate);
>>> CID 1315778: (RESOURCE_LEAK)
>>> Variable "pstmt2" going out of scope leaks the resource it refers to.
112 }
113 }
114
115 protected void addTrafficType(Connection conn, long
physicalNetworkId, String trafficType, String xenPublicLabel, String
kvmPublicLabel, String vmwarePublicLabel) {
116 // add traffic types
117 PreparedStatement pstmtUpdate = null;
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 112 in
com.cloud.upgrade.dao.Upgrade30xBase.addPhysicalNetworkToZone(java.sql.Connection,
long, java.lang.String, java.lang.String, java.lang.String, java.lang.Long)()
106 return physicalNetworkId;
107 } catch (SQLException e) {
108 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
109 } finally {
110 closeAutoCloseable(pstmt2);
111 closeAutoCloseable(pstmtUpdate);
>>> CID 1315778: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
112 }
113 }
114
115 protected void addTrafficType(Connection conn, long
physicalNetworkId, String trafficType, String xenPublicLabel, String
kvmPublicLabel, String vmwarePublicLabel) {
116 // add traffic types
117 PreparedStatement pstmtUpdate = null;
** CID 1315779: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 230 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultVRProvider(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 230 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultVRProvider(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 230 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultVRProvider(java.sql.Connection,
long, long)()
________________________________________________________________________________________________________
*** CID 1315779: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 230 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultVRProvider(java.sql.Connection,
long, long)()
224 pstmtUpdate.close();
225 } catch (SQLException e) {
226 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
227 } finally {
228 closeAutoCloseable(pstmt2);
229 closeAutoCloseable(pstmtUpdate);
>>> CID 1315779: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
230 }
231 }
232
233 protected void addPhysicalNtwk_To_Ntwk_IP_Vlan(Connection conn,
long physicalNetworkId, long networkId) {
234 PreparedStatement pstmtUpdate = null;
235 try {
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 230 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultVRProvider(java.sql.Connection,
long, long)()
224 pstmtUpdate.close();
225 } catch (SQLException e) {
226 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
227 } finally {
228 closeAutoCloseable(pstmt2);
229 closeAutoCloseable(pstmtUpdate);
>>> CID 1315779: (RESOURCE_LEAK)
>>> Variable "pstmt2" going out of scope leaks the resource it refers to.
230 }
231 }
232
233 protected void addPhysicalNtwk_To_Ntwk_IP_Vlan(Connection conn,
long physicalNetworkId, long networkId) {
234 PreparedStatement pstmtUpdate = null;
235 try {
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 230 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultVRProvider(java.sql.Connection,
long, long)()
224 pstmtUpdate.close();
225 } catch (SQLException e) {
226 throw new CloudRuntimeException("Exception while adding
PhysicalNetworks", e);
227 } finally {
228 closeAutoCloseable(pstmt2);
229 closeAutoCloseable(pstmtUpdate);
>>> CID 1315779: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
230 }
231 }
232
233 protected void addPhysicalNtwk_To_Ntwk_IP_Vlan(Connection conn,
long physicalNetworkId, long networkId) {
234 PreparedStatement pstmtUpdate = null;
235 try {
** CID 1315780: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 183 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultSGProvider(java.sql.Connection,
long, long, java.lang.String, boolean)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 183 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultSGProvider(java.sql.Connection,
long, long, java.lang.String, boolean)()
________________________________________________________________________________________________________
*** CID 1315780: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 183 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultSGProvider(java.sql.Connection,
long, long, java.lang.String, boolean)()
177
178 } catch (SQLException e) {
179 throw new CloudRuntimeException("Exception while adding
default Security Group Provider", e);
180 } finally {
181 closeAutoCloseable(pstmt2);
182 closeAutoCloseable(pstmtUpdate);
>>> CID 1315780: (RESOURCE_LEAK)
>>> Variable "pstmt2" going out of scope leaks the resource it refers to.
183 }
184 }
185
186 protected void addDefaultVRProvider(Connection conn, long
physicalNetworkId, long zoneId) {
187 PreparedStatement pstmtUpdate = null, pstmt2 = null;
188 try {
/engine/schema/src/com/cloud/upgrade/dao/Upgrade30xBase.java: 183 in
com.cloud.upgrade.dao.Upgrade30xBase.addDefaultSGProvider(java.sql.Connection,
long, long, java.lang.String, boolean)()
177
178 } catch (SQLException e) {
179 throw new CloudRuntimeException("Exception while adding
default Security Group Provider", e);
180 } finally {
181 closeAutoCloseable(pstmt2);
182 closeAutoCloseable(pstmtUpdate);
>>> CID 1315780: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
183 }
184 }
185
186 protected void addDefaultVRProvider(Connection conn, long
physicalNetworkId, long zoneId) {
187 PreparedStatement pstmtUpdate = null, pstmt2 = null;
188 try {
** CID 1315781: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 240 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxServiceProvider(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 241 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxServiceProvider(java.sql.Connection,
long, long)()
________________________________________________________________________________________________________
*** CID 1315781: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 240 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxServiceProvider(java.sql.Connection,
long, long)()
234 pstmtUpdate.setString(4, "Enabled");
235 pstmtUpdate.executeUpdate();
236 } catch (SQLException e) {
237 throw new CloudRuntimeException("Exception while adding
PhysicalNetworkServiceProvider JuniperSRX", e);
238 } finally {
239 closeAutoCloseable(pstmtUpdate);
>>> CID 1315781: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
240 }
241 }
242
243 private void encryptConfig(Connection conn) {
244 //Encrypt config params and change category to Hidden
245 s_logger.debug("Encrypting Config values");
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 241 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxServiceProvider(java.sql.Connection,
long, long)()
235 pstmtUpdate.executeUpdate();
236 } catch (SQLException e) {
237 throw new CloudRuntimeException("Exception while adding
PhysicalNetworkServiceProvider JuniperSRX", e);
238 } finally {
239 closeAutoCloseable(pstmtUpdate);
240 }
>>> CID 1315781: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
241 }
242
243 private void encryptConfig(Connection conn) {
244 //Encrypt config params and change category to Hidden
245 s_logger.debug("Encrypting Config values");
246 PreparedStatement pstmt = null;
** CID 1315782: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 192 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxFirewall(java.sql.Connection, long,
long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 193 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxFirewall(java.sql.Connection, long,
long)()
________________________________________________________________________________________________________
*** CID 1315782: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 192 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxFirewall(java.sql.Connection, long,
long)()
186 pstmtUpdate.setString(9, UUID.randomUUID().toString());
187 pstmtUpdate.executeUpdate();
188 } catch (SQLException e) {
189 throw new CloudRuntimeException("Exception while adding SRX
firewall device ", e);
190 } finally {
191 closeAutoCloseable(pstmtUpdate);
>>> CID 1315782: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
192 }
193 }
194
195 private void addF5ServiceProvider(Connection conn, long
physicalNetworkId, long zoneId) {
196 PreparedStatement pstmtUpdate = null;
197 try {
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 193 in
com.cloud.upgrade.dao.Upgrade302to303.addSrxFirewall(java.sql.Connection, long,
long)()
187 pstmtUpdate.executeUpdate();
188 } catch (SQLException e) {
189 throw new CloudRuntimeException("Exception while adding SRX
firewall device ", e);
190 } finally {
191 closeAutoCloseable(pstmtUpdate);
192 }
>>> CID 1315782: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
193 }
194
195 private void addF5ServiceProvider(Connection conn, long
physicalNetworkId, long zoneId) {
196 PreparedStatement pstmtUpdate = null;
197 try {
198 // add physical network service provider - F5BigIp
** CID 1315783: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 216 in
com.cloud.upgrade.dao.Upgrade302to303.addF5ServiceProvider(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 217 in
com.cloud.upgrade.dao.Upgrade302to303.addF5ServiceProvider(java.sql.Connection,
long, long)()
________________________________________________________________________________________________________
*** CID 1315783: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 216 in
com.cloud.upgrade.dao.Upgrade302to303.addF5ServiceProvider(java.sql.Connection,
long, long)()
210 pstmtUpdate.setString(4, "Enabled");
211 pstmtUpdate.executeUpdate();
212 } catch (SQLException e) {
213 throw new CloudRuntimeException("Exception while adding
PhysicalNetworkServiceProvider F5BigIp", e);
214 } finally {
215 closeAutoCloseable(pstmtUpdate);
>>> CID 1315783: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
216 }
217 }
218
219 private void addSrxServiceProvider(Connection conn, long
physicalNetworkId, long zoneId) {
220 PreparedStatement pstmtUpdate = null;
221 try {
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 217 in
com.cloud.upgrade.dao.Upgrade302to303.addF5ServiceProvider(java.sql.Connection,
long, long)()
211 pstmtUpdate.executeUpdate();
212 } catch (SQLException e) {
213 throw new CloudRuntimeException("Exception while adding
PhysicalNetworkServiceProvider F5BigIp", e);
214 } finally {
215 closeAutoCloseable(pstmtUpdate);
216 }
>>> CID 1315783: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
217 }
218
219 private void addSrxServiceProvider(Connection conn, long
physicalNetworkId, long zoneId) {
220 PreparedStatement pstmtUpdate = null;
221 try {
222 // add physical network service provider - JuniperSRX
** CID 1315784: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 167 in
com.cloud.upgrade.dao.Upgrade302to303.addF5LoadBalancer(java.sql.Connection,
long, long)()
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 168 in
com.cloud.upgrade.dao.Upgrade302to303.addF5LoadBalancer(java.sql.Connection,
long, long)()
________________________________________________________________________________________________________
*** CID 1315784: (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 167 in
com.cloud.upgrade.dao.Upgrade302to303.addF5LoadBalancer(java.sql.Connection,
long, long)()
161 pstmtUpdate.setString(11, UUID.randomUUID().toString());
162 pstmtUpdate.executeUpdate();
163 } catch (SQLException e) {
164 throw new CloudRuntimeException("Exception while adding F5
load balancer device", e);
165 } finally {
166 closeAutoCloseable(pstmtUpdate);
>>> CID 1315784: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
167 }
168 }
169
170 private void addSrxFirewall(Connection conn, long hostId, long
physicalNetworkId) {
171 PreparedStatement pstmtUpdate = null;
172 try {
/engine/schema/src/com/cloud/upgrade/dao/Upgrade302to303.java: 168 in
com.cloud.upgrade.dao.Upgrade302to303.addF5LoadBalancer(java.sql.Connection,
long, long)()
162 pstmtUpdate.executeUpdate();
163 } catch (SQLException e) {
164 throw new CloudRuntimeException("Exception while adding F5
load balancer device", e);
165 } finally {
166 closeAutoCloseable(pstmtUpdate);
167 }
>>> CID 1315784: (RESOURCE_LEAK)
>>> Variable "pstmtUpdate" going out of scope leaks the resource it refers
>>> to.
168 }
169
170 private void addSrxFirewall(Connection conn, long hostId, long
physicalNetworkId) {
171 PreparedStatement pstmtUpdate = null;
172 try {
173 s_logger.debug("Adding SRX firewall device with host id " +
hostId + " in to physical network" + physicalNetworkId);
** CID 1315785: Exceptional resource leaks (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 828 in
com.cloud.upgrade.dao.Upgrade218to22.retrieveDataCenters(java.sql.Connection)()
________________________________________________________________________________________________________
*** CID 1315785: Exceptional resource leaks (RESOURCE_LEAK)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 828 in
com.cloud.upgrade.dao.Upgrade218to22.retrieveDataCenters(java.sql.Connection)()
822 ResultSet dcData = selectDcData.executeQuery();
823 ArrayList<Object[]> dcs = new ArrayList<Object[]>();
824 while (dcData.next()) {
825 Object[] dc = new Object[10];
826 dc[0] = dcData.getLong(1); // data center id
827 dc[1] = dcData.getString(2); // guest network cidr
>>> CID 1315785: Exceptional resource leaks (RESOURCE_LEAK)
>>> Variable "selectDcData" going out of scope leaks the resource it refers
>>> to.
828 dc[2] = dcData.getString(3); // network domain
829 dcs.add(dc);
830 }
831 dcData.close();
832 selectDcData.close();
833 return dcs;
** CID 1315786: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 1315786: Null pointer dereferences (FORWARD_NULL)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 1042 in
com.cloud.upgrade.dao.Upgrade218to22.updateRouters(java.sql.Connection,
java.lang.Long, long, long, java.util.ArrayList)()
1036 */
1037 private void updateRouters(Connection conn, Long dcId, long
controlNetworkId, long basicDefaultDirectNetworkId, ArrayList<Object[]>
routers) throws SQLException {
1038 for (Object[] router : routers) {
1039 s_logger.debug("Updating domR with network id in basic
zone id=" + dcId);
1040 updateNetworkForRouter(conn, router,
basicDefaultDirectNetworkId);
1041 upgradeUserVms(conn, (Long)router[0],
basicDefaultDirectNetworkId, (String)router[1], "untagged",
"DirectPodBasedNetworkGuru", "Create");
>>> CID 1315786: Null pointer dereferences (FORWARD_NULL)
>>> Passing "null" to function
>>> "com.cloud.upgrade.dao.Upgrade218to22.upgradeDomR(java.sql.Connection,
>>> long, long, java.lang.Long, long, long, java.lang.String,
>>> java.lang.String)", which dereferences it.
1042 upgradeDomR(conn, dcId, (Long)router[0], null,
basicDefaultDirectNetworkId, controlNetworkId, "Basic", "untagged");
1043 }
1044 }
1045
1046
1047 /**
** CID 1315787: Null pointer dereferences (FORWARD_NULL)
________________________________________________________________________________________________________
*** CID 1315787: Null pointer dereferences (FORWARD_NULL)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 1254 in
com.cloud.upgrade.dao.Upgrade218to22.updateDhcpServerData(java.sql.Connection,
java.lang.Long, long, java.lang.Long, java.lang.String)()
1248 String gateway = retrieveGateway(conn,
directNetworkId);
1249
1250 updateDomainRouter(conn, routerId, directNetworkId);
1251 s_logger.debug("NetworkId updated for router id=" +
routerId + "with network id = " + directNetworkId);
1252 upgradeUserVms(conn, routerId, directNetworkId,
gateway, vnet, "DirectNetworkGuru", "Create");
1253 s_logger.debug("Upgraded Direct vms in Advance zone
id=" + dcId);
>>> CID 1315787: Null pointer dereferences (FORWARD_NULL)
>>> Passing "null" to function
>>> "com.cloud.upgrade.dao.Upgrade218to22.upgradeDomR(java.sql.Connection,
>>> long, long, java.lang.Long, long, long, java.lang.String,
>>> java.lang.String)", which dereferences it.
1254 upgradeDomR(conn, dcId, routerId, null,
directNetworkId, controlNetworkId, "Advanced", vnet);
1255 s_logger.debug("Upgraded Direct domRs in Advance zone
id=" + dcId);
1256 }
1257 }
1258 }
1259
** CID 1315788: FindBugs: Dodgy code (FB.REC_CATCH_EXCEPTION)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 1392 in
com.cloud.upgrade.dao.Upgrade218to22.updateUserStats(java.sql.Connection)()
________________________________________________________________________________________________________
*** CID 1315788: FindBugs: Dodgy code (FB.REC_CATCH_EXCEPTION)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 1392 in
com.cloud.upgrade.dao.Upgrade218to22.updateUserStats(java.sql.Connection)()
1386 }
1387 }
1388 }
1389 }
1390 s_logger.debug("Upgraded userStatistcis with deviceId(s)");
1391
>>> CID 1315788: FindBugs: Dodgy code (FB.REC_CATCH_EXCEPTION)
>>> Catching RuntimeExceptions, perhaps unintentionally, with a catch block
>>> for Exception
1392 } catch (Exception e) {
1393 throw new CloudRuntimeException("Failed to migrate usage
events: ", e);
1394 }
1395 }
1396
1397 public void upgradePortForwardingRules(Connection conn) {
** CID 1315789: FindBugs: Dodgy code (FB.REC_CATCH_EXCEPTION)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 1912 in
com.cloud.upgrade.dao.Upgrade218to22.migrateEvents(java.sql.Connection)()
________________________________________________________________________________________________________
*** CID 1315789: FindBugs: Dodgy code (FB.REC_CATCH_EXCEPTION)
/engine/schema/src/com/cloud/upgrade/dao/Upgrade218to22.java: 1912 in
com.cloud.upgrade.dao.Upgrade218to22.migrateEvents(java.sql.Connection)()
1906 event.setParameters(rs.getString(7));
1907 convertEvent(event, conn);
1908 }
1909 }
1910 }
1911 s_logger.debug("Migrating events completed");
>>> CID 1315789: FindBugs: Dodgy code (FB.REC_CATCH_EXCEPTION)
>>> Catching RuntimeExceptions, perhaps unintentionally, with a catch block
>>> for Exception
1912 } catch (Exception e) {
1913 throw new CloudRuntimeException("Failed to migrate usage
events: ", e);
1914 }
1915 }
1916
1917 private Long getMostRecentEvent(Connection conn) {
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://scan.coverity.com/projects/cloudstack?tab=overview
To manage Coverity Scan email notifications for "[email protected]",
click
https://scan.coverity.com/subscriptions/edit?email=dev%40cloudstack.apache.org&token=494aabd5ba647999fa41b6d766646231