Skip to content

Commit 47b0bcb

Browse files
committed
Fix assay template save: correct rowid key casing and don't log expected validations
The switch to QueryUpdateService passed the update key as Map.of("rowId", templateId), but the primary key column is "rowid" and Map.of produces a case-sensitive map, so DefaultQueryUpdateService.getKeys() never found it and threw InvalidKeyException: Value for key field 'rowid' was null or not supplied!. This broke ViralLoadAssayTest. Corrected the key to "rowid" in both AssayHelper.saveTemplate and DefaultAssayParser.saveTemplate. The broadened catch (Exception) in AssayHelper.saveTemplate was logging expected BatchValidationExceptions from validateTemplate()/insertRows() via _log.error, so normal validation failures (e.g. "Must provide at least 2 negative controls") landed in labkey-errors.log and tripped the Selenium harness's checkErrors(), failing ELISPOT_AssayTest. Let BatchValidationException propagate ahead of the generic catch in both methods so these surface as client validation errors, not server errors.
1 parent e448eaf commit 47b0bcb

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

laboratory/api-src/org/labkey/api/laboratory/assay/DefaultAssayParser.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,11 @@ protected void saveTemplate(ViewContext ctx, int templateId, int runId) throws B
485485
row.put("runid", runId);
486486
row.put("status", "Complete");
487487

488-
ti.getUpdateService().updateRows(ctx.getUser(), ctx.getContainer(), Arrays.asList(row), Arrays.asList(Map.of("rowId", templateId)), null, null);
488+
ti.getUpdateService().updateRows(ctx.getUser(), ctx.getContainer(), Arrays.asList(row), Arrays.asList(Map.of("rowid", templateId)), null, null);
489+
}
490+
catch (BatchValidationException e)
491+
{
492+
throw e;
489493
}
490494
catch (Exception e)
491495
{

laboratory/src/org/labkey/laboratory/assay/AssayHelper.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,16 @@ public Map<String, Object> saveTemplate(User u, Container c, ExpProtocol protoco
158158
else
159159
{
160160
row.put("rowid", templateId);
161-
List<Map<String, Object>> rows = ti.getUpdateService().updateRows(u, c, Arrays.asList(row), Arrays.asList(Map.of("rowId", templateId)), null, null);
161+
List<Map<String, Object>> rows = ti.getUpdateService().updateRows(u, c, Arrays.asList(row), Arrays.asList(Map.of("rowid", templateId)), null, null);
162162
return rows.get(0);
163163
}
164164
}
165+
catch (BatchValidationException e)
166+
{
167+
// Expected validation failures (e.g. from validateTemplate() or insertRows()) should propagate to the
168+
// client as-is, not be logged as server errors.
169+
throw e;
170+
}
165171
catch (Exception e)
166172
{
167173
_log.error(e.getMessage(), e);

0 commit comments

Comments
 (0)