Fixed null pointer dereference

merge-requests/7/head
Timo Briddigkeit 8 years ago
parent 0ea2c458e7
commit 0ac4752b2b

@ -473,8 +473,8 @@ public class PolicyDAOImpl implements PolicyDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
String query = "SELECT * FROM DM_POLICY_CHANGE_MGT WHERE TENANT_ID = ?"; String query = "SELECT * FROM DM_POLICY_CHANGE_MGT WHERE TENANT_ID = ?";
stmt.setInt(1, tenantId);
stmt = conn.prepareStatement(query); stmt = conn.prepareStatement(query);
stmt.setInt(1, tenantId);
resultSet = stmt.executeQuery(); resultSet = stmt.executeQuery();
while (resultSet.next()) { while (resultSet.next()) {
@ -1302,11 +1302,7 @@ public class PolicyDAOImpl implements PolicyDAO {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Policy (" + policyId + ") delete from database."); log.debug("Policy (" + policyId + ") delete from database.");
} }
if (deleted > 0) { return deleted > 0;
return true;
} else {
return false;
}
} catch (SQLException e) { } catch (SQLException e) {
throw new PolicyManagerDAOException("Unable to delete the policy (" + policyId + ") from database", e); throw new PolicyManagerDAOException("Unable to delete the policy (" + policyId + ") from database", e);
} finally { } finally {
@ -1584,7 +1580,7 @@ public class PolicyDAOImpl implements PolicyDAO {
byte[] contentBytes; byte[] contentBytes;
try { try {
contentBytes = (byte[]) resultSet.getBytes("POLICY_CONTENT"); contentBytes = resultSet.getBytes("POLICY_CONTENT");
bais = new ByteArrayInputStream(contentBytes); bais = new ByteArrayInputStream(contentBytes);
ois = new ObjectInputStream(bais); ois = new ObjectInputStream(bais);
policy = (Policy) ois.readObject(); policy = (Policy) ois.readObject();

Loading…
Cancel
Save