You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Massimiliano Del Matto <ma...@cubemail.it> on 2022/12/21 16:41:04 UTC

java.lang.UnsupportedOperationException in the Time component

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,
the same as reported in https://issues.apache.org/jira/browse/WW-5197 (on
java.sql.Time instead of java.sql.Date). Maybe the same fix should be done
in org.apache.struts2.components.Date.end method also for java.sql.Time
instances?
[image: image.png]

Regards,
Massimiliano

*Massimiliano Del Matto*
Mobile +39 393 8797250

Cube Consultants S.r.l.
Via Francesco Cangiullo, 24 - 00142 Roma <https://goo.gl/maps/DqJU7rr5ZKu>
Tel. +39 06 5200668
Fax +39 06 23327506



*Le informazioni contenute nella presente comunicazione e i relativi
allegati contenuti in questo messaggio sono strettamente riservati ed
esclusivamente indirizzate al destinatario indicato. Vogliate tener
presente che qualsiasi uso, riproduzione o divulgazione di questo messaggio
è vietata. Se questa comunicazione Vi è pervenuta per errore, siete pregati
di informare il mittente rispondendo a questa mail. La diffusione,
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi
soggetto diverso dal destinatario è proibita, sia ai sensi dell’art. 616
c.p. , che ai sensi del Regolamento UE 679/2016.*

Re: java.lang.UnsupportedOperationException in the Time component

Posted by Massimiliano Del Matto <ma...@cubemail.it>.
Done.
https://issues.apache.org/jira/projects/WW/issues/WW-5272?filter=allissues

*Massimiliano Del Matto*
Mobile +39 393 8797250

Cube Consultants S.r.l.
Via Francesco Cangiullo, 24 - 00142 Roma <https://goo.gl/maps/DqJU7rr5ZKu>
Tel. +39 06 5200668
Fax +39 06 23327506



*Le informazioni contenute nella presente comunicazione e i relativi
allegati contenuti in questo messaggio sono strettamente riservati ed
esclusivamente indirizzate al destinatario indicato. Vogliate tener
presente che qualsiasi uso, riproduzione o divulgazione di questo messaggio
è vietata. Se questa comunicazione Vi è pervenuta per errore, siete pregati
di informare il mittente rispondendo a questa mail. La diffusione,
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi
soggetto diverso dal destinatario è proibita, sia ai sensi dell’art. 616
c.p. , che ai sensi del Regolamento UE 679/2016.*


Il giorno dom 25 dic 2022 alle ore 15:46 Lukasz Lenart <
lukaszlenart@apache.org> ha scritto:

> pt., 23 gru 2022 o 12:42 Massimiliano Del Matto
> <ma...@cubemail.it> napisał(a):
> >
> > Might be ok for me.
>
> Would you mind registering an issue in JIRA?
> https://issues.apache.org/jira/browse/WW
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: java.lang.UnsupportedOperationException in the Time component

Posted by Lukasz Lenart <lu...@apache.org>.
pt., 23 gru 2022 o 12:42 Massimiliano Del Matto
<ma...@cubemail.it> napisał(a):
>
> Might be ok for me.

Would you mind registering an issue in JIRA?
https://issues.apache.org/jira/browse/WW


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.UnsupportedOperationException in the Time component

Posted by Massimiliano Del Matto <ma...@cubemail.it>.
Might be ok for me.
Thank you!

Massimiliano
*Massimiliano Del Matto*
Mobile +39 393 8797250

Cube Consultants S.r.l.
Via Francesco Cangiullo, 24 - 00142 Roma <https://goo.gl/maps/DqJU7rr5ZKu>
Tel. +39 06 5200668
Fax +39 06 23327506



*Le informazioni contenute nella presente comunicazione e i relativi
allegati contenuti in questo messaggio sono strettamente riservati ed
esclusivamente indirizzate al destinatario indicato. Vogliate tener
presente che qualsiasi uso, riproduzione o divulgazione di questo messaggio
è vietata. Se questa comunicazione Vi è pervenuta per errore, siete pregati
di informare il mittente rispondendo a questa mail. La diffusione,
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi
soggetto diverso dal destinatario è proibita, sia ai sensi dell’art. 616
c.p. , che ai sensi del Regolamento UE 679/2016.*


Il giorno ven 23 dic 2022 alle ore 12:30 Lukasz Lenart <
lukaszlenart@apache.org> ha scritto:

> pt., 23 gru 2022 o 10:10 Massimiliano Del Matto
> <ma...@cubemail.it> napisał(a):
> >
> > 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.
> > Also java.sql.Date extends java.util.Date and the fix in WW-5197 has been
> > right the add of java.sql.Date:
> >
> https://github.com/apache/struts/pull/574/commits/61ded9a3e7e282bcb9096ca5b3c859c8b45546fa
>
> Right, thanks for pointing this out! There is one more issue,
> java.sql.Time doesn't have date information, so we must assume it will
> be "today" - is that ok?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: java.lang.UnsupportedOperationException in the Time component

Posted by Lukasz Lenart <lu...@apache.org>.
pt., 23 gru 2022 o 10:10 Massimiliano Del Matto
<ma...@cubemail.it> napisał(a):
>
> 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.
> Also java.sql.Date extends java.util.Date and the fix in WW-5197 has been
> right the add of java.sql.Date:
> https://github.com/apache/struts/pull/574/commits/61ded9a3e7e282bcb9096ca5b3c859c8b45546fa

Right, thanks for pointing this out! There is one more issue,
java.sql.Time doesn't have date information, so we must assume it will
be "today" - is that ok?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.UnsupportedOperationException in the Time component

Posted by Massimiliano Del Matto <ma...@cubemail.it>.
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.
Also java.sql.Date extends java.util.Date and the fix in WW-5197 has been
right the add of java.sql.Date:
https://github.com/apache/struts/pull/574/commits/61ded9a3e7e282bcb9096ca5b3c859c8b45546fa

Regards,
Massimiliano
*Massimiliano Del Matto*
Mobile +39 393 8797250

Cube Consultants S.r.l.
Via Francesco Cangiullo, 24 - 00142 Roma <https://goo.gl/maps/DqJU7rr5ZKu>
Tel. +39 06 5200668
Fax +39 06 23327506



*Le informazioni contenute nella presente comunicazione e i relativi
allegati contenuti in questo messaggio sono strettamente riservati ed
esclusivamente indirizzate al destinatario indicato. Vogliate tener
presente che qualsiasi uso, riproduzione o divulgazione di questo messaggio
è vietata. Se questa comunicazione Vi è pervenuta per errore, siete pregati
di informare il mittente rispondendo a questa mail. La diffusione,
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi
soggetto diverso dal destinatario è proibita, sia ai sensi dell’art. 616
c.p. , che ai sensi del Regolamento UE 679/2016.*


Il giorno ven 23 dic 2022 alle ore 08:43 Lukasz Lenart <
lukaszlenart@apache.org> ha scritto:

> czw., 22 gru 2022 o 10:38 Massimiliano Del Matto
> <ma...@cubemail.it> napisał(a):
> > 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)
>
> Are you sure that you use 6.0.3?
>
> Because 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
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: java.lang.UnsupportedOperationException in the Time component

Posted by Lukasz Lenart <lu...@apache.org>.
czw., 22 gru 2022 o 10:38 Massimiliano Del Matto
<ma...@cubemail.it> napisał(a):
> 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)

Are you sure that you use 6.0.3?

Because 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


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: java.lang.UnsupportedOperationException in the Time component

Posted by Massimiliano Del Matto <ma...@cubemail.it>.
Sorry, previously I posted the exception stacktrace as an image.

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)
...

JSP code:
<div class="row">
<div class="col-md-4 control-label customLabel"><s:text
name="label.ticket.time.from.readOnly" /></div>
<%-- <div class="col-md-8 form-control2"><s:date
name="#session.ticket.tripGoingHourFrom"
format="%{getText('pattern.time')}" /></div> --%>
<div class="col-md-8 form-control2"><s:date
name="#session.ticket.tripGoingHourFrom" format="HH:mm" /></div>
</div>

Ticket.java class:
...
import java.sql.Time;
...
private Time tripGoingHourFrom;
...
public Time getTripGoingHourFrom() {
return tripGoingHourFrom;
}
...

*Massimiliano Del Matto*
Mobile +39 393 8797250

Cube Consultants S.r.l.
Via Francesco Cangiullo, 24 - 00142 Roma <https://goo.gl/maps/DqJU7rr5ZKu>
Tel. +39 06 5200668
Fax +39 06 23327506



*Le informazioni contenute nella presente comunicazione e i relativi
allegati contenuti in questo messaggio sono strettamente riservati ed
esclusivamente indirizzate al destinatario indicato. Vogliate tener
presente che qualsiasi uso, riproduzione o divulgazione di questo messaggio
è vietata. Se questa comunicazione Vi è pervenuta per errore, siete pregati
di informare il mittente rispondendo a questa mail. La diffusione,
distribuzione e/o copiatura del documento trasmesso da parte di qualsiasi
soggetto diverso dal destinatario è proibita, sia ai sensi dell’art. 616
c.p. , che ai sensi del Regolamento UE 679/2016.*


Il giorno gio 22 dic 2022 alle ore 07:16 Lukasz Lenart <
lukaszlenart@apache.org> ha scritto:

> śr., 21 gru 2022 o 17:41 Massimiliano Del Matto <
> massimiliano.delmatto@cubemail.it> napisał(a):
>
> > 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,
> > the same as reported in https://issues.apache.org/jira/browse/WW-5197
> (on
> > java.sql.Time instead of java.sql.Date). Maybe the same fix should be
> done
> > in org.apache.struts2.components.Date.end method also for java.sql.Time
> > instances?
> >
>
> Is it possible to post the exception stack trace? also could post a pseudo
> code that makes the problem?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>

Re: java.lang.UnsupportedOperationException in the Time component

Posted by Lukasz Lenart <lu...@apache.org>.
śr., 21 gru 2022 o 17:41 Massimiliano Del Matto <
massimiliano.delmatto@cubemail.it> napisał(a):

> 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,
> the same as reported in https://issues.apache.org/jira/browse/WW-5197 (on
> java.sql.Time instead of java.sql.Date). Maybe the same fix should be done
> in org.apache.struts2.components.Date.end method also for java.sql.Time
> instances?
>

Is it possible to post the exception stack trace? also could post a pseudo
code that makes the problem?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/