Unused imports and other minor cleanups (#2723)
* Two minor fixes - prevent invalid index error on empty strings (shouldn't normally happen) - update deprecated Apache Commons Lang method * Remove unused imports
This commit is contained in:
parent
03c860d961
commit
bf1c890cc3
@ -132,7 +132,7 @@ public class SqlInsertBuilder {
|
||||
|
||||
if(type.equals(SqlData.SQL_TYPE_NUMERIC)) {//test if number is numeric (decimal(p,s) number is valid)
|
||||
|
||||
if(!NumberUtils.isNumber(val.getText())){
|
||||
if(!NumberUtils.isCreatable(val.getText())){
|
||||
throw new SqlExporterException(
|
||||
val.getText() + " is not compatible with column type :" + type);
|
||||
}
|
||||
@ -179,15 +179,14 @@ public class SqlInsertBuilder {
|
||||
}
|
||||
|
||||
boolean trimColNames = options == null ? false : JSONUtilities.getBoolean(options, "trimColumnNames", false);
|
||||
String colNamesWithSep = columns.stream().map(col -> col.replaceAll("\\s", "")).collect(Collectors.joining(","));;
|
||||
String colNamesWithSep = columns.stream().map(col -> col.replaceAll("\\s", "")).collect(Collectors.joining(","));
|
||||
if(!trimColNames) {
|
||||
colNamesWithSep = columns.stream().collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
|
||||
String valuesString = values.toString();
|
||||
valuesString = valuesString.substring(0, valuesString.length() - 1);
|
||||
|
||||
|
||||
valuesString = valuesString.substring(0, Integer.max(0, valuesString.length() - 1));
|
||||
|
||||
StringBuffer sql = new StringBuffer();
|
||||
|
||||
sql.append("INSERT INTO ").append(table);
|
||||
|
@ -47,8 +47,6 @@ import javax.servlet.ServletException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
|
||||
import com.google.refine.importers.tree.TreeReader.Token;
|
||||
import com.google.refine.model.Cell;
|
||||
import com.google.refine.model.Project;
|
||||
|
@ -47,7 +47,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.refine.RefineServlet;
|
||||
|
Loading…
Reference in New Issue
Block a user