Skip to content

Commit

Permalink
0001333: Transforms with a source column containing an empty string o…
Browse files Browse the repository at this point in the history
…r white space fail.
  • Loading branch information
abrougher committed Jul 19, 2013
1 parent 91dc0dc commit cc2450a
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;

import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.platform.IDatabasePlatform;
import org.jumpmind.symmetric.io.data.CsvData;
Expand Down Expand Up @@ -131,20 +132,20 @@ protected boolean isTransformable(DataEventType eventType) {
}

public void write(CsvData data) {
if (data.requiresTable() && sourceTable == null &&
if (data.requiresTable() && sourceTable == null &&
context.getLastParsedTable() != null) {
// if we cross batches and the table isn't specified, then
// use the last table we used
start(context.getLastParsedTable());
}
}
DataEventType eventType = data.getDataEventType();
if (activeTransforms != null && activeTransforms.size() > 0 && isTransformable(eventType)) {
Map<String, String> sourceValues = data.toColumnNameValuePairs(this.sourceTable.getColumnNames(),
CsvData.ROW_DATA);
Map<String, String> oldSourceValues = data.toColumnNameValuePairs(this.sourceTable.getColumnNames(),
CsvData.OLD_DATA);
Map<String, String> sourceKeyValues = null;

if (data.contains(CsvData.PK_DATA)) {
sourceKeyValues = data.toColumnNameValuePairs(this.sourceTable.getPrimaryKeyColumnNames(), CsvData.PK_DATA);
} else if (oldSourceValues.size() > 0) {
Expand Down Expand Up @@ -254,7 +255,7 @@ protected boolean perform(DataContext context, TransformedData data,
|| (includeOn == IncludeOnType.INSERT && eventType == DataEventType.INSERT)
|| (includeOn == IncludeOnType.UPDATE && eventType == DataEventType.UPDATE)
|| (includeOn == IncludeOnType.DELETE && eventType == DataEventType.DELETE)) {
if (transformColumn.getSourceColumnName() == null
if (StringUtils.isBlank(transformColumn.getSourceColumnName())
|| sourceValues.containsKey(transformColumn.getSourceColumnName())) {
IColumnTransform<?> transform = columnTransforms != null ? columnTransforms
.get(transformColumn.getTransformType()) : null;
Expand Down

0 comments on commit cc2450a

Please sign in to comment.