Source:
<code>public void addWorkflowEntry(WorkflowDTO workflow) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; String query = SQLConstants.ADD_WORKFLOW_ENTRY_SQL; try { Timestamp cratedDateStamp = new Timestamp(workflow.getCreatedTime()); connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, workflow.getWorkflowReference()); prepStmt.setString(2, workflow.getWorkflowType()); prepStmt.setString(3, workflow.getStatus().toString()); prepStmt.setTimestamp(4, cratedDateStamp); prepStmt.setString(5, workflow.getWorkflowDescription()); prepStmt.setInt(6, workflow.getTenantId()); prepStmt.setString(7, workflow.getTenantDomain()); prepStmt.setString(8, workflow.getExternalWorkflowReference()); if(workflow.getMetadata() != null) { byte[] metadataByte = workflow.getMetadata().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(9, new ByteArrayInputStream(metadataByte) ); } else { prepStmt.setBlob(9, (Blob)null); <START> } <END> if(workflow.getProperties() != null) { byte[] propertiesByte = workflow.getProperties().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(10, new ByteArrayInputStream(propertiesByte)); } else { prepStmt.setBlob(10, (Blob)null); } prepStmt.execute(); connection.commit(); } catch (SQLException | UnsupportedEncodingException e) { handleException("Error while adding Workflow : " + workflow.getExternalWorkflowReference() + " to the " + "database", e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }</code><technical_language>cast null blob</technical_language>

Target:
public void addWorkflowEntry(WorkflowDTO workflow) throws APIManagementException { Connection connection = null; PreparedStatement prepStmt = null; String query = SQLConstants.ADD_WORKFLOW_ENTRY_SQL; try { Timestamp cratedDateStamp = new Timestamp(workflow.getCreatedTime()); connection = APIMgtDBUtil.getConnection(); connection.setAutoCommit(false); prepStmt = connection.prepareStatement(query); prepStmt.setString(1, workflow.getWorkflowReference()); prepStmt.setString(2, workflow.getWorkflowType()); prepStmt.setString(3, workflow.getStatus().toString()); prepStmt.setTimestamp(4, cratedDateStamp); prepStmt.setString(5, workflow.getWorkflowDescription()); prepStmt.setInt(6, workflow.getTenantId()); prepStmt.setString(7, workflow.getTenantDomain()); prepStmt.setString(8, workflow.getExternalWorkflowReference()); if (workflow.getMetadata() != null) { byte[] metadataByte = workflow.getMetadata().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(9, new ByteArrayInputStream(metadataByte)); } else { prepStmt.setNull(9, java.sql.Types.BLOB); } if (workflow.getProperties() != null) { byte[] propertiesByte = workflow.getProperties().toJSONString().getBytes("UTF-8"); prepStmt.setBlob(10, new ByteArrayInputStream(propertiesByte)); } else { prepStmt.setNull(10, java.sql.Types.BLOB); } prepStmt.execute(); connection.commit(); } catch (SQLException | UnsupportedEncodingException e) { handleException("Error while adding Workflow : " + workflow.getExternalWorkflowReference() + " to the " + "database", e); } finally { APIMgtDBUtil.closeAllConnections(prepStmt, connection, null); } }