Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-5272

java.lang.UnsupportedOperationException in the Time component

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.0.3
    • 6.2.0
    • None
    • None

    Description

      We are facing a java.lang.UnsupportedOperationException on some java.sql.Time fields in our frontend after migrating from 2.5.26 to 6.0.3.

      Error 12/22/2022 09:52:20:122 Caused by: java.lang.UnsupportedOperationException
      Error 12/22/2022 09:52:20:122 at java.sql.Time.toInstant(Time.java:291)
      Error 12/22/2022 09:52:20:122 at org.apache.struts2.components.Date.end(Date.java:299)
      Error 12/22/2022 09:52:20:122 at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:40)
      Error 12/22/2022 09:52:20:122 at JEE_jsp_pages_ReadTicketGoing_1671640129851._jspx_method_s_date_2(JEE_jsp_pages_ReadTicketGoing_1671640129851.java:408)
      Error 12/22/2022 09:52:20:122 at JEE_jsp_pages_ReadTicketGoing_1671640129851._jspx_method_s_form_0(JEE_jsp_pages_ReadTicketGoing_1671640129851.java:1950)
      Error 12/22/2022 09:52:20:122 at JEE_jsp_pages_ReadTicketGoing_1671640129851._jspService(JEE_jsp_pages_ReadTicketGoing_1671640129851.java:60)
      ...
       
      At line 299 in Date.java there is no code related to java.sql.Time
      https://github.com/apache/struts/blob/STRUTS_6_0_3/core/src/main/java/org/apache/struts2/components/Date.java#L299
       
      java.sql.Time extends java.util.Date so when dateObject is java.sql.Time is treated like an instanceof java.util.Date and toInstant() throws the UnsupportedOperationException.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              massimilianodelmatto Massimiliano Del Matto
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m