You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/05/25 15:27:22 UTC

[xalan-java] branch xalan-j_xslt3.0 updated: fixing a minor bug, while emitting string value of xpath 3.1 timezone related functions like fn:current-dateTime

This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git


The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
     new 44453429 fixing a minor bug, while emitting string value of xpath 3.1 timezone related functions like fn:current-dateTime
44453429 is described below

commit 44453429c759c80ec23d24676a7036ea119e3f0e
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Thu May 25 20:57:05 2023 +0530

    fixing a minor bug, while emitting string value of xpath 3.1 timezone related functions like fn:current-dateTime
---
 src/org/apache/xpath/XPathContext.java | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/org/apache/xpath/XPathContext.java b/src/org/apache/xpath/XPathContext.java
index 7b244406..96709c24 100644
--- a/src/org/apache/xpath/XPathContext.java
+++ b/src/org/apache/xpath/XPathContext.java
@@ -1401,12 +1401,15 @@ public class XPathContext extends DTMManager // implements ExpressionContext
         ZonedDateTime zonedDateTime = ZonedDateTime.now();
         ZoneOffset zoneOffset = zonedDateTime.getOffset();
         String zoneOffsetStr = zoneOffset.toString();
-        String[] zoneOffsetParts = zoneOffsetStr.split("\\+|\\-|:");
-        int zoneHrs = (new Integer(zoneOffsetParts[1])).intValue();
-        int zoneMinutes = (new Integer(zoneOffsetParts[2])).intValue();
-        
-        m_timezone = new XSDayTimeDuration(0, zoneHrs, zoneMinutes, 0, 
-                                                 zoneOffsetStr.startsWith("+") ? false : true);
+        String[] zoneOffsetStrParts = zoneOffsetStr.split("\\+|\\-|:");
+        int zoneHrs = 0;
+        int zoneMinutes = 0;
+        if (zoneOffsetStrParts.length > 1) {
+           zoneHrs = (new Integer(zoneOffsetStrParts[1])).intValue();
+           zoneMinutes = (new Integer(zoneOffsetStrParts[2])).intValue();
+        }
+        boolean isNegativeTimezone = !zoneOffsetStr.startsWith("+");
+        m_timezone = new XSDayTimeDuration(0, zoneHrs, zoneMinutes, 0, isNegativeTimezone);
      }
      
      return m_timezone;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org