Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ else if (o instanceof MvFieldWrapper)
Object remapped = cache.remap(lookupTable, (String)o);
if (remapped == null)
{
errors.add(new PropertyValidationError("Failed to convert '" + pd.getName() + "': " + o, pd.getName()));
errors.add(new PropertyValidationError("Failed to convert '" + pd.getName() + "': Could not translate value: " + o, pd.getName()));
}
else if (o != remapped)
{
Expand Down
17 changes: 16 additions & 1 deletion api/src/org/labkey/api/data/ConditionalFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.labkey.data.xml.ConditionalFormatsType;

import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -119,7 +120,7 @@ public String validateFormat(@NotNull ColumnRenderProperties col)
{
try
{
_meetsCriteria(col, "ignored");
_meetsCriteria(col, newValue(col));
return null;
}
catch (RuntimeSQLException e)
Expand All @@ -137,6 +138,20 @@ public String validateFormat(@NotNull ColumnRenderProperties col)
}
}

// best-effort to create new value instance for validating conditional format parameters
private Object newValue(ColumnRenderProperties col)
{
try
{
return col.getJavaClass().getDeclaredConstructor().newInstance();
}
catch (ReflectiveOperationException e)
{
// ok
return null;
}
}

@NotNull
public String getCssStyle()
{
Expand Down