mirror of https://github.com/apache/nifi.git
NIFI-225: Change Locale to always be EN-US
This commit is contained in:
parent
645837491c
commit
93309901ba
|
@ -19,6 +19,7 @@ package org.apache.nifi.attribute.expression.language.evaluation.cast;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -66,7 +67,7 @@ public class DateCastEvaluator extends DateEvaluator {
|
||||||
case STRING:
|
case STRING:
|
||||||
final String value = ((StringQueryResult) result).getValue().trim();
|
final String value = ((StringQueryResult) result).getValue().trim();
|
||||||
if (DATE_TO_STRING_PATTERN.matcher(value).matches()) {
|
if (DATE_TO_STRING_PATTERN.matcher(value).matches()) {
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat(DATE_TO_STRING_FORMAT);
|
final SimpleDateFormat sdf = new SimpleDateFormat(DATE_TO_STRING_FORMAT, Locale.US);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Date date = sdf.parse(value);
|
final Date date = sdf.parse(value);
|
||||||
|
@ -89,7 +90,7 @@ public class DateCastEvaluator extends DateEvaluator {
|
||||||
format = ALTERNATE_FORMAT_WITH_MILLIS;
|
format = ALTERNATE_FORMAT_WITH_MILLIS;
|
||||||
}
|
}
|
||||||
|
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat(format);
|
final SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Date date = sdf.parse(value);
|
final Date date = sdf.parse(value);
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.nifi.attribute.expression.language.evaluation.functions;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.nifi.attribute.expression.language.evaluation.DateEvaluator;
|
import org.apache.nifi.attribute.expression.language.evaluation.DateEvaluator;
|
||||||
|
@ -49,7 +50,7 @@ public class FormatEvaluator extends StringEvaluator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new StringQueryResult(new SimpleDateFormat(format).format(subjectValue));
|
return new StringQueryResult(new SimpleDateFormat(format, Locale.US).format(subjectValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.nifi.attribute.expression.language.evaluation.functions;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.nifi.attribute.expression.language.evaluation.DateEvaluator;
|
import org.apache.nifi.attribute.expression.language.evaluation.DateEvaluator;
|
||||||
|
@ -47,7 +48,7 @@ public class StringToDateEvaluator extends DateEvaluator {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new DateQueryResult(new SimpleDateFormat(formatValue).parse(subjectValue));
|
return new DateQueryResult(new SimpleDateFormat(formatValue, Locale.US).parse(subjectValue));
|
||||||
} catch (final ParseException e) {
|
} catch (final ParseException e) {
|
||||||
throw new IllegalAttributeException("Cannot parse attribute value as a date; date format: "
|
throw new IllegalAttributeException("Cannot parse attribute value as a date; date format: "
|
||||||
+ formatValue + "; attribute value: " + subjectValue);
|
+ formatValue + "; attribute value: " + subjectValue);
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.nifi.attribute.expression.language.Query.Range;
|
import org.apache.nifi.attribute.expression.language.Query.Range;
|
||||||
|
@ -32,7 +33,6 @@ import org.apache.nifi.attribute.expression.language.evaluation.QueryResult;
|
||||||
import org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageParsingException;
|
import org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageParsingException;
|
||||||
import org.apache.nifi.expression.AttributeExpression.ResultType;
|
import org.apache.nifi.expression.AttributeExpression.ResultType;
|
||||||
import org.apache.nifi.flowfile.FlowFile;
|
import org.apache.nifi.flowfile.FlowFile;
|
||||||
|
|
||||||
import org.antlr.runtime.tree.Tree;
|
import org.antlr.runtime.tree.Tree;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
@ -203,7 +203,7 @@ public class TestQuery {
|
||||||
|
|
||||||
// the date.toString() above will end up truncating the milliseconds. So remove millis from the Date before
|
// the date.toString() above will end up truncating the milliseconds. So remove millis from the Date before
|
||||||
// formatting it
|
// formatting it
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS");
|
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS", Locale.US);
|
||||||
final long millis = date.getTime() % 1000L;
|
final long millis = date.getTime() % 1000L;
|
||||||
final Date roundedToNearestSecond = new Date(date.getTime() - millis);
|
final Date roundedToNearestSecond = new Date(date.getTime() - millis);
|
||||||
final String formatted = sdf.format(roundedToNearestSecond);
|
final String formatted = sdf.format(roundedToNearestSecond);
|
||||||
|
@ -458,7 +458,7 @@ public class TestQuery {
|
||||||
final String query = "startDateTime=\"${date:toNumber():toDate():format(\"" + format + "\")}\"";
|
final String query = "startDateTime=\"${date:toNumber():toDate():format(\"" + format + "\")}\"";
|
||||||
final String result = Query.evaluateExpressions(query, attributes, null);
|
final String result = Query.evaluateExpressions(query, attributes, null);
|
||||||
|
|
||||||
final String expectedTime = new SimpleDateFormat(format).format(timestamp);
|
final String expectedTime = new SimpleDateFormat(format, Locale.US).format(timestamp);
|
||||||
assertEquals("startDateTime=\"" + expectedTime + "\"", result);
|
assertEquals("startDateTime=\"" + expectedTime + "\"", result);
|
||||||
|
|
||||||
final List<Range> ranges = Query.extractExpressionRanges(query);
|
final List<Range> ranges = Query.extractExpressionRanges(query);
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.nifi.util;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -64,7 +65,7 @@ public class FormatUtils {
|
||||||
*/
|
*/
|
||||||
public static String formatMinutesSeconds(final long sourceDuration, final TimeUnit sourceUnit) {
|
public static String formatMinutesSeconds(final long sourceDuration, final TimeUnit sourceUnit) {
|
||||||
final long millis = TimeUnit.MILLISECONDS.convert(sourceDuration, sourceUnit);
|
final long millis = TimeUnit.MILLISECONDS.convert(sourceDuration, sourceUnit);
|
||||||
final SimpleDateFormat formatter = new SimpleDateFormat("mm:ss.SSS");
|
final SimpleDateFormat formatter = new SimpleDateFormat("mm:ss.SSS", Locale.US);
|
||||||
return formatter.format(new Date(millis));
|
return formatter.format(new Date(millis));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ public class FormatUtils {
|
||||||
final int hours = (int) (millis / millisInHour);
|
final int hours = (int) (millis / millisInHour);
|
||||||
final long whatsLeft = millis - hours * millisInHour;
|
final long whatsLeft = millis - hours * millisInHour;
|
||||||
|
|
||||||
return pad(hours) + ":" + new SimpleDateFormat("mm:ss.SSS").format(new Date(whatsLeft));
|
return pad(hours) + ":" + new SimpleDateFormat("mm:ss.SSS", Locale.US).format(new Date(whatsLeft));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String pad(final int val) {
|
private static String pad(final int val) {
|
||||||
|
|
|
@ -18,7 +18,9 @@ package org.apache.nifi.web.api.dto.util;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,14 +32,14 @@ public class DateTimeAdapter extends XmlAdapter<String, Date> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String marshal(Date date) throws Exception {
|
public String marshal(Date date) throws Exception {
|
||||||
final SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT);
|
final SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT, Locale.US);
|
||||||
formatter.setTimeZone(TimeZone.getDefault());
|
formatter.setTimeZone(TimeZone.getDefault());
|
||||||
return formatter.format(date);
|
return formatter.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date unmarshal(String date) throws Exception {
|
public Date unmarshal(String date) throws Exception {
|
||||||
final SimpleDateFormat parser = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT);
|
final SimpleDateFormat parser = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT, Locale.US);
|
||||||
parser.setTimeZone(TimeZone.getDefault());
|
parser.setTimeZone(TimeZone.getDefault());
|
||||||
return parser.parse(date);
|
return parser.parse(date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@ package org.apache.nifi.web.api.dto.util;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,14 +32,14 @@ public class TimeAdapter extends XmlAdapter<String, Date> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String marshal(Date date) throws Exception {
|
public String marshal(Date date) throws Exception {
|
||||||
final SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_TIME_FORMAT);
|
final SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_TIME_FORMAT, Locale.US);
|
||||||
formatter.setTimeZone(TimeZone.getDefault());
|
formatter.setTimeZone(TimeZone.getDefault());
|
||||||
return formatter.format(date);
|
return formatter.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date unmarshal(String date) throws Exception {
|
public Date unmarshal(String date) throws Exception {
|
||||||
final SimpleDateFormat parser = new SimpleDateFormat(DEFAULT_TIME_FORMAT);
|
final SimpleDateFormat parser = new SimpleDateFormat(DEFAULT_TIME_FORMAT, Locale.US);
|
||||||
parser.setTimeZone(TimeZone.getDefault());
|
parser.setTimeZone(TimeZone.getDefault());
|
||||||
return parser.parse(date);
|
return parser.parse(date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@ package org.apache.nifi.web.api.dto.util;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,14 +32,14 @@ public class TimestampAdapter extends XmlAdapter<String, Date> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String marshal(Date date) throws Exception {
|
public String marshal(Date date) throws Exception {
|
||||||
final SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT);
|
final SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT, Locale.US);
|
||||||
formatter.setTimeZone(TimeZone.getDefault());
|
formatter.setTimeZone(TimeZone.getDefault());
|
||||||
return formatter.format(date);
|
return formatter.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date unmarshal(String date) throws Exception {
|
public Date unmarshal(String date) throws Exception {
|
||||||
final SimpleDateFormat parser = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT);
|
final SimpleDateFormat parser = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT, Locale.US);
|
||||||
parser.setTimeZone(TimeZone.getDefault());
|
parser.setTimeZone(TimeZone.getDefault());
|
||||||
return parser.parse(date);
|
return parser.parse(date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,10 @@ import java.net.InetSocketAddress;
|
||||||
import java.net.MulticastSocket;
|
import java.net.MulticastSocket;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import org.apache.nifi.cluster.protocol.ProtocolContext;
|
import org.apache.nifi.cluster.protocol.ProtocolContext;
|
||||||
import org.apache.nifi.cluster.protocol.ProtocolException;
|
import org.apache.nifi.cluster.protocol.ProtocolException;
|
||||||
import org.apache.nifi.cluster.protocol.ProtocolHandler;
|
import org.apache.nifi.cluster.protocol.ProtocolHandler;
|
||||||
|
@ -85,7 +87,7 @@ public class MulticastTestClient {
|
||||||
@Override
|
@Override
|
||||||
public ProtocolMessage handle(ProtocolMessage msg) throws ProtocolException {
|
public ProtocolMessage handle(ProtocolMessage msg) throws ProtocolException {
|
||||||
final PingMessage pingMsg = (PingMessage) msg;
|
final PingMessage pingMsg = (PingMessage) msg;
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.US);
|
||||||
logger.info("Pinged at: " + sdf.format(pingMsg.getDate()));
|
logger.info("Pinged at: " + sdf.format(pingMsg.getDate()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,14 @@
|
||||||
package org.apache.nifi.cluster.manager.impl;
|
package org.apache.nifi.cluster.manager.impl;
|
||||||
|
|
||||||
import org.apache.nifi.cluster.manager.impl.WebClusterManager;
|
import org.apache.nifi.cluster.manager.impl.WebClusterManager;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -30,7 +32,7 @@ public class TestWebClusterManager {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalizedStatusSnapshotDate() throws ParseException {
|
public void testNormalizedStatusSnapshotDate() throws ParseException {
|
||||||
final DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:SS.SSS");
|
final DateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:SS.SSS", Locale.US);
|
||||||
final Date date1 = df.parse("2014/01/01 00:00:00.000");
|
final Date date1 = df.parse("2014/01/01 00:00:00.000");
|
||||||
final Date date2 = df.parse("2014/01/01 00:04:59.999");
|
final Date date2 = df.parse("2014/01/01 00:04:59.999");
|
||||||
final Date date3 = df.parse("2014/01/01 00:05:00.000");
|
final Date date3 = df.parse("2014/01/01 00:05:00.000");
|
||||||
|
|
|
@ -536,6 +536,6 @@ public class StandardFunnel implements Funnel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchedulingStrategy getSchedulingStrategy() {
|
public SchedulingStrategy getSchedulingStrategy() {
|
||||||
return SchedulingStrategy.EVENT_DRIVEN;
|
return SchedulingStrategy.TIMER_DRIVEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.io.StringWriter;
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class LogMessage {
|
public class LogMessage {
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ public class LogMessage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final DateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
|
final DateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT, Locale.US);
|
||||||
final String formattedTime = dateFormat.format(new Date(time));
|
final String formattedTime = dateFormat.format(new Date(time));
|
||||||
|
|
||||||
String formattedMsg = String.format(TO_STRING_FORMAT, formattedTime, level.toString(), message);
|
String formattedMsg = String.format(TO_STRING_FORMAT, formattedTime, level.toString(), message);
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class LocalPort extends AbstractPort {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchedulingStrategy getSchedulingStrategy() {
|
public SchedulingStrategy getSchedulingStrategy() {
|
||||||
return SchedulingStrategy.EVENT_DRIVEN;
|
return SchedulingStrategy.TIMER_DRIVEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -181,7 +182,6 @@ import org.apache.nifi.web.api.dto.RemoteProcessGroupDTO;
|
||||||
import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
|
import org.apache.nifi.web.api.dto.RemoteProcessGroupPortDTO;
|
||||||
import org.apache.nifi.web.api.dto.TemplateDTO;
|
import org.apache.nifi.web.api.dto.TemplateDTO;
|
||||||
import org.apache.nifi.web.api.dto.status.StatusHistoryDTO;
|
import org.apache.nifi.web.api.dto.status.StatusHistoryDTO;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -3209,7 +3209,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
|
||||||
private class BulletinsTask implements Runnable {
|
private class BulletinsTask implements Runnable {
|
||||||
|
|
||||||
private final NodeProtocolSender protocolSender;
|
private final NodeProtocolSender protocolSender;
|
||||||
private final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
|
private final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS", Locale.US);
|
||||||
|
|
||||||
public BulletinsTask(NodeProtocolSender protocolSender) {
|
public BulletinsTask(NodeProtocolSender protocolSender) {
|
||||||
if (protocolSender == null) {
|
if (protocolSender == null) {
|
||||||
|
@ -3315,7 +3315,7 @@ public class FlowController implements EventAccess, ControllerServiceProvider, H
|
||||||
private class HeartbeatSendTask implements Runnable {
|
private class HeartbeatSendTask implements Runnable {
|
||||||
|
|
||||||
private final NodeProtocolSender protocolSender;
|
private final NodeProtocolSender protocolSender;
|
||||||
private final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
|
private final DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS", Locale.US);
|
||||||
|
|
||||||
public HeartbeatSendTask(final NodeProtocolSender protocolSender) {
|
public HeartbeatSendTask(final NodeProtocolSender protocolSender) {
|
||||||
if (protocolSender == null) {
|
if (protocolSender == null) {
|
||||||
|
|
|
@ -619,7 +619,7 @@ public class StandardRootGroupPort extends AbstractPort implements RootGroupPort
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SchedulingStrategy getSchedulingStrategy() {
|
public SchedulingStrategy getSchedulingStrategy() {
|
||||||
return SchedulingStrategy.EVENT_DRIVEN;
|
return SchedulingStrategy.TIMER_DRIVEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.nifi.web.api.request;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for parsing integer parameters and providing a user friendly error
|
* Class for parsing integer parameters and providing a user friendly error
|
||||||
|
@ -45,7 +46,7 @@ public class DateTimeParameter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String format(final Date date) {
|
public static String format(final Date date) {
|
||||||
SimpleDateFormat parser = new SimpleDateFormat(DATE_TIME_FORMAT);
|
SimpleDateFormat parser = new SimpleDateFormat(DATE_TIME_FORMAT, Locale.US);
|
||||||
parser.setLenient(false);
|
parser.setLenient(false);
|
||||||
return parser.format(date);
|
return parser.format(date);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +56,7 @@ public class DateTimeParameter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date parse(final String str) throws ParseException {
|
public static Date parse(final String str) throws ParseException {
|
||||||
SimpleDateFormat parser = new SimpleDateFormat(DATE_TIME_FORMAT);
|
SimpleDateFormat parser = new SimpleDateFormat(DATE_TIME_FORMAT, Locale.US);
|
||||||
parser.setLenient(false);
|
parser.setLenient(false);
|
||||||
return parser.parse(str);
|
return parser.parse(str);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
@ -304,7 +305,7 @@ public class GetFile extends AbstractProcessor {
|
||||||
FileStore store = Files.getFileStore(file);
|
FileStore store = Files.getFileStore(file);
|
||||||
if (store.supportsFileAttributeView("basic")) {
|
if (store.supportsFileAttributeView("basic")) {
|
||||||
try {
|
try {
|
||||||
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT);
|
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
|
||||||
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
|
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
|
||||||
BasicFileAttributes attrs = view.readAttributes();
|
BasicFileAttributes attrs = view.readAttributes();
|
||||||
attributes.put(FILE_LAST_MODIFY_TIME_ATTRIBUTE, formatter.format(new Date(attrs.lastModifiedTime().toMillis())));
|
attributes.put(FILE_LAST_MODIFY_TIME_ATTRIBUTE, formatter.format(new Date(attrs.lastModifiedTime().toMillis())));
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
@ -257,7 +258,7 @@ public abstract class GetFileTransfer extends AbstractProcessor {
|
||||||
protected Map<String, String> getAttributesFromFile(FileInfo info) {
|
protected Map<String, String> getAttributesFromFile(FileInfo info) {
|
||||||
Map<String, String> attributes = new HashMap<>();
|
Map<String, String> attributes = new HashMap<>();
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT);
|
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
|
||||||
attributes.put(FILE_LAST_MODIFY_TIME_ATTRIBUTE, formatter.format(new Date(info.getLastModifiedTime())));
|
attributes.put(FILE_LAST_MODIFY_TIME_ATTRIBUTE, formatter.format(new Date(info.getLastModifiedTime())));
|
||||||
attributes.put(FILE_PERMISSIONS_ATTRIBUTE, info.getPermissions());
|
attributes.put(FILE_PERMISSIONS_ATTRIBUTE, info.getPermissions());
|
||||||
attributes.put(FILE_OWNER_ATTRIBUTE, info.getOwner());
|
attributes.put(FILE_OWNER_ATTRIBUTE, info.getOwner());
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
@ -61,7 +62,6 @@ import org.apache.nifi.processor.util.StandardValidators;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.ssl.SSLContextService.ClientAuth;
|
import org.apache.nifi.ssl.SSLContextService.ClientAuth;
|
||||||
import org.apache.nifi.util.StopWatch;
|
import org.apache.nifi.util.StopWatch;
|
||||||
|
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.auth.AuthScope;
|
import org.apache.http.auth.AuthScope;
|
||||||
|
@ -173,7 +173,7 @@ public class GetHTTP extends AbstractSessionFactoryProcessor {
|
||||||
static final String LAST_MODIFIED = "LastModified";
|
static final String LAST_MODIFIED = "LastModified";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(LAST_MODIFIED_DATE_PATTERN_RFC1123);
|
SimpleDateFormat sdf = new SimpleDateFormat(LAST_MODIFIED_DATE_PATTERN_RFC1123, Locale.US);
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
UNINITIALIZED_LAST_MODIFIED_VALUE = sdf.format(new Date(1L));
|
UNINITIALIZED_LAST_MODIFIED_VALUE = sdf.format(new Date(1L));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -226,7 +227,7 @@ public class PutFile extends AbstractProcessor {
|
||||||
final String lastModifiedTime = context.getProperty(CHANGE_LAST_MODIFIED_TIME).evaluateAttributeExpressions(flowFile).getValue();
|
final String lastModifiedTime = context.getProperty(CHANGE_LAST_MODIFIED_TIME).evaluateAttributeExpressions(flowFile).getValue();
|
||||||
if (lastModifiedTime != null && !lastModifiedTime.trim().isEmpty()) {
|
if (lastModifiedTime != null && !lastModifiedTime.trim().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT);
|
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
|
||||||
final Date fileModifyTime = formatter.parse(lastModifiedTime);
|
final Date fileModifyTime = formatter.parse(lastModifiedTime);
|
||||||
dotCopyFile.toFile().setLastModified(fileModifyTime.getTime());
|
dotCopyFile.toFile().setLastModified(fileModifyTime.getTime());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -28,6 +28,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -37,7 +38,6 @@ import org.apache.nifi.logging.ProcessorLog;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
|
|
||||||
import org.apache.commons.net.ftp.FTPClient;
|
import org.apache.commons.net.ftp.FTPClient;
|
||||||
import org.apache.commons.net.ftp.FTPFile;
|
import org.apache.commons.net.ftp.FTPFile;
|
||||||
import org.apache.commons.net.ftp.FTPReply;
|
import org.apache.commons.net.ftp.FTPReply;
|
||||||
|
@ -346,9 +346,9 @@ public class FTPTransfer implements FileTransfer {
|
||||||
final String lastModifiedTime = ctx.getProperty(LAST_MODIFIED_TIME).evaluateAttributeExpressions(flowFile).getValue();
|
final String lastModifiedTime = ctx.getProperty(LAST_MODIFIED_TIME).evaluateAttributeExpressions(flowFile).getValue();
|
||||||
if (lastModifiedTime != null && !lastModifiedTime.trim().isEmpty()) {
|
if (lastModifiedTime != null && !lastModifiedTime.trim().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
final DateFormat informat = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT);
|
final DateFormat informat = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
|
||||||
final Date fileModifyTime = informat.parse(lastModifiedTime);
|
final Date fileModifyTime = informat.parse(lastModifiedTime);
|
||||||
final DateFormat outformat = new SimpleDateFormat(FTP_TIMEVAL_FORMAT);
|
final DateFormat outformat = new SimpleDateFormat(FTP_TIMEVAL_FORMAT, Locale.US);
|
||||||
final String time = outformat.format(fileModifyTime);
|
final String time = outformat.format(fileModifyTime);
|
||||||
if (!client.setModificationTime(tempFilename, time)) {
|
if (!client.setModificationTime(tempFilename, time)) {
|
||||||
// FTP server probably doesn't support MFMT command
|
// FTP server probably doesn't support MFMT command
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -37,7 +38,6 @@ import org.apache.nifi.flowfile.FlowFile;
|
||||||
import org.apache.nifi.logging.ProcessorLog;
|
import org.apache.nifi.logging.ProcessorLog;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processor.util.StandardValidators;
|
import org.apache.nifi.processor.util.StandardValidators;
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.jcraft.jsch.ChannelSftp;
|
import com.jcraft.jsch.ChannelSftp;
|
||||||
|
@ -524,7 +524,7 @@ public class SFTPTransfer implements FileTransfer {
|
||||||
final String lastModifiedTime = ctx.getProperty(LAST_MODIFIED_TIME).evaluateAttributeExpressions(flowFile).getValue();
|
final String lastModifiedTime = ctx.getProperty(LAST_MODIFIED_TIME).evaluateAttributeExpressions(flowFile).getValue();
|
||||||
if (lastModifiedTime != null && !lastModifiedTime.trim().isEmpty()) {
|
if (lastModifiedTime != null && !lastModifiedTime.trim().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT);
|
final DateFormat formatter = new SimpleDateFormat(FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
|
||||||
final Date fileModifyTime = formatter.parse(lastModifiedTime);
|
final Date fileModifyTime = formatter.parse(lastModifiedTime);
|
||||||
int time = (int) (fileModifyTime.getTime() / 1000L);
|
int time = (int) (fileModifyTime.getTime() / 1000L);
|
||||||
sftp.setMtime(tempPath, time);
|
sftp.setMtime(tempPath, time);
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.nifi.processors.standard;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
|
@ -42,7 +43,7 @@ public class RESTServiceContentModified extends HttpServlet {
|
||||||
String ifModifiedSince = request.getHeader("If-Modified-Since");
|
String ifModifiedSince = request.getHeader("If-Modified-Since");
|
||||||
String ifNoneMatch = request.getHeader("If-None-Match");
|
String ifNoneMatch = request.getHeader("If-None-Match");
|
||||||
|
|
||||||
final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
|
final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
|
||||||
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
|
|
||||||
response.setContentType("application/json");
|
response.setContentType("application/json");
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.nifi.processors.standard;
|
package org.apache.nifi.processors.standard;
|
||||||
|
|
||||||
import org.apache.nifi.processors.standard.GetFile;
|
import org.apache.nifi.processors.standard.GetFile;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
@ -31,12 +32,12 @@ import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
import org.apache.nifi.flowfile.attributes.CoreAttributes;
|
||||||
import org.apache.nifi.util.MockFlowFile;
|
import org.apache.nifi.util.MockFlowFile;
|
||||||
import org.apache.nifi.util.TestRunner;
|
import org.apache.nifi.util.TestRunner;
|
||||||
import org.apache.nifi.util.TestRunners;
|
import org.apache.nifi.util.TestRunners;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class TestGetFile {
|
public class TestGetFile {
|
||||||
|
@ -83,7 +84,7 @@ public class TestGetFile {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTodaysFilesPickedUp() throws IOException {
|
public void testTodaysFilesPickedUp() throws IOException {
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
|
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.US);
|
||||||
final String dirStruc = sdf.format(new Date());
|
final String dirStruc = sdf.format(new Date());
|
||||||
|
|
||||||
final File directory = new File("target/test/data/in/" + dirStruc);
|
final File directory = new File("target/test/data/in/" + dirStruc);
|
||||||
|
@ -107,7 +108,7 @@ public class TestGetFile {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPath() throws IOException {
|
public void testPath() throws IOException {
|
||||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/");
|
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/", Locale.US);
|
||||||
final String dirStruc = sdf.format(new Date());
|
final String dirStruc = sdf.format(new Date());
|
||||||
|
|
||||||
final File directory = new File("target/test/data/in/" + dirStruc);
|
final File directory = new File("target/test/data/in/" + dirStruc);
|
||||||
|
@ -171,7 +172,7 @@ public class TestGetFile {
|
||||||
|
|
||||||
if (verifyLastModified) {
|
if (verifyLastModified) {
|
||||||
try {
|
try {
|
||||||
final DateFormat formatter = new SimpleDateFormat(GetFile.FILE_MODIFY_DATE_ATTR_FORMAT);
|
final DateFormat formatter = new SimpleDateFormat(GetFile.FILE_MODIFY_DATE_ATTR_FORMAT, Locale.US);
|
||||||
final Date fileModifyTime = formatter.parse(successFiles.get(0).getAttribute("file.lastModifiedTime"));
|
final Date fileModifyTime = formatter.parse(successFiles.get(0).getAttribute("file.lastModifiedTime"));
|
||||||
assertEquals(new Date(1000000000), fileModifyTime);
|
assertEquals(new Date(1000000000), fileModifyTime);
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.nifi.processors.standard;
|
package org.apache.nifi.processors.standard;
|
||||||
|
|
||||||
import org.apache.nifi.processors.standard.InvokeHTTP;
|
import org.apache.nifi.processors.standard.InvokeHTTP;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -26,6 +27,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
@ -38,7 +40,6 @@ import org.apache.nifi.ssl.StandardSSLContextService;
|
||||||
import org.apache.nifi.util.MockFlowFile;
|
import org.apache.nifi.util.MockFlowFile;
|
||||||
import org.apache.nifi.util.TestRunner;
|
import org.apache.nifi.util.TestRunner;
|
||||||
import org.apache.nifi.util.TestRunners;
|
import org.apache.nifi.util.TestRunners;
|
||||||
|
|
||||||
import org.eclipse.jetty.server.Handler;
|
import org.eclipse.jetty.server.Handler;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
|
@ -123,7 +124,7 @@ public class TestInvokeHTTP {
|
||||||
|
|
||||||
// extract the date string sent to the server
|
// extract the date string sent to the server
|
||||||
// and store it as a java.util.Date
|
// and store it as a java.util.Date
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
|
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
|
||||||
Date date = sdf.parse(dh.dateString);
|
Date date = sdf.parse(dh.dateString);
|
||||||
|
|
||||||
// calculate the difference between the date string sent by the client and
|
// calculate the difference between the date string sent by the client and
|
||||||
|
|
Loading…
Reference in New Issue