Local date parse error while importing issues from JIRA Cloud
We have many users with different locales on our Jira Cloud project, and occasionally a user submits a value in a date field in local format, for example: "28/мар/21". Import script is failing on those with an error like this:
Script failed with error: The data type for the {Issue with id 10480}.{history[6] with id 14272-0}.fieldChanges.customfield_10015 field is declared as date, but its value is stored as 28/мар/21.
jetbrains.youtrack.imports.api.IncorrectDataFormatException: The data type for the {Issue with id 10480}.{history[6] with id 14272-0}.fieldChanges.customfield_10015 field is declared as date, but its value is stored as 28/мар/21.
The history entries are burried deeply in the Cloud and could not be modified: only erasing the issue could handle the problem from Jira side. Its hard to locate the place in the import script to get fix for a non-java programmer and unfamiliar with this API. Could someone help to find a way to get the fix quickly?
Full traceback is following:
02/04/21 01:07:15,337 DEBUG [@tzJobProcessor8] [ImportLogging ] [import_user_702517542@null] Found field in cache, requested: id=customfield_10024, name=[CHART] Date of First Response, type=?) -> result: '[CHART] Date of First Response'(externalId: customfield_10024, type: string)
02/04/21 01:07:15,342 ERROR [@tzJobProcessor8] [ImportLogging ] [] Script failed with error: The data type for the {Issue with id 10480}.{history[6] with id 14272-0}.fieldChanges.customfield_10015 field is declared as date, but its value is stored as 28/мар/21.
jetbrains.youtrack.imports.api.IncorrectDataFormatException: The data type for the {Issue with id 10480}.{history[6] with id 14272-0}.fieldChanges.customfield_10015 field is declared as date, but its value is stored as 28/мар/21.
at jetbrains.youtrack.imports.misc.MiscKt.createException(Misc.kt:12)
at jetbrains.youtrack.imports.api.FieldType.couldNotParseSimpleType(Client.kt:854)
at jetbrains.youtrack.imports.api.FieldType$DATE.fieldValueFromString(Client.kt:675)
at jetbrains.youtrack.imports.runtime.IssuesProcessingKt.fieldValuesToFullFormat(IssuesProcessing.kt:171)
at jetbrains.youtrack.imports.runtime.IssuesProcessingKt.processItems(IssuesProcessing.kt:200)
at jetbrains.youtrack.imports.runtime.ImportProcedureKt.doProcessDocuments(ImportProcedure.kt:345)
at jetbrains.youtrack.imports.runtime.ImportProcedureKt.processDocumentsInProject(ImportProcedure.kt:295)
at jetbrains.youtrack.imports.runtime.ImportProcedureKt.processProjects(ImportProcedure.kt:187)
at jetbrains.youtrack.imports.runtime.ImportImplementationImpl.invoke(ImportImplementationImpl.kt:21)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt:104)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt)
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing(ExceptionsProcessing.kt:77)
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing$default(ExceptionsProcessing.kt:17)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt:91)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt)
at jetbrains.youtrack.scripts.internals.RunInContextKt.runInContext(RunInContext.kt:17)
at jetbrains.youtrack.imports.persistence.ClientScriptRunnerKt.runInContext(ClientScriptRunner.kt:42)
at jetbrains.youtrack.imports.model.ImportExtensionsKt.doStart(ImportExtensions.kt:90)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt:74)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt)
at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:29)
at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:9)
at jetbrains.youtrack.scheduling.QuartzJobProcessorKt$asNonTxLocalRunnable$1.run(QuartzJobProcessor.kt:38)
at jetbrains.exodus.core.execution.RunnableJob.execute(RunnableJob.java:41)
at jetbrains.exodus.core.execution.Job.run(Job.java:135)
at jetbrains.exodus.core.execution.ThreadJobProcessor.executeJob(ThreadJobProcessor.java:132)
at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doExecuteJob(JobProcessorQueueAdapter.java:251)
at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doJobs(JobProcessorQueueAdapter.java:161)
at jetbrains.exodus.core.execution.ThreadJobProcessor.run(ThreadJobProcessor.java:110)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: jetbrains.youtrack.imports.api.IncorrectDataFormatException: The specified timestamp 28/мар/21 doesn't match any of the predefined patterns: yyyy-MM-dd HH:mm, dd.MM.yyyy HH.mm, yyyy-MM-dd'T'HH:mm:ss.SSSX, yyyy-MM-dd'T'HH:mm:ssX, yyyy-MM-dd'T'HH:mmX, yyyy-MM-dd, dd/MMM/yy HH:mm, dd/MMM/yy
at jetbrains.youtrack.imports.misc.MiscKt.createException(Misc.kt:12)
at jetbrains.youtrack.imports.misc.MiscKt.calculateWithFormats(Misc.kt:48)
at jetbrains.youtrack.imports.misc.MiscKt.parseDateTimeStamp(Misc.kt:31)
at jetbrains.youtrack.imports.api.FieldType$DATE.fieldValueFromString(Client.kt:673)
... 27 more
Caused by: java.lang.RuntimeException: Timestamp 28/мар/21 matches neither of the formats provided (yyyy-MM-dd HH:mm, dd.MM.yyyy HH.mm, yyyy-MM-dd'T'HH:mm:ss.SSSX, yyyy-MM-dd'T'HH:mm:ssX, yyyy-MM-dd'T'HH:mmX, yyyy-MM-dd, dd/MMM/yy HH:mm, dd/MMM/yy)
at jetbrains.youtrack.scripts.sandbox.Utils.toDate(Utils.kt:52)
at jetbrains.youtrack.scripts.sandbox.Utils.toDateTimestamp(Utils.kt:27)
at jetbrains.youtrack.imports.misc.MiscKt$parseDateTimeStamp$1.invoke(Misc.kt:32)
at jetbrains.youtrack.imports.misc.MiscKt$parseDateTimeStamp$1.invoke(Misc.kt)
at jetbrains.youtrack.imports.misc.MiscKt.calculateWithFormats(Misc.kt:46)
... 29 more
02/04/21 01:07:15,345 ERROR [@tzJobProcessor8] [ImportLogging ] [] Import failed with error: The specified timestamp 28/мар/21 doesn't match any of the predefined patterns: yyyy-MM-dd HH:mm, dd.MM.yyyy HH.mm, yyyy-MM-dd'T'HH:mm:ss.SSSX, yyyy-MM-dd'T'HH:mm:ssX, yyyy-MM-dd'T'HH:mmX, yyyy-MM-dd, dd/MMM/yy HH:mm, dd/MMM/yy
jetbrains.youtrack.scripts.sandbox.EvaluationException: The specified timestamp 28/мар/21 doesn't match any of the predefined patterns: yyyy-MM-dd HH:mm, dd.MM.yyyy HH.mm, yyyy-MM-dd'T'HH:mm:ss.SSSX, yyyy-MM-dd'T'HH:mm:ssX, yyyy-MM-dd'T'HH:mmX, yyyy-MM-dd, dd/MMM/yy HH:mm, dd/MMM/yy
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt$withScriptingAndDBExceptionsProcessing$1.invoke(ExceptionsProcessing.kt:28)
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt$withScriptingAndDBExceptionsProcessing$3.invoke(ExceptionsProcessing.kt:61)
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing(ExceptionsProcessing.kt:86)
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing$default(ExceptionsProcessing.kt:17)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt:91)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt)
at jetbrains.youtrack.scripts.internals.RunInContextKt.runInContext(RunInContext.kt:17)
at jetbrains.youtrack.imports.persistence.ClientScriptRunnerKt.runInContext(ClientScriptRunner.kt:42)
at jetbrains.youtrack.imports.model.ImportExtensionsKt.doStart(ImportExtensions.kt:90)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt:74)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt)
at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:29)
at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:9)
at jetbrains.youtrack.scheduling.QuartzJobProcessorKt$asNonTxLocalRunnable$1.run(QuartzJobProcessor.kt:38)
at jetbrains.exodus.core.execution.RunnableJob.execute(RunnableJob.java:41)
at jetbrains.exodus.core.execution.Job.run(Job.java:135)
at jetbrains.exodus.core.execution.ThreadJobProcessor.executeJob(ThreadJobProcessor.java:132)
at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doExecuteJob(JobProcessorQueueAdapter.java:251)
at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doJobs(JobProcessorQueueAdapter.java:161)
at jetbrains.exodus.core.execution.ThreadJobProcessor.run(ThreadJobProcessor.java:110)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: jetbrains.youtrack.imports.api.IncorrectDataFormatException: The specified timestamp 28/мар/21 doesn't match any of the predefined patterns: yyyy-MM-dd HH:mm, dd.MM.yyyy HH.mm, yyyy-MM-dd'T'HH:mm:ss.SSSX, yyyy-MM-dd'T'HH:mm:ssX, yyyy-MM-dd'T'HH:mmX, yyyy-MM-dd, dd/MMM/yy HH:mm, dd/MMM/yy
at jetbrains.youtrack.imports.misc.MiscKt.createException(Misc.kt:12)
at jetbrains.youtrack.imports.misc.MiscKt.calculateWithFormats(Misc.kt:48)
at jetbrains.youtrack.imports.misc.MiscKt.parseDateTimeStamp(Misc.kt:31)
at jetbrains.youtrack.imports.api.FieldType$DATE.fieldValueFromString(Client.kt:673)
at jetbrains.youtrack.imports.runtime.IssuesProcessingKt.fieldValuesToFullFormat(IssuesProcessing.kt:171)
at jetbrains.youtrack.imports.runtime.IssuesProcessingKt.processItems(IssuesProcessing.kt:200)
at jetbrains.youtrack.imports.runtime.ImportProcedureKt.doProcessDocuments(ImportProcedure.kt:345)
at jetbrains.youtrack.imports.runtime.ImportProcedureKt.processDocumentsInProject(ImportProcedure.kt:295)
at jetbrains.youtrack.imports.runtime.ImportProcedureKt.processProjects(ImportProcedure.kt:187)
at jetbrains.youtrack.imports.runtime.ImportImplementationImpl.invoke(ImportImplementationImpl.kt:21)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt:104)
at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt)
at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing(ExceptionsProcessing.kt:77)
... 18 more
Caused by: java.lang.RuntimeException: Timestamp 28/мар/21 matches neither of the formats provided (yyyy-MM-dd HH:mm, dd.MM.yyyy HH.mm, yyyy-MM-dd'T'HH:mm:ss.SSSX, yyyy-MM-dd'T'HH:mm:ssX, yyyy-MM-dd'T'HH:mmX, yyyy-MM-dd, dd/MMM/yy HH:mm, dd/MMM/yy)
at jetbrains.youtrack.scripts.sandbox.Utils.toDate(Utils.kt:52)
at jetbrains.youtrack.scripts.sandbox.Utils.toDateTimestamp(Utils.kt:27)
at jetbrains.youtrack.imports.misc.MiscKt$parseDateTimeStamp$1.invoke(Misc.kt:32)
at jetbrains.youtrack.imports.misc.MiscKt$parseDateTimeStamp$1.invoke(Misc.kt)
at jetbrains.youtrack.imports.misc.MiscKt.calculateWithFormats(Misc.kt:46)
... 29 more
Please sign in to leave a comment.
Hello Ivan,
I'm copying my reply from the respective support ticket.
To resolve this issue please follow the steps outline below:
utils
script, scroll down to line78
and replace all of the month abbreviations forsourceMonths
considering the locale we determined earlier. Please keep in mind that values are case-sensitive.E.g. for Russian, it would be as follows:
Once replaced, please save the changes and re-run the Import procedure.
Please let me know if that helps.
Thank you very much, Sergey! That worked!