Merge pull request #6877 from gdicristofaro/7501-npeOnClose

7501 fix npe on web categories close
This commit is contained in:
Richard Cordovano 2021-04-06 13:50:55 -04:00 committed by GitHub
commit f1b5cb72b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,6 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.openide.modules.InstalledFileLocator;
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.url.analytics.DomainCategory;
/**
@ -396,7 +395,7 @@ class WebCategoriesDataModel implements AutoCloseable {
* @return The list of domain suffixes and their categories.
* @throws SQLException
*/
List<DomainCategory> getRecords() throws SQLException {
synchronized List<DomainCategory> getRecords() throws SQLException {
if (!isInitialized()) {
initialize();
}
@ -428,7 +427,7 @@ class WebCategoriesDataModel implements AutoCloseable {
* @return The found entry or null.
* @throws SQLException
*/
DomainCategory getRecordBySuffix(String domainSuffix) throws SQLException {
synchronized DomainCategory getRecordBySuffix(String domainSuffix) throws SQLException {
if (!isInitialized()) {
initialize();
}
@ -529,7 +528,9 @@ class WebCategoriesDataModel implements AutoCloseable {
@Override
public synchronized void close() throws SQLException {
dbConn.close();
dbConn = null;
if (dbConn != null) {
dbConn.close();
dbConn = null;
}
}
}