mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
changes based on reviewer comments
addressed comments from reviewer.
This commit is contained in:
parent
d128e7a902
commit
86c45f3e49
@ -47,7 +47,8 @@ public final class DeleteDataSourceAction extends AbstractAction {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
try {
|
||||
Case.getCurrentCaseThrows().getSleuthkitCase().deleteDataSource(dataSourceId);
|
||||
} catch (NoCurrentCaseException | TskCoreException e) {
|
||||
deleteDataSource(dataSourceId);
|
||||
} catch (NoCurrentCaseException | TskCoreException | KeywordSearchServiceException e) {
|
||||
logger.log(Level.WARNING, "Error Deleting Data source " + dataSourceId, e);
|
||||
}
|
||||
}
|
||||
|
@ -243,6 +243,7 @@ Server.request.exception.exception.msg=Could not issue Solr request
|
||||
Server.commit.exception.msg=Could not commit index
|
||||
Server.addDoc.exception.msg=Could not add document to index via update handler: {0}
|
||||
Server.addDoc.exception.msg2=Could not add document to index via update handler: {0}
|
||||
Server.delDoc.exception.msg=Error deleting content from Solr. Solr image id : {0}
|
||||
Server.close.exception.msg=Cannot close Core
|
||||
Server.close.exception.msg2=Cannot close Core
|
||||
Server.solrServerNoPortException.msg=Indexing server could not bind to port {0}, port is not available, consider change the default {1} port.
|
||||
|
@ -190,9 +190,9 @@ public class Server {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* termfreq is a function which returns the number of times the term appears.
|
||||
* This is not an actual field defined in schema.xml, but can be gotten from returned documents
|
||||
* in the same way as fields.
|
||||
* termfreq is a function which returns the number of times the term
|
||||
* appears. This is not an actual field defined in schema.xml, but can
|
||||
* be gotten from returned documents in the same way as fields.
|
||||
*/
|
||||
TERMFREQ {
|
||||
@Override
|
||||
@ -893,12 +893,14 @@ public class Server {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the host and port for a multiuser case.
|
||||
* If the file solrserver.txt exists, then use the values from that file.
|
||||
* Otherwise use the settings from the properties file.
|
||||
* Get the host and port for a multiuser case. If the file solrserver.txt
|
||||
* exists, then use the values from that file. Otherwise use the settings
|
||||
* from the properties file.
|
||||
*
|
||||
* @param caseDirectory Current case directory
|
||||
* @return IndexingServerProperties containing the solr host/port for this case
|
||||
*
|
||||
* @return IndexingServerProperties containing the solr host/port for this
|
||||
* case
|
||||
*/
|
||||
public static IndexingServerProperties getMultiUserServerProperties(String caseDirectory) {
|
||||
|
||||
@ -930,16 +932,15 @@ public class Server {
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick a solr server to use for this case and record it in the case directory.
|
||||
* Looks for a file named "solrServerList.txt" in the root output directory -
|
||||
* if this does not exist then no server is recorded.
|
||||
* Pick a solr server to use for this case and record it in the case
|
||||
* directory. Looks for a file named "solrServerList.txt" in the root output
|
||||
* directory - if this does not exist then no server is recorded.
|
||||
*
|
||||
* Format of solrServerList.txt:
|
||||
* (host),(port)
|
||||
* Ex: 10.1.2.34,8983
|
||||
* Format of solrServerList.txt: (host),(port) Ex: 10.1.2.34,8983
|
||||
*
|
||||
* @param rootOutputDirectory
|
||||
* @param caseDirectoryPath
|
||||
*
|
||||
* @throws KeywordSearchModuleException
|
||||
*/
|
||||
public static void selectSolrServerForCase(Path rootOutputDirectory, Path caseDirectoryPath) throws KeywordSearchModuleException {
|
||||
@ -1000,6 +1001,7 @@ public class Server {
|
||||
* Helper class to store the current server properties
|
||||
*/
|
||||
public static class IndexingServerProperties {
|
||||
|
||||
private final String host;
|
||||
private final String port;
|
||||
|
||||
@ -1010,6 +1012,7 @@ public class Server {
|
||||
|
||||
/**
|
||||
* Get the host
|
||||
*
|
||||
* @return host
|
||||
*/
|
||||
public String getHost() {
|
||||
@ -1018,6 +1021,7 @@ public class Server {
|
||||
|
||||
/**
|
||||
* Get the port
|
||||
*
|
||||
* @return port
|
||||
*/
|
||||
public String getPort() {
|
||||
@ -1273,7 +1277,7 @@ public class Server {
|
||||
*
|
||||
* @throws NoOpenCoreException
|
||||
*/
|
||||
public void deleteDataSource(Long dataSourceId) throws NoOpenCoreException {
|
||||
public void deleteDataSource(Long dataSourceId) throws KeywordSearchModuleException, NoOpenCoreException {
|
||||
currentCoreLock.writeLock().lock();
|
||||
try {
|
||||
if (null == currentCore) {
|
||||
@ -1281,8 +1285,9 @@ public class Server {
|
||||
}
|
||||
currentCore.deleteDataSource(dataSourceId);
|
||||
currentCore.commit();
|
||||
} catch (SolrServerException ex) {
|
||||
logger.log(Level.SEVERE, "Solr delete data dource failed for data source: " + dataSourceId, ex); //NON-NLS
|
||||
} catch (SolrServerException | KeywordSearchModuleException ex) {
|
||||
throw new KeywordSearchModuleException(
|
||||
NbBundle.getMessage(this.getClass(), "Server.delDoc.exception.msg", dataSourceId), ex);
|
||||
} finally {
|
||||
currentCoreLock.writeLock().unlock();
|
||||
}
|
||||
@ -1529,14 +1534,15 @@ public class Server {
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteDataSource(Long dsObjId) {
|
||||
private void deleteDataSource(Long dsObjId) throws KeywordSearchModuleException {
|
||||
String dataSourceId = Long.toString(dsObjId);
|
||||
String deleteQuery = "image_id:" + dataSourceId;
|
||||
try {
|
||||
// Get the first result.
|
||||
UpdateResponse updateResponse = solrCore.deleteByQuery(deleteQuery);
|
||||
} catch (SolrServerException | IOException ex) {
|
||||
logger.log(Level.SEVERE, "Error deleting content from Solr. Solr image id " + dataSourceId, ex); //NON-NLS
|
||||
throw new KeywordSearchModuleException(
|
||||
NbBundle.getMessage(this.getClass(), "Server.delDoc.exception.msg", dataSourceId), ex); //NON-NLS
|
||||
}
|
||||
}
|
||||
|
||||
@ -1561,7 +1567,8 @@ public class Server {
|
||||
* @param chunkID Chunk ID of the Solr document
|
||||
*
|
||||
* @return Text from matching Solr document (as String). Null if no
|
||||
* matching Solr document found or error while getting content from Solr
|
||||
* matching Solr document found or error while getting content
|
||||
* from Solr
|
||||
*/
|
||||
private String getSolrContent(long contentID, int chunkID) {
|
||||
final SolrQuery q = new SolrQuery();
|
||||
|
@ -208,9 +208,7 @@ public class SolrSearchService implements KeywordSearchService, AutopsyService {
|
||||
public void deleteDataSource(Long dataSourceId) throws KeywordSearchServiceException {
|
||||
try {
|
||||
KeywordSearch.getServer().deleteDataSource(dataSourceId);
|
||||
} catch (NoOpenCoreException ex) {
|
||||
logger.log(Level.WARNING, NbBundle.getMessage(SolrSearchService.class,
|
||||
"SolrSearchService.deleteDataSource.exceptionMessage.noCurrentSolrCore"));
|
||||
} catch (NoOpenCoreException | KeywordSearchModuleException ex) {
|
||||
throw new KeywordSearchServiceException(NbBundle.getMessage(SolrSearchService.class,
|
||||
"SolrSearchService.deleteDataSource.exceptionMessage.noCurrentSolrCore"));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user