[struts] branch WW-5272-time created (now df110596c)

2022-12-28 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch WW-5272-time
in repository https://gitbox.apache.org/repos/asf/struts.git


  at df110596c WW-5272 Extends  to support java.sql.Time

This branch includes the following new commits:

 new df110596c WW-5272 Extends  to support java.sql.Time

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[struts] 01/01: WW-5272 Extends to support java.sql.Time

2022-12-28 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5272-time
in repository https://gitbox.apache.org/repos/asf/struts.git

commit df110596c57318935a10665529eaf6b3f215b4fa
Author: Lukasz Lenart 
AuthorDate: Wed Dec 28 10:13:04 2022 +0100

WW-5272 Extends  to support java.sql.Time
---
 .../java/org/apache/struts2/components/Date.java   |  5 +++-
 .../components/date/SimpleDateFormatAdapter.java   |  2 +-
 .../org/apache/struts2/components/DateTest.java| 32 --
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/components/Date.java 
b/core/src/main/java/org/apache/struts2/components/Date.java
index 7a8cda061..de640cbda 100644
--- a/core/src/main/java/org/apache/struts2/components/Date.java
+++ b/core/src/main/java/org/apache/struts2/components/Date.java
@@ -32,6 +32,7 @@ import java.io.Writer;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
 import java.util.ArrayList;
@@ -294,7 +295,9 @@ public class Date extends ContextBean {
 // find the name on the valueStack
 Object dateObject = findValue(name);
 if (dateObject instanceof java.sql.Date) {
-date = ((java.sql.Date) dateObject).toLocalDate().atStartOfDay(tz);
+date = ((java.sql.Date) 
dateObject).toLocalDate().atTime(LocalTime.now(tz)).atZone(tz);
+} else if (dateObject instanceof java.sql.Time) {
+date = ((java.sql.Time) 
dateObject).toLocalTime().atDate(ZonedDateTime.now(tz).toLocalDate()).atZone(tz);
 } else if (dateObject instanceof java.util.Date) {
 date = ((java.util.Date) dateObject).toInstant().atZone(tz);
 } else if (dateObject instanceof Calendar) {
diff --git 
a/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
 
b/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
index 38f3c5296..7bea206f2 100644
--- 
a/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
+++ 
b/core/src/main/java/org/apache/struts2/components/date/SimpleDateFormatAdapter.java
@@ -34,7 +34,7 @@ public class SimpleDateFormatAdapter implements DateFormatter 
{
 DateFormat df;
 Locale locale = ActionContext.getContext().getLocale();
 if (format == null) {
-df = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, locale);
+df = SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, 
DateFormat.MEDIUM, locale);
 } else {
 df = new SimpleDateFormat(format, locale);
 }
diff --git a/core/src/test/java/org/apache/struts2/components/DateTest.java 
b/core/src/test/java/org/apache/struts2/components/DateTest.java
index ffe01a52a..477b128a6 100644
--- a/core/src/test/java/org/apache/struts2/components/DateTest.java
+++ b/core/src/test/java/org/apache/struts2/components/DateTest.java
@@ -66,7 +66,7 @@ public class DateTest extends StrutsInternalTestCase {
 
 java.util.Date now = new java.util.Date();
 
-String expected = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, 
ActionContext.getContext().getLocale()).format(now);
+String expected = prepareFormat().format(now);
 context.put("myDate", now);
 
 Writer writer = new StringWriter();
@@ -88,7 +88,7 @@ public class DateTest extends StrutsInternalTestCase {
 
 java.sql.Date now = new java.sql.Date(System.currentTimeMillis());
 
-String expected = SimpleDateFormat.getDateInstance(DateFormat.MEDIUM, 
ActionContext.getContext().getLocale()).format(now);
+String expected = prepareFormat().format(now);
 context.put("myDate", now);
 
 Writer writer = new StringWriter();
@@ -103,6 +103,34 @@ public class DateTest extends StrutsInternalTestCase {
 assertEquals(expected, writer.toString());
 }
 
+public void testJavaSqlTime() {
+// given
+Date date = new Date(stack);
+date.setDateFormatter(new SimpleDateFormatAdapter());
+
+java.sql.Time now = new java.sql.Time(System.currentTimeMillis());
+
+String timeFormat = "hh:mm:ss";
+String expected = new SimpleDateFormat(timeFormat, 
ActionContext.getContext().getLocale()).format(now);
+context.put("myDate", now);
+
+Writer writer = new StringWriter();
+
+// when
+date.setName("myDate");
+date.setNice(false);
+date.setFormat(timeFormat);
+date.start(writer);
+date.end(writer, "");
+
+// then
+assertEquals(expected, writer.toString());
+}
+
+private DateFormat prepareFormat() {
+return SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, 
DateFormat.MEDIUM, ActionContext.getContext().getLocale());
+}
+
 @Override
 public void set

[struts] branch master updated (266d2d4ed -> bcf2e1151)

2022-12-28 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git


from 266d2d4ed Merge pull request #645 from 
atlassian/WW-5265-remove-container-provider
 add 3bad2d0ce WW-5269 Upgrades Jackson to version 2.14.1
 new bcf2e1151 Merge pull request #647 from apache/WW-5269-jackson

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



[struts] 01/01: Merge pull request #647 from apache/WW-5269-jackson

2022-12-28 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git

commit bcf2e11518739ceab87631e57cb22fdf74a7cfc0
Merge: 266d2d4ed 3bad2d0ce
Author: Lukasz Lenart 
AuthorDate: Wed Dec 28 13:53:02 2022 +0100

Merge pull request #647 from apache/WW-5269-jackson

[WW-5269] Upgrades Jackson to version 2.14.1

 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)