exceptionfactory opened a new pull request, #8248:
URL: https://github.com/apache/nifi/pull/8248
# Summary
[NIFI-9458](https://issues.apache.org/jira/browse/NIFI-9458) Replaces direct
use of
[java.text.SimpleDateFormat](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
with
[java.time.format.DateTimeFormatter](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html)
across component utilities and test classes.
`SimpleDateFormat` handles parsing and formatting instances of
[java.util.Date](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html)
but it lacks features such as nanosecond precision, and can be subject to
subtle conversion issues with time zone offsets.
`DateTimeFormatter` provides parsing and formatting for newer `java.time`
classes, which provide greater precision than other types like `java.sql.Time`
and `java.sql.Timestamp`.
Pattern characters for `DateTimeFormatter` are largely similar to
`SimpleDateFormat`, with several additional characters supporting nanoseconds
and optional boundaries. Some formatting patterns are more strict, which could
lead to parsing failures on some existing custom formats. This is a primary
reason for including these changes as part of the NiFi 2.0 release version.
Functional changes include removing date and time handling methods from the
`DataTypeUtils` class and adding new `FieldConverter` implementations in the
same `nifi-record` module. The new `StandardFieldConverterRegistry` provides an
abstraction for retrieving registered instances of `FieldConverter` based on
the expected output field type. The `FieldConverter` interface approach
provides a more maintainable and focused approach to object conversion while
the `FieldConverterRegistry` provides a similar level of reference convenience.
Instances of `DateTimeFormatter` are thread-safe, unlike `SimpleDateFormat`,
which enables instance caching inside the `StandardFieldConverterRegistry`.
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [X] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue
created
### Pull Request Tracking
- [X] Pull Request title starts with Apache NiFi Jira issue number, such as
`NIFI-0`
- [X] Pull Request commit message starts with Apache NiFi Jira issue number,
as such `NIFI-0`
### Pull Request Formatting
- [X] Pull Request based on current revision of the `main` branch
- [X] Pull Request refers to a feature branch with one commit containing
changes
# Verification
Please indicate the verification steps performed prior to pull request
creation.
### Build
- [X] Build completed using `mvn clean install -P contrib-check`
- [X] JDK 21
### Licensing
- [ ] New dependencies are compatible with the [Apache License
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License
Policy](https://www.apache.org/legal/resolved.html)
- [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE`
files
### Documentation
- [ ] Documentation formatting appears as expected in rendered files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org