Actions
Bug #6377
closedformat-time on Unix throws DateTimeException if "[Z]" pattern is used
Start date:
2024-03-23
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
Java
Description
Hi,
if you use for instance this:
<xsl:value-of select="format-time(current-time(), '[h01][m01][Z]')"/>
it throws the following stack trace:
java.time.DateTimeException: Invalid ID for ZoneOffset, invalid format:
at java.base/java.time.ZoneOffset.of(ZoneOffset.java:243)
at java.base/java.time.ZoneId.of(ZoneId.java:404)
at java.base/java.time.ZoneId.of(ZoneId.java:358)
at net.sf.saxon.expr.number.NamedTimeZone.olsonZoneOrUtc(NamedTimeZone.java:471)
at net.sf.saxon.expr.number.NamedTimeZone.inSummerTime(NamedTimeZone.java:464)
at net.sf.saxon.functions.FormatDate.formatComponent(FormatDate.java:353)
at net.sf.saxon.functions.FormatDate.formatDate(FormatDate.java:167)
at net.sf.saxon.functions.FormatDate.call(FormatDate.java:833)
at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$2(SystemFunctionCall.java:613)
at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForPush$0(PullElaborator.java:38)
at net.sf.saxon.expr.instruct.ValueOf$ValueOfElaborator.lambda$elaborateForPush$1(ValueOf.java:420)
at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:640)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:247)
at net.sf.saxon.trans.XsltController.callTemplate(XsltController.java:872)
at net.sf.saxon.s9api.Xslt30Transformer.callTemplate(Xslt30Transformer.java:503)
at net.sf.saxon.Transform.processFile(Transform.java:1375)
at net.sf.saxon.Transform.doTransform(Transform.java:879)
at net.sf.saxon.Transform.main(Transform.java:83)
at org.codehaus.mojo.exec.ExecJavaMojo.doMain(ExecJavaMojo.java:385)
at org.codehaus.mojo.exec.ExecJavaMojo.doExec(ExecJavaMojo.java:374)
at org.codehaus.mojo.exec.ExecJavaMojo.lambda$execute$0(ExecJavaMojo.java:296)
at java.base/java.lang.Thread.run(Thread.java:833)
Suprising was that this happens:
- only on unix systems (e.g. on GitHub actions or using the Docker image maven:3.8.3-openjdk-17 ) but not on Windows systems (at least not on my system: Windows 10, OpenJDK 17 or 8)
- only for
format-time()
but not forformat-date()
orformat-dateTime()
.
You can find reproductions of the issue on this GitHub project:
https://github.com/nkutsche/saxon-he-issues/actions/workflows/maven.yml
Please register to edit this issue
Actions