mirror of
https://github.com/apache/nifi.git
synced 2025-02-19 17:04:58 +00:00
NIFI-2584 Fixing date format in PutSQL
This closes #878. Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
parent
3d1a24ab7d
commit
7bc7b7f683
@ -779,7 +779,7 @@ public class PutSQL extends AbstractProcessor {
|
|||||||
if(LONG_PATTERN.matcher(parameterValue).matches()){
|
if(LONG_PATTERN.matcher(parameterValue).matches()){
|
||||||
lTimestamp = Long.parseLong(parameterValue);
|
lTimestamp = Long.parseLong(parameterValue);
|
||||||
}else {
|
}else {
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
java.util.Date parsedDate = dateFormat.parse(parameterValue);
|
java.util.Date parsedDate = dateFormat.parse(parameterValue);
|
||||||
lTimestamp = parsedDate.getTime();
|
lTimestamp = parsedDate.getTime();
|
||||||
}
|
}
|
||||||
|
@ -276,9 +276,9 @@ public class TestPutSQL {
|
|||||||
runner.enableControllerService(service);
|
runner.enableControllerService(service);
|
||||||
runner.setProperty(PutSQL.CONNECTION_POOL, "dbcp");
|
runner.setProperty(PutSQL.CONNECTION_POOL, "dbcp");
|
||||||
|
|
||||||
final String arg2TS = "2001-01-01 23:01:01.001";
|
final String arg2TS = "2001-01-01 00:01:01.001";
|
||||||
final String art3TS = "2002-02-02 22:02:02.002";
|
final String art3TS = "2002-02-02 12:02:02.002";
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
java.util.Date parsedDate = dateFormat.parse(arg2TS);
|
java.util.Date parsedDate = dateFormat.parse(arg2TS);
|
||||||
|
|
||||||
final Map<String, String> attributes = new HashMap<>();
|
final Map<String, String> attributes = new HashMap<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user