mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
Add max length for central repo value field
This commit is contained in:
parent
c2d208dd32
commit
f444835902
@ -105,7 +105,7 @@ public final class AddEditCentralRepoCommentAction extends AbstractAction {
|
|||||||
dbManager.updateAttributeInstanceComment(correlationAttribute);
|
dbManager.updateAttributeInstanceComment(correlationAttribute);
|
||||||
}
|
}
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
logger.log(Level.SEVERE, "Error connecting to Central Repository database.", ex);
|
logger.log(Level.SEVERE, "Error adding comment", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return centralRepoCommentDialog.getComment();
|
return centralRepoCommentDialog.getComment();
|
||||||
|
@ -57,7 +57,10 @@ abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
private int bulkArtifactsCount;
|
private int bulkArtifactsCount;
|
||||||
protected int bulkArtifactsThreshold;
|
protected int bulkArtifactsThreshold;
|
||||||
private final Map<String, Collection<CorrelationAttribute>> bulkArtifacts;
|
private final Map<String, Collection<CorrelationAttribute>> bulkArtifacts;
|
||||||
|
|
||||||
|
// Maximum length for the value column in the instance tables
|
||||||
|
static final int MAX_VALUE_LENGTH = 128;
|
||||||
|
|
||||||
// number of instances to keep in bulk queue before doing an insert.
|
// number of instances to keep in bulk queue before doing an insert.
|
||||||
// Update Test code if this changes. It's hard coded there.
|
// Update Test code if this changes. It's hard coded there.
|
||||||
static final int DEFAULT_BULK_THRESHHOLD = 1000;
|
static final int DEFAULT_BULK_THRESHHOLD = 1000;
|
||||||
@ -550,6 +553,12 @@ abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
if (eamArtifact.getCorrelationValue() == null) {
|
if (eamArtifact.getCorrelationValue() == null) {
|
||||||
throw new EamDbException("Correlation value is null");
|
throw new EamDbException("Correlation value is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't throw an exception here because the calling code may be looping over values.
|
||||||
|
if (eamArtifact.getCorrelationValue().length() >= MAX_VALUE_LENGTH) {
|
||||||
|
logger.log(Level.WARNING, "Artifact value too long for central repository: {0}", eamArtifact.getCorrelationValue());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Connection conn = connect();
|
Connection conn = connect();
|
||||||
|
|
||||||
@ -984,18 +993,22 @@ abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
throw new EamDbException("CorrelationAttributeInstance known status is null");
|
throw new EamDbException("CorrelationAttributeInstance known status is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
|
if (eamArtifact.getCorrelationValue().length() < MAX_VALUE_LENGTH) {
|
||||||
bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
|
bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
|
||||||
bulkPs.setInt(3, eamInstance.getCorrelationDataSource().getCaseID());
|
bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
|
||||||
bulkPs.setString(4, eamArtifact.getCorrelationValue());
|
bulkPs.setInt(3, eamInstance.getCorrelationDataSource().getCaseID());
|
||||||
bulkPs.setString(5, eamInstance.getFilePath());
|
bulkPs.setString(4, eamArtifact.getCorrelationValue());
|
||||||
bulkPs.setByte(6, eamInstance.getKnownStatus().getFileKnownValue());
|
bulkPs.setString(5, eamInstance.getFilePath());
|
||||||
if ("".equals(eamInstance.getComment())) {
|
bulkPs.setByte(6, eamInstance.getKnownStatus().getFileKnownValue());
|
||||||
bulkPs.setNull(7, Types.INTEGER);
|
if ("".equals(eamInstance.getComment())) {
|
||||||
|
bulkPs.setNull(7, Types.INTEGER);
|
||||||
|
} else {
|
||||||
|
bulkPs.setString(7, eamInstance.getComment());
|
||||||
|
}
|
||||||
|
bulkPs.addBatch();
|
||||||
} else {
|
} else {
|
||||||
bulkPs.setString(7, eamInstance.getComment());
|
logger.log(Level.WARNING, "Artifact value too long for central repository: {0}", eamArtifact.getCorrelationValue());
|
||||||
}
|
}
|
||||||
bulkPs.addBatch();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user