Skip to content

Commit

Permalink
0002233: fix handling of ignorecolumnexception for bsh transforms imp…
Browse files Browse the repository at this point in the history
…orted as spring beans (#168)

* fix: 0002233 resolve issue with ignorecolumneception and ignorerowexception

* fix: 0002233, catch the spring error and unwrap it

* fix: 0002233 remove unneessary handling for target error

* fix: 0002233 indentation

* fix: 0002233 replace space with tabs (whoops)
  • Loading branch information
rudiejd committed Aug 13, 2021
1 parent 7dce268 commit 3f51f36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions symmetric-io/build.gradle
Expand Up @@ -8,7 +8,7 @@ apply from: symAssembleDir + '/common.gradle'
compile "org.apache-extras.beanshell:bsh:$bshVersion"
compile "net.sourceforge.jeval:jeval:0.9.4"
compile "com.google.code.gson:gson:$gsonVersion"

compile "org.springframework:spring-core:$springVersion"
compileOnly ("com.datastax.cassandra:cassandra-driver-core:3.1.4") {
exclude group: 'org.slf4j'
exclude group: 'com.google.guava'
Expand All @@ -25,4 +25,4 @@ apply from: symAssembleDir + '/common.gradle'
integrationTestRuntimeOnly project(':symmetric-jdbc').sourceSets.integrationTest.output
integrationTestRuntimeOnly project(':symmetric-jdbc').sourceSets.test.output

}
}
Expand Up @@ -49,6 +49,7 @@
import org.jumpmind.util.Statistics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.NestedRuntimeException;

public class TransformWriter extends NestedDataWriter {

Expand Down Expand Up @@ -448,6 +449,15 @@ protected Object transformColumn(DataContext context, TransformedData data,
}
returnValue = transform.transform(platform, context, transformColumn, data,
sourceValues, value, oldValue);
} catch (NestedRuntimeException nestedRuntimeException) {
Throwable rootCause = nestedRuntimeException.getRootCause();
if (rootCause instanceof IgnoreColumnException) {
throw (IgnoreColumnException) rootCause;
} else if (rootCause instanceof IgnoreRowException) {
throw (IgnoreRowException) rootCause;
} else {
throw nestedRuntimeException;
}
} catch (RuntimeException ex) {
log.warn("Column transform failed {}.{} ({}) for source values of {}", new Object[] { transformColumn.getTransformId(), transformColumn.getTargetColumnName(), transformColumn.getIncludeOn().name(), sourceValues.toString() });
throw ex;
Expand Down

0 comments on commit 3f51f36

Please sign in to comment.