Merge pull request #2331 from mrcsparker/remove-deprecation
Replaced some deprecated methods
This commit is contained in:
commit
bf5152a1ed
@ -13,7 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.lang3.text.StrSubstitutor;
|
||||
import org.apache.commons.text.StringSubstitutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -438,7 +438,7 @@ public class DBExtensionTestUtils {
|
||||
substitutes.put("dbName", dbConfig.getDatabaseName());
|
||||
substitutes.put("useSSL", dbConfig.isUseSSL());
|
||||
String urlTemplate = "jdbc:${dbType}://${host}:${port}/${dbName}?useSSL=${useSSL}";
|
||||
StrSubstitutor strSub = new StrSubstitutor(substitutes);
|
||||
StringSubstitutor strSub = new StringSubstitutor(substitutes);
|
||||
return strSub.replace(urlTemplate);
|
||||
}
|
||||
|
||||
|
@ -318,6 +318,11 @@
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-validator</groupId>
|
||||
<artifactId>commons-validator</artifactId>
|
||||
|
@ -450,7 +450,7 @@ public abstract class ProjectManager {
|
||||
ObjectNode node = (ObjectNode)jsonObj;
|
||||
if (node.get("name").asText("").equals(placeHolderJsonObj.get("name").asText(""))) {
|
||||
found = true;
|
||||
node.put("display", placeHolderJsonObj.get("display"));
|
||||
node.set("display", placeHolderJsonObj.get("display"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -112,8 +112,8 @@ public class LoadLanguageCommand extends Command {
|
||||
if (translations != null) {
|
||||
try {
|
||||
ObjectNode node = ParsingUtilities.mapper.createObjectNode();
|
||||
node.put("dictionary", translations);
|
||||
node.put("lang", new TextNode(bestLang));
|
||||
node.set("dictionary", translations);
|
||||
node.set("lang", new TextNode(bestLang));
|
||||
respondJSON(response, node);
|
||||
} catch (IOException e) {
|
||||
logger.error("Error writing language labels to response stream");
|
||||
@ -158,7 +158,7 @@ public class LoadLanguageCommand extends Command {
|
||||
if (value == null) {;
|
||||
value = entry.getValue();
|
||||
}
|
||||
results.put(code, value);
|
||||
results.set(code, value);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ import java.io.Writer;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.google.refine.ProjectManager;
|
||||
@ -106,7 +106,7 @@ public class HtmlTableExporter implements WriterExporter {
|
||||
writer.write(StringEscapeUtils.escapeHtml4(cellData.link));
|
||||
writer.write("\">");
|
||||
}
|
||||
writer.write(StringEscapeUtils.escapeXml(cellData.text));
|
||||
writer.write(StringEscapeUtils.escapeXml10(cellData.text));
|
||||
if (cellData.link != null) {
|
||||
writer.write("</a>");
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class Chomp implements Function {
|
||||
Object o1 = args[0];
|
||||
Object o2 = args[1];
|
||||
if (o1 != null && o2 != null && o1 instanceof String && o2 instanceof String) {
|
||||
return StringUtils.chomp((String) o1, (String) o2);
|
||||
return StringUtils.removeEnd((String) o1, (String) o2);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -37,7 +37,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
|
@ -48,7 +48,7 @@ public class SHA1 implements Function {
|
||||
if (args.length == 1 && args[0] != null) {
|
||||
Object o = args[0];
|
||||
String s = (o instanceof String) ? (String) o : o.toString();
|
||||
return DigestUtils.shaHex(s);
|
||||
return DigestUtils.sha1Hex(s);
|
||||
}
|
||||
return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a string");
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ package com.google.refine.expr.functions.strings;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.apache.commons.text.WordUtils;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
|
@ -37,7 +37,7 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
import com.google.refine.expr.EvalError;
|
||||
import com.google.refine.grel.ControlFunctionRegistry;
|
||||
|
@ -47,7 +47,7 @@ import java.util.Map;
|
||||
|
||||
import org.apache.poi.ooxml.POIXMLException;
|
||||
import org.apache.poi.common.usermodel.Hyperlink;
|
||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.ss.usermodel.CellType;
|
||||
@ -258,8 +258,8 @@ public class ExcelImporter extends TabularImportingParserBase {
|
||||
} else if (cellType.equals(CellType.NUMERIC)) {
|
||||
double d = cell.getNumericCellValue();
|
||||
|
||||
if (HSSFDateUtil.isCellDateFormatted(cell)) {
|
||||
value = HSSFDateUtil.getJavaDate(d);
|
||||
if (DateUtil.isCellDateFormatted(cell)) {
|
||||
value = DateUtil.getJavaDate(d);
|
||||
// TODO: If we had a time datatype, we could use something like the following
|
||||
// to distinguish times from dates (although Excel doesn't really make the distinction)
|
||||
// Another alternative would be to look for values < 0.60
|
||||
|
@ -89,7 +89,7 @@ public class JsonImporter extends TreeImportingParserBase {
|
||||
ObjectNode firstFileRecord = fileRecords.get(0);
|
||||
File file = ImportingUtilities.getFile(job, firstFileRecord);
|
||||
JsonFactory factory = new JsonFactory();
|
||||
JsonParser parser = factory.createJsonParser(file);
|
||||
JsonParser parser = factory.createParser(file);
|
||||
|
||||
PreviewParsingState state = new PreviewParsingState();
|
||||
JsonNode rootValue = parseForPreview(parser, state);
|
||||
@ -223,7 +223,7 @@ public class JsonImporter extends TreeImportingParserBase {
|
||||
|
||||
public JSONTreeReader(InputStream is) {
|
||||
try {
|
||||
parser = factory.createJsonParser(is);
|
||||
parser = factory.createParser(is);
|
||||
current = null;
|
||||
next = parser.nextToken();
|
||||
} catch (IOException e) {
|
||||
|
@ -49,7 +49,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.text.StringEscapeUtils;
|
||||
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.refine.ProjectMetadata;
|
||||
|
@ -186,7 +186,7 @@ public class XmlImporter extends TreeImportingParserBase {
|
||||
}
|
||||
|
||||
if (children.size() > 0) {
|
||||
result.put("c", children);
|
||||
result.set("c", children);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public class JSONUtilities {
|
||||
}
|
||||
|
||||
static public void safePut(ObjectNode options, String key, JsonNode rootElement) {
|
||||
options.put(key, rootElement);
|
||||
options.set(key, rootElement);
|
||||
}
|
||||
|
||||
static public void safeInc(ObjectNode obj, String key) {
|
||||
|
Loading…
Reference in New Issue
Block a user