aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com')
-rw-r--r--src/java/com/healthmarketscience/jackcess/ExportFilter.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/ExportUtil.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/ImportFilter.java3
-rw-r--r--src/java/com/healthmarketscience/jackcess/ImportUtil.java12
4 files changed, 17 insertions, 4 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/ExportFilter.java b/src/java/com/healthmarketscience/jackcess/ExportFilter.java
index b9c6124..f145fd5 100644
--- a/src/java/com/healthmarketscience/jackcess/ExportFilter.java
+++ b/src/java/com/healthmarketscience/jackcess/ExportFilter.java
@@ -54,7 +54,8 @@ public interface ExportFilter {
* @param row
* the row data as determined by the import code, may be directly
* modified
- * @return the row data as it should be written to the import table
+ * @return the row data as it should be written to the import table. if
+ * {@code null}, the row will be skipped
*/
public Object[] filterRow(Object[] row) throws IOException;
diff --git a/src/java/com/healthmarketscience/jackcess/ExportUtil.java b/src/java/com/healthmarketscience/jackcess/ExportUtil.java
index 7876fb0..472d328 100644
--- a/src/java/com/healthmarketscience/jackcess/ExportUtil.java
+++ b/src/java/com/healthmarketscience/jackcess/ExportUtil.java
@@ -332,6 +332,9 @@ public class ExportUtil {
// apply filter
Object[] rowData = filter.filterRow(unfilteredRowData);
+ if(rowData == null) {
+ continue;
+ }
// print row
for (int i = 0; i < columns.size(); i++) {
diff --git a/src/java/com/healthmarketscience/jackcess/ImportFilter.java b/src/java/com/healthmarketscience/jackcess/ImportFilter.java
index 6bcc620..144b481 100644
--- a/src/java/com/healthmarketscience/jackcess/ImportFilter.java
+++ b/src/java/com/healthmarketscience/jackcess/ImportFilter.java
@@ -56,7 +56,8 @@ public interface ImportFilter {
* The desired values for the row.
* @param row the row data as determined by the import code, may be directly
* modified
- * @return the row data as it should be written to the import table
+ * @return the row data as it should be written to the import table. if
+ * {@code null}, the row will be skipped
*/
public Object[] filterRow(Object[] row)
throws SQLException, IOException;
diff --git a/src/java/com/healthmarketscience/jackcess/ImportUtil.java b/src/java/com/healthmarketscience/jackcess/ImportUtil.java
index 0cd418e..b647570 100644
--- a/src/java/com/healthmarketscience/jackcess/ImportUtil.java
+++ b/src/java/com/healthmarketscience/jackcess/ImportUtil.java
@@ -164,7 +164,11 @@ public class ImportUtil
for (int i = 0; i < row.length; i++) {
row[i] = source.getObject(i + 1);
}
- rows.add(filter.filterRow(row));
+ row = filter.filterRow(row);
+ if(row == null) {
+ continue;
+ }
+ rows.add(row);
if (rows.size() == COPY_TABLE_BATCH_SIZE) {
table.addRows(rows);
rows.clear();
@@ -385,7 +389,11 @@ public class ImportUtil
while ((line = in.readLine()) != null)
{
Object[] data = splitLine(line, delimPat, quote, in, numColumns);
- rows.add(filter.filterRow(data));
+ data = filter.filterRow(data);
+ if(data == null) {
+ continue;
+ }
+ rows.add(data);
if (rows.size() == COPY_TABLE_BATCH_SIZE) {
table.addRows(rows);
rows.clear();