Source:
<code>public void update() { synchronized (accounts) { accounts.clear(); } if (skCase == null) { return; } int artId = BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID(); int pathAttrId = BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(); String query = "SELECT value_text,blackboard_attributes.artifact_id,attribute_type_id " + "FROM blackboard_attributes,blackboard_artifacts WHERE " + "attribute_type_id=" + pathAttrId + " AND blackboard_attributes.artifact_id=blackboard_artifacts.artifact_id" + " AND blackboard_artifacts.artifact_type_id=" + artId; <START> if (datasourceObjId > 0) { <END> query += " AND blackboard_artifacts.data_source_obj_id = " + datasourceObjId; } try (CaseDbQuery dbQuery = skCase.executeQuery(query)) { ResultSet resultSet = dbQuery.getResultSet(); synchronized (accounts) { while (resultSet.next()) { final String path = resultSet.getString("value_text"); final long artifactId = resultSet.getLong("artifact_id"); final Map<String, String> parsedPath = parsePath(path); final String account = parsedPath.get(MAIL_ACCOUNT); final String folder = parsedPath.get(MAIL_FOLDER); Map<String, List<Long>> folders = accounts.get(account); if (folders == null) { folders = new LinkedHashMap<>(); accounts.put(account, folders); } List<Long> messages = folders.get(folder); if (messages == null) { messages = new ArrayList<>(); folders.put(folder, messages); } messages.add(artifactId); } } } catch (TskCoreException | SQLException ex) { logger.log(Level.WARNING, "Cannot initialize email extraction: ", ex); } setChanged(); notifyObservers(); }</code><technical_language>change Objects CasePreferences unused imports</technical_language>

Target:
public void update() { synchronized (accounts) { accounts.clear(); } if (skCase == null) { return; } int artId = BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID(); int pathAttrId = BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH.getTypeID(); String query = "SELECT value_text,blackboard_attributes.artifact_id,attribute_type_id " + "FROM blackboard_attributes,blackboard_artifacts WHERE " + "attribute_type_id=" + pathAttrId + " AND blackboard_attributes.artifact_id=blackboard_artifacts.artifact_id" + " AND blackboard_artifacts.artifact_type_id=" + artId; if (filteringDSObjId > 0) { query += " AND blackboard_artifacts.data_source_obj_id = " + filteringDSObjId; } try (CaseDbQuery dbQuery = skCase.executeQuery(query)) { ResultSet resultSet = dbQuery.getResultSet(); synchronized (accounts) { while (resultSet.next()) { final String path = resultSet.getString("value_text"); final long artifactId = resultSet.getLong("artifact_id"); final Map<String, String> parsedPath = parsePath(path); final String account = parsedPath.get(MAIL_ACCOUNT); final String folder = parsedPath.get(MAIL_FOLDER); Map<String, List<Long>> folders = accounts.get(account); if (folders == null) { folders = new LinkedHashMap<>(); accounts.put(account, folders); } List<Long> messages = folders.get(folder); if (messages == null) { messages = new ArrayList<>(); folders.put(folder, messages); } messages.add(artifactId); } } } catch (TskCoreException | SQLException ex) { logger.log(Level.WARNING, "Cannot initialize email extraction: ", ex); } setChanged(); notifyObservers(); }