diff --git a/symmetric-core/src/main/java/org/jumpmind/symmetric/load/BshDatabaseWriterFilter.java b/symmetric-core/src/main/java/org/jumpmind/symmetric/load/BshDatabaseWriterFilter.java
index 1a8fd23dbf..c3ef1df389 100644
--- a/symmetric-core/src/main/java/org/jumpmind/symmetric/load/BshDatabaseWriterFilter.java
+++ b/symmetric-core/src/main/java/org/jumpmind/symmetric/load/BshDatabaseWriterFilter.java
@@ -1,3 +1,23 @@
+/*
+ * Licensed to JumpMind Inc under one or more contributor
+ * license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding
+ * copyright ownership. JumpMind Inc licenses this file
+ * to you under the GNU Lesser General Public License (the
+ * "License"); you may not use this file except in compliance
+ * with the License.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * .
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.jumpmind.symmetric.load;
import java.util.HashSet;
@@ -31,6 +51,7 @@ public class BshDatabaseWriterFilter implements IDatabaseWriterFilter, IDatabase
private static final String CONTEXT = "context";
private static final String TABLE = "table";
private static final String DATA = "data";
+ private static final String ERROR = "error";
private static final String ENGINE = "engine";
private final String INTERPRETER_KEY = String.format("%d.BshInterpreter", hashCode());
private final String BATCH_COMPLETE_SCRIPTS_KEY = String.format("%d.BatchCompleteScripts",
@@ -59,15 +80,15 @@ public BshDatabaseWriterFilter(ISymmetricEngine symmetricEngine,
}
public boolean beforeWrite(DataContext context, Table table, CsvData data) {
- return processLoadFilters(context, table, data, WriteMethod.BEFORE_WRITE);
+ return processLoadFilters(context, table, data, null, WriteMethod.BEFORE_WRITE);
}
public void afterWrite(DataContext context, Table table, CsvData data) {
- processLoadFilters(context, table, data, WriteMethod.AFTER_WRITE);
+ processLoadFilters(context, table, data, null, WriteMethod.AFTER_WRITE);
}
- public boolean handleError(DataContext context, Table table, CsvData data, Exception ex) {
- return processLoadFilters(context, table, data, WriteMethod.HANDLE_ERROR);
+ public boolean handleError(DataContext context, Table table, CsvData data, Exception error) {
+ return processLoadFilters(context, table, data, error, WriteMethod.HANDLE_ERROR);
}
public boolean handlesMissingTable(DataContext context, Table table) {
@@ -98,13 +119,14 @@ protected Interpreter getInterpreter(Context context) {
return interpreter;
}
- protected void bind(Interpreter interpreter, DataContext context, Table table, CsvData data)
+ protected void bind(Interpreter interpreter, DataContext context, Table table, CsvData data, Exception error)
throws EvalError {
interpreter.set(ENGINE, this.symmetricEngine);
interpreter.set(CONTEXT, context);
interpreter.set(TABLE, table);
interpreter.set(DATA, data);
+ interpreter.set(ERROR, error);
if (data != null) {
Map sourceValues = data.toColumnNameValuePairs(table.getColumnNames(),
@@ -162,7 +184,7 @@ protected void executeScripts(DataContext context, String key) {
Interpreter interpreter = getInterpreter(context);
String currentScript = null;
try {
- bind(interpreter, context, null, null);
+ bind(interpreter, context, null, null, null);
if (scripts != null) {
for (String script : scripts) {
currentScript = script;
@@ -180,7 +202,7 @@ protected void executeScripts(DataContext context, String key) {
}
- protected boolean processLoadFilters(DataContext context, Table table, CsvData data,
+ protected boolean processLoadFilters(DataContext context, Table table, CsvData data, Exception error,
WriteMethod writeMethod) {
boolean writeRow = true;
@@ -191,7 +213,7 @@ protected boolean processLoadFilters(DataContext context, Table table, CsvData d
if (loadFiltersForTable != null && loadFiltersForTable.size() > 0) {
try {
Interpreter interpreter = getInterpreter(context);
- bind(interpreter, context, table, data);
+ bind(interpreter, context, table, data, error);
for (LoadFilter filter : loadFiltersForTable) {
currentFilter = filter;
addBatchScriptsToContext(context, filter);