kwin commented on a change in pull request #11:
URL:
https://github.com/apache/sling-org-apache-sling-scripting-sightly/pull/11#discussion_r673037597
##########
File path:
src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/FormatFilterExtension.java
##########
@@ -176,47 +187,39 @@ private String toString(RuntimeObjectModel
runtimeObjectModel, Object[] params,
return "";
}
- private int getPredefinedFormattingStyleFromValue(String value) {
+ private FormatStyle getPredefinedFormattingStyleFromValue(String value) {
switch (value.toLowerCase(Locale.ROOT)) {
case "default":
- return DateFormat.DEFAULT;
- case "short":
- return DateFormat.SHORT;
case "medium":
- return DateFormat.MEDIUM;
+ return FormatStyle.MEDIUM;
+ case "short":
+ return FormatStyle.SHORT;
case "long":
- return DateFormat.LONG;
+ return FormatStyle.LONG;
case "full":
- return DateFormat.FULL;
+ return FormatStyle.FULL;
default:
- return -1;
+ return null;
}
}
- private String formatDate(String format, Date date, Locale locale,
TimeZone timezone) {
+ private String formatDate(String format, Date date, Locale locale,
TimeZone timezone, DateTimeFormatter formatter) {
if (date == null) {
return null;
}
try {
- final DateFormat formatter;
- int formattingStyle =
getPredefinedFormattingStyleFromValue(format);
- if (formattingStyle != -1) {
- if (locale != null) {
- formatter = DateFormat.getDateInstance(formattingStyle,
locale);
+ if (formatter == null) {
Review comment:
where is this private method called with formatter != null? Why do we
need that parameter?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]