Hi,
I’m facing a bug of DataImport Module.
I cannot import data mapped on an Entity field with type Long.
The problem is probably located here de.diedavids.cuba.dataimport.binding.DatatypeFactory#getValue
Object getValue(AttributeBindRequest bindRequest) {
switch (bindRequest.javaType) {
case Integer: return getIntegerValue(bindRequest.rawValue, bindRequest.dataRow)
case Double: return getDoubleValue(bindRequest.rawValue, bindRequest.dataRow)
case Date: return getDateValue(bindRequest.importConfiguration, bindRequest.rawValue)
case Boolean: return getBooleanValue(bindRequest.importConfiguration, bindRequest.rawValue, bindRequest.dataRow)
case BigDecimal: return getBigDecimalValue(bindRequest.rawValue, bindRequest.dataRow)
case String: return getStringValue(bindRequest.rawValue)
case Enum: return getEnumValue(bindRequest)
}
}
The Long
Datatype is not managed.
I attached a reproducer
- launch de project
- create launch configuration
- entity : MyEntity
- data file : data.csv.
- Run import
==> it fails. No data inserted.
If you change the datatype of the field in MyEntity to integer
, it is ok.
By the way,
could it be possible to improve log messages like in …
de.diedavids.cuba.dataimport.binding.DatatypeFactory#getIntegerValue
[...]
catch (NumberFormatException e) {
log.warn("Number could not be read: '$rawValue' in [$dataRow]. Will be ignored.")
}
… adding the name of the field that refers to the wrong value. the fieldname is in the bindRequest
Object in the caller method Object getValue(AttributeBindRequest bindRequest)
.
It would be simplify further investigations.
Regard,
GuillaumeDataImportLongReproducer.zip (89.8 KB)