Skip to content

Commit e14dde5

Browse files
committed
getConversionErrorMessage update for cases that don't wrap value and field name in single quotes
1 parent 877a253 commit e14dde5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/org/labkey/test/LabKeySiteWrapper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,23 +1726,24 @@ public String getConversionErrorMessage(Object value, String fieldName, Class<?>
17261726

17271727
// Note: Keep in sync with ConvertHelper.getStandardConversionErrorMessage()
17281728
// Example: "Could not convert value '2.34' (Double) for Boolean field 'Medical History.Dep Diagnosed in Last 18 Months'"
1729-
public String getConversionErrorMessage(Object value, String fieldName, Class<?> targetClass, boolean useUSDateParsing, boolean removeSingleQuotes)
1729+
public String getConversionErrorMessage(Object value, String fieldName, Class<?> targetClass, boolean useUSDateParsing, boolean withoutSingleQuotes)
17301730
{
17311731
String errorMessage;
17321732
String fieldType = targetClass.getSimpleName();
1733+
String quote = withoutSingleQuotes ? "" : "'";
17331734

17341735
// Issue 50768: Need a better error message if date value is not in the expected format.
17351736
if (fieldType.equalsIgnoreCase("date") || fieldType.equalsIgnoreCase("datetime") || fieldType.equalsIgnoreCase("timestamp"))
17361737
{
17371738
String parsingMode = useUSDateParsing ? "U.S. date parsing (MDY)" : "Non-U.S. date parsing (DMY)";
1738-
errorMessage = "'" + value + "' is not a valid " + fieldType + " for " + fieldName + " using " + parsingMode;
1739+
errorMessage = quote + value + quote + " is not a valid " + fieldType + " for " + fieldName + " using " + parsingMode;
17391740
}
17401741
else
17411742
{
1742-
errorMessage = "Could not convert value '" + value + "' (" + value.getClass().getSimpleName() + ") for " + fieldType + " field '" + fieldName + "'";
1743+
errorMessage = "Could not convert value " + quote + value + quote + " (" + value.getClass().getSimpleName() + ") for " + fieldType + " field " + quote + fieldName + quote;
17431744
}
17441745

1745-
return removeSingleQuotes ? errorMessage.replace("'", "") : errorMessage;
1746+
return errorMessage;
17461747
}
17471748

17481749
private ProductKey getProductConfiguration() throws IOException, CommandException

0 commit comments

Comments
 (0)