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
8 changes: 8 additions & 0 deletions api/src/org/labkey/api/dataiterator/CoerceDataIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.labkey.api.collections.CaseInsensitiveHashSet;
import org.labkey.api.data.ColumnInfo;
import org.labkey.api.data.JdbcType;
import org.labkey.api.data.MultiValuedForeignKey;
import org.labkey.api.data.TableInfo;
import org.labkey.api.exp.PropertyType;
Expand Down Expand Up @@ -87,4 +88,11 @@ else if (to.getFk() instanceof MultiValuedForeignKey)
}
}
}

// Ignore conversion exceptions during coercion and just pass back the original value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider referring to Issue 52098 in this comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can do this, but it's not actually related to the fix for Issue 52098, only mistakenly removed in the course of fixing 52098. If I hadn't made that mistake, I wouldn't have annotated this method, so I'm somewhat inclined not to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Just a contextual hook is all. I'm fine either way.

@Override
protected Object handleConversionException(String fieldName, Object value, JdbcType target, Exception x)
{
return value;
}
}
6 changes: 3 additions & 3 deletions api/src/org/labkey/api/dataiterator/SimpleTranslator.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ protected boolean validMissingValue(String mv)
return _missingValues.containsKey(mv);
}

protected Object addConversionException(String fieldName, @Nullable Object value, @Nullable JdbcType target, Exception x)
protected Object handleConversionException(String fieldName, @Nullable Object value, @Nullable JdbcType target, Exception x)
{
String msg;
if (x instanceof ConversionExceptionWithMessage)
Expand Down Expand Up @@ -651,7 +651,7 @@ final public Object get()
}
catch (ConversionException x)
{
return addConversionException(fieldName, value, type, x);
return handleConversionException(fieldName, value, type, x);
}
}

Expand Down Expand Up @@ -1913,7 +1913,7 @@ public boolean next() throws BatchValidationException
catch (ConversionException x)
{
// preferable to handle in call()
_row[i] = addConversionException(_outputColumns.get(i).getKey().getName(), null, null, x);
_row[i] = handleConversionException(_outputColumns.get(i).getKey().getName(), null, null, x);
}
catch (RuntimeException x)
{
Expand Down