Date macro allows the insertion of a 5+ digit year-number (like 20215) via the "//" shortcut, prevents content from being saved, and throws a DateTimeParseException in the app logs

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Low
    • None
    • Affects Version/s: 8.5.25, 10.0.2, 9.2.9, 10.1.1
    • None
    • 1
    • Severity 3 - Minor
    • 12

      Problem

      While editing content, when a user types a 5+ digit year-number using the "//" shortcut (e.g. //08/06/20215), Confluence accepts the input and inserts a <time> element with an invalid datetime attribute, like this: Aug 6, 20215.

      If an attempt is made to save that content, then the editor throws the following error-dialog on the web-interface:

      Additionally, the atlassian-confluence.log.* file records a "java.time.format.DateTimeParseException: Text '20215-08-0' could not be parsed at index 0" message, as the 5+ digit year date-format cannot be parsed.

      Environment

      • Confluence DC

      Steps to Reproduce

      1. Edit any Confluence page.
      2. Type: //08/06/20215
      3. Observe that the editor inserts a date lozenge (e.g. "Aug 6, 20215").
      4. Try to publish/save the page.
      5. The page publish/save attempt fails:
        • the editor web-interface throws an error saying “There was an error processing the request”
        • theatlassian-confluence.logrecords the following exception stack-trace:
          2025-10-31 15:57:47,712 WARN [http-nio-6927-exec-9 url: /c927/rest/tinymce/1/drafts; user: admin] [confluence.tinymceplugin.rest.DraftsResource] save The supplied editor content could not be converted to storage format.
           -- url: /c927/rest/tinymce/1/drafts | userName: admin | referer: http://localhost:6927/c927/pages/resumedraft.action?draftId=10911754&draftShareId=0b25b1c6-ca57-4f6d-b770-cdcde379946b& | traceId: f95eec12b505809c
          com.atlassian.confluence.content.render.xhtml.XhtmlException: RuntimeException occurred while transforming editor format to storage format (com.atlassian.confluence.content.render.xhtml.XhtmlException: An error occurred due to invalid date time format during unmarshalling a time from storage format.)
          	at com.atlassian.confluence.content.render.xhtml.editor.EditorXhtmlTransformer.lambda$transform$0(EditorXhtmlTransformer.java:58)
          	at com.atlassian.confluence.content.render.xhtml.StaxUtils.processWrappedWstxExceptionOrTrowMapped(StaxUtils.java:464)
          	at com.atlassian.confluence.content.render.xhtml.editor.EditorXhtmlTransformer.transform(EditorXhtmlTransformer.java:58)
          	at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:38)
          	at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:38)
          	at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:42)
          	at com.atlassian.confluence.content.render.xhtml.editor.DefaultEditorConverter.convert(DefaultEditorConverter.java:37)
          	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
          	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
          	at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
          	at jdk.proxy4/jdk.proxy4.$Proxy593.convert(Unknown Source)
          	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
          	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
          	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
          	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
          	at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
          	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
          	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
          	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
          	at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
          	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
          ...
          	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
          	at java.base/java.lang.Thread.run(Thread.java:1583)
          Caused by: java.lang.RuntimeException: com.atlassian.confluence.content.render.xhtml.XhtmlException: An error occurred due to invalid date time format during unmarshalling a time from storage format.
          	at com.atlassian.confluence.content.render.xhtml.transformers.ThrowExceptionOnFragmentTransformationError.handle(ThrowExceptionOnFragmentTransformationError.java:14)
          	at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transformFragment(DefaultFragmentTransformer.java:157)
          	at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transform(DefaultFragmentTransformer.java:123)
          	at com.atlassian.confluence.content.render.xhtml.editor.EditorXhtmlTransformer.transform(EditorXhtmlTransformer.java:45)
          	... 446 more
          Caused by: com.atlassian.confluence.content.render.xhtml.XhtmlException: An error occurred due to invalid date time format during unmarshalling a time from storage format.
          	at com.atlassian.confluence.content.render.xhtml.editor.time.EditorTimeUnmarshaller.unmarshal(EditorTimeUnmarshaller.java:32)
          	at com.atlassian.confluence.content.render.xhtml.editor.time.EditorTimeUnmarshaller.unmarshal(EditorTimeUnmarshaller.java:19)
          	at com.atlassian.confluence.content.render.xhtml.UnmarshalMarshalFragmentTransformer.transform(UnmarshalMarshalFragmentTransformer.java:28)
          	at com.atlassian.confluence.content.render.xhtml.transformers.DefaultFragmentTransformer.transformFragment(DefaultFragmentTransformer.java:141)
          	... 448 more
          Caused by: java.lang.IllegalArgumentException: java.time.format.DateTimeParseException: Text '20215-08-0' could not be parsed at index 0
          	at com.atlassian.confluence.content.render.xhtml.model.time.Time.parseDate(Time.java:66)
          	at com.atlassian.confluence.content.render.xhtml.model.time.Time.<init>(Time.java:23)
          	at com.atlassian.confluence.content.render.xhtml.editor.time.EditorTimeUnmarshaller.unmarshal(EditorTimeUnmarshaller.java:28)
          	... 451 more
          Caused by: java.time.format.DateTimeParseException: Text '20215-08-0' could not be parsed at index 0
          	at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2108)
          	at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:2010)
          	at java.base/java.time.LocalDate.parse(LocalDate.java:435)
          	at java.base/java.time.LocalDate.parse(LocalDate.java:420)
          	at com.atlassian.confluence.content.render.xhtml.model.time.Time.parseDate(Time.java:64)
          	... 453 more
          

      Expected Results

      The date macro should validate input and reject invalid values, such as 5+ digit years, before inserting a <time> element into the page content.

      Actual Results

      • The page accepts the malformed date, and a <time> tag is inserted.
      • On publish/save, the page fails with a DateTimeParseException.

      Workaround

      Manually select the date from the calendar date-picker. This ensures that a valid date is inserted into the page.

      Notes

            Assignee:
            Unassigned
            Reporter:
            Lei Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: