[ 
https://issues.apache.org/jira/browse/JENA-1819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17018399#comment-17018399
 ] 

Andy Seaborne edited comment on JENA-1819 at 1/17/20 11:29 PM:
---------------------------------------------------------------

This is due to JENA-1756.

Apache Commons Lang3 moving from v3.4 to v3.9) made a change in the way 
{{FastDateFormat}} works. 3.9 does not handle timezones - it always outputs UTC.

We changed to using the JDK {{java.time.format.DateTimeFormatter}}, leaving 
"nowAsString(String)" (using {{FastDateFormat}} internally) to aid migration. 
Using {{DateTimeFormatter}} does handle timezones as necessary.

Presumably, class {{TestJena}} has not been recompiled with 3.13 - it's a 
compile time change.

{{FastDateFormat}} and {DateTimeFormatter}} don't have quite the same syntax 
but 

{{DateTimeFormatter timestamp  = DateTimeFormatter.ofPattern("HH:mm:ss.SSS");}}

should work.


was (Author: andy.seaborne):
This is due to JENA-1756.

Apache Commons Lang3 moving from v3.4 to v3.9) made a change in the way 
{{FastDateFormat}} works. 3.9 does not handle timezones - it always outputs UTC.

We changed to using the JDK {{java.time.format.DateTimeFormatter}}, leaving 
"nowAsString(String)" (using {{FastDateFormat}} internally) to aid migration. 
Using {{DateTimeFormatter}} does handle timezones as necessary.

Presumably, class {{TestJena}} has not been recompiled with 3.13 - it's a 
compile time change.

{FastDateFormat}} and {DateTimeFormatter}} don't have quite the same syntax but 

{{DateTimeFormatter timestamp  = DateTimeFormatter.ofPattern("HH:mm:ss.SSS");}}

should work.

> Updating from 3.12 to 3.13 breaks
> ---------------------------------
>
>                 Key: JENA-1819
>                 URL: https://issues.apache.org/jira/browse/JENA-1819
>             Project: Apache Jena
>          Issue Type: Bug
>            Reporter: xia0c
>            Priority: Major
>
> When I try to upgrade jena-arq from 3.12 to 3.13. The following code breaks.
> {code:java}
> public class TestJena {
>       
>       private static FastDateFormat timestamp = 
> FastDateFormat.getInstance("HH:mm:ss.SSS") ;
>       
>       private void printQuery(Query query, QuerySolution initialBinding) {
>         String time = DateTimeUtils.nowAsString(timestamp); 
>         System.err.print("~~ ");
>         System.err.print(time);
>         System.err.println(" ~~");
>         System.err.println(initialBinding);
>         System.err.print(query);
>       }
> }
> {code}
> The code should pass, but it throws an error:
> {code:java}
> TestJena.java:[13,36] no suitable method found for 
> nowAsString(org.apache.commons.lang3.time.FastDateFormat)
> [ERROR] method 
> org.apache.jena.atlas.lib.DateTimeUtils.nowAsString(java.lang.String) is not 
> applicable
> [ERROR] (argument mismatch; org.apache.commons.lang3.time.FastDateFormat 
> cannot be converted to java.lang.String)
> [ERROR] method 
> org.apache.jena.atlas.lib.DateTimeUtils.nowAsString(java.time.format.DateTimeFormatter)
>  is not applicable
> [ERROR] (argument mismatch; org.apache.commons.lang3.time.FastDateFormat 
> cannot be converted to java.time.format.DateTimeFormatter)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to