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:
Tom Morris 2020-06-14 15:18:02 -04:00 committed by GitHub
parent 03c860d961
commit bf1c890cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;