Skip to content
Snippets Groups Projects
Commit a3233c4d authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

use the same separator to revert adapt data (JAVAAPI-647)

parent c51558a8
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ import fr.soleil.data.container.matrix.StringMatrix;
import fr.soleil.data.exception.DataAdaptationException;
import fr.soleil.data.mediator.Mediator;
import fr.soleil.data.target.IFormatableTarget;
import fr.soleil.lib.project.ObjectUtils;
/**
* A {@link DataToStringAdapter} that adapts some {@link Number}s to {@link String} values
......@@ -84,21 +85,22 @@ public class AbstractMatrixToStringAdapter<N> extends DataToStringAdapter<Abstra
} else if (firstType.isAssignableFrom(BigInteger.class)) {
result = (AbstractMatrix<N>) new BigIntegerMatrix();
}
String[] values = data.split(COMMA);
String[] values;
if (data.indexOf(ObjectUtils.NEW_LINE) > -1) {
values = data.split(ObjectUtils.NEW_LINE);
} else {
values = data.split(COMMA);
}
try {
result.setValue(result.initValue(1, values.length));
} catch (UnsupportedDataTypeException e) {
throw new DataAdaptationException("Unexpected data conversion exception", e);
}
int index = 0;
for (String valueToSet : values) {
result.setValueFromStringAt(valueToSet, 0, index);
index++;
}
}
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment