Skip to content

GlobalConfiguration.DATE_TIME_FORMAT incompatible with GlobalConfiguration.DATE_TIME_IMPLEMENTATION #1050

Description

@vic0824

ArcadeDB Version: 23.3.1

JDK Version: openjdk version "11.0.12" 2021-07-20 LTS

OS: CentOS release 6.10 (Final)

Expected behavior

It is possible to use the LocalDateTime implementation and a DateTimeFormat that uses microseconds, like this:

GlobalConfiguration.DATE_TIME_IMPLEMENTATION.setValue(java.time.LocalDateTime.class);
GlobalConfiguration.DATE_TIME_FORMAT.setValue("yyyy-MM-dd'T'HH:mm:ss.SSSSSS");

Actual behavior

GlobalConfiguration.DATE_TIME_FORMAT expects a date time format using Java SimpleDateFormat syntax, which cannot handle microseconds.
Specifying a format using microseconds causes an exception (Studio cannot display the types in the db and cannot perform any query)

Steps to reproduce

  • Set
GlobalConfiguration.DATE_TIME_IMPLEMENTATION.setValue(java.time.LocalDateTime.class);
GlobalConfiguration.DATE_TIME_FORMAT.setValue("yyyy-MM-dd'T'HH:mm:ss.SSSSSS");
  • create an instance of ContextConfiguration
  • create a database called csrsdb
  • create some Document Types
  • start the ArcadeDB server passing the ContextConfiguration to the constructor
  • Log in to Studio
  • Verify that it shows the error: "Cannot execute command Illegal pattern character 'V'", which is returned by the server in response to the request: http://[URL]/api/v1/query/csrsdb
  • Inspect the ArcadeDB log and verify that it contains the following exception:
2023-04-23 08:57:06.191 INFO  [ArcadeDBServer] <ArcadeDB_0> Studio web tool available at http://cs2minipds-test:8080 <ArcadeDB_0> Error on command execution (PostQueryHandler)
java.lang.IllegalArgumentException: Illegal pattern character 'V'
        at java.base/java.text.SimpleDateFormat.compile(Unknown Source)
        at java.base/java.text.SimpleDateFormat.initialize(Unknown Source)
        at java.base/java.text.SimpleDateFormat.<init>(Unknown Source)
        at java.base/java.text.SimpleDateFormat.<init>(Unknown Source)
        at com.arcadedb.serializer.json.JSONObject.setDateFormat(JSONObject.java:275)
        at com.arcadedb.server.http.handler.AbstractHandler.createResult(AbstractHandler.java:195)
        at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:93)
        at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:92)
        at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:127)
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
        at java.base/java.lang.Thread.run(Unknown Source)
  • note that the DATE_TIME_FORMAT was set to a pattern that does not contain the character 'V'

Recommendation

Use the DateTimeFormatter class of the java.time API instead of the SimpleDateFormat class of the java.Date API

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions