Skip to content

Commit 5686631

Browse files
committed
Comments
1 parent 7cccb4a commit 5686631

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

api/src/org/labkey/api/action/BaseViewAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ protected Object newInstance(Class<?> c)
349349
return commandClass.isRecord() ? bindParametersToRecord(commandClass, params, getCommandName()) : defaultBindParameters(getCommand(), params);
350350
}
351351

352-
// Simple binding for Java records: no support for binding errors, arrays, lists, etc.
352+
// Simple binding for Java records: provides binding errors for missing primitive parameters and type conversions
353+
// failures. Current no support for array or list parameter types.
353354
public static <R> BindException bindParametersToRecord(Class<R> recordClass, PropertyValues pvs, String commandName)
354355
{
355356
// Note: We don't support record-based forms implementing HasAllowBindParameter since we must populate all
@@ -367,7 +368,8 @@ public static <R> BindException bindParametersToRecord(Class<R> recordClass, Pro
367368
}
368369
catch (IllegalArgumentException | ConversionException e)
369370
{
370-
// We have no instance to bind to, so report a global error with details
371+
// Missing primitive parameter or type conversion error. We have no instance to bind to, so report a global
372+
// error with details.
371373
errors = new NullSafeBindException(new Object(), commandName);
372374
errors.reject(ERROR_MSG, "Unable to bind parameters to " + recordClass.getSimpleName() + ": " + e.getMessage());
373375
}

api/src/org/labkey/api/data/RecordFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public RecordFactory(Class<K> clazz)
6969
.toList();
7070
}
7171

72+
// Throws IllegalArgumentException for missing primitive parameters and ConversionExceptions for parameters that
73+
// fail type conversion
7274
private <MAP extends Map<String, ?> & CaseInsensitiveCollection> K fromCaseInsensitiveMap(MAP m)
7375
{
7476
Object[] params = Arrays.stream(_parameters).map(p -> {

0 commit comments

Comments
 (0)