[rdbmsreader,rdbmswriter] Fix load JDBC driver failure, config `driver` is required and must not be empty
@@ -21,16 +21,19 @@ package com.wgzhao.addax.plugin.reader.rdbmsreader;
import com.wgzhao.addax.common.exception.AddaxException;
import com.wgzhao.addax.common.plugin.RecordSender;
+import com.wgzhao.addax.common.spi.ErrorCode;
import com.wgzhao.addax.common.spi.Reader;
import com.wgzhao.addax.common.util.Configuration;
import com.wgzhao.addax.rdbms.reader.CommonRdbmsReader;
import com.wgzhao.addax.rdbms.util.DBUtilErrorCode;
import com.wgzhao.addax.rdbms.util.DataBaseType;
+import org.apache.commons.lang3.StringUtils;
import java.util.List;
import static com.wgzhao.addax.common.base.Constant.DEFAULT_FETCH_SIZE;
import static com.wgzhao.addax.common.base.Key.FETCH_SIZE;
+import static com.wgzhao.addax.common.base.Key.JDBC_DRIVER;
public class RdbmsReader
extends Reader
@@ -58,7 +61,10 @@ public class RdbmsReader
fetchSize));
}
this.originalConfig.set(FETCH_SIZE, fetchSize);
-
+ String jdbcDriver = this.originalConfig.getString(JDBC_DRIVER, null);
+ if (jdbcDriver == null || StringUtils.isBlank(jdbcDriver)) {
+ throw AddaxException.asAddaxException(DBUtilErrorCode.REQUIRED_VALUE, "config 'driver' is required and must not be empty");
+ }
this.commonRdbmsReaderMaster = new SubCommonRdbmsReader.Job(DATABASE_TYPE);
this.originalConfig = this.commonRdbmsReaderMaster.init(this.originalConfig);
}
