You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Marcel Ammerlaan (JIRA)" <ji...@apache.org> on 2008/10/27 13:08:44 UTC

[jira] Created: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

ConverterUtil.convertToDateTime() is to lenient
-----------------------------------------------

                 Key: AXIS2-4099
                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb
    Affects Versions: 1.3, 1.4, 1.4.1
            Reporter: Marcel Ammerlaan
            Priority: Minor


When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Mauro Molinari (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12784274#action_12784274 ] 

Mauro Molinari commented on AXIS2-4099:
---------------------------------------

The problem also occurs with Sun JRE 1.5.0_05. I suspect the problem might be related to Sun bug #6231602 (http://bugs.sun.com/view_bug.do?bug_id=6231602): if so, it's marked as fixed in 1.5.0_06.

The stack trace in 1.5.0_05 is the following:

Caused by: java.lang.IllegalArgumentException: ZONE_OFFSET
 at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2461)
 at java.util.Calendar.updateTime(Calendar.java:2260)
 at java.util.Calendar.getTimeInMillis(Calendar.java:1044)
 at org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:619)
[...]

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720848#action_12720848 ] 

Andreas Veithen commented on AXIS2-4099:
----------------------------------------

What does the exception say?

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Marcel Ammerlaan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcel Ammerlaan updated AXIS2-4099:
------------------------------------

    Attachment: DateTimeBug.java

Sample code showing the bug and a fixed version of the ConvertUtil.convertToDateTime() method.

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Maite Clay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721020#action_12721020 ] 

Maite Clay commented on AXIS2-4099:
-----------------------------------

Test code.  (2 time zones tested in case the first one is the current timezone)
============================================
import org.apache.axis2.databinding.utils.ConverterUtil;

public class TypeConversionTest {
	public static void main(String[] args) {
		ConverterUtil.convertToDate( "2009-06-17-05:00" );
		ConverterUtil.convertToDate( "2009-06-17-06:00" );
	}
}
============================================

Exception in thread "main" java.lang.IllegalArgumentException: ZONE_OFFSET
	at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2475)
	at java.util.Calendar.updateTime(Calendar.java:2276)
	at java.util.Calendar.getTimeInMillis(Calendar.java:1058)
	at org.apache.axis2.databinding.utils.ConverterUtil.convertToDate(ConverterUtil.java:619)
	at TypeConversionTest.main(TypeConversionTest.java:5)
============================================

JVM info is:
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pwi32devifx-20071213a (ifix 129397: SR4 + IY99287 + IY99356 + IY98136 + IZ09166 ))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows Server 2003 x86-32 j9vmwi3223ifx-20070525 (JIT enabled)




> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi resolved AXIS2-4099.
-------------------------------------------------

    Resolution: Fixed

fixed the issue as suggested in this jira.

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Maite Clay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721522#action_12721522 ] 

Maite Clay commented on AXIS2-4099:
-----------------------------------

Followup for anyone seeing this issue with IBM JVM:

The following VM does not show the exception above.  The problem one is 1.5.0 SR4, and the one that works (below) is 1.5.0 SR8a.  So one of the service release between 5-8 fixed it.

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pwi32devifx-20080811b (SR8a))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows Server 2003 x86-32 j9vmwi3223ifx-20080811 (JIT enabled)

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Maite Clay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721250#action_12721250 ] 

Maite Clay commented on AXIS2-4099:
-----------------------------------

Ahh.. that is too bad for me then.  I am stuck using that particular IBM jvm for now, and is seems it the JVM that is broken in this scenario.  No axis1.5 for me until the folks at work update the jvm.  Hopefully IBM has fixed the bug.

I also tried it once I got home and it worked with the following JVMs.

java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)
 
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721071#action_12721071 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-4099:
-----------------------------------------------------

 public static void main(String[] args) {
        System.out.println("date ==> " + ConverterUtil.convertToDate("2009-06-17-05:00"));
        System.out.println("date ==> " + ConverterUtil.convertToDate("2009-06-17-06:00"));
    }

I ran with the above code and which worked fine with my jvm.

java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)

 

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Maite Clay (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12720834#action_12720834 ] 

Maite Clay commented on AXIS2-4099:
-----------------------------------

Looks like fixing this issue created a secondary problem.  If the default time zone is different from that specified in the string, then an exception is thrown whenever calling the calendar's getTime() (or get millis) method.

Example:
Calendar cal = ConverterUtil.convertToDateTime( "2009-06-17T11:49:52.986-07:00" );
cal.getTime();

If the default timezone is not "-07:00", the second statement will throw an exception.

Similarly, ConverterUtil.convertToDate() has the same issue and will throw an exception before it returns

Example:
ConverterUtil.convertToDate("2009-06-17-07:00" );



> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AXIS2-4099) ConverterUtil.convertToDateTime() is to lenient

Posted by "Mauro Molinari (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12784762#action_12784762 ] 

Mauro Molinari commented on AXIS2-4099:
---------------------------------------

I confirm Amila's test case fails on Sun's 1.5.0_05 and works on 1.5.0_06 up. So it must be the mentioned bug #6231602.

> ConverterUtil.convertToDateTime() is to lenient
> -----------------------------------------------
>
>                 Key: AXIS2-4099
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4099
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1, 1.4, 1.3
>            Reporter: Marcel Ammerlaan
>            Priority: Minor
>         Attachments: DateTimeBug.java
>
>
> When parsing an invalid date (as specified by the XSD Schema specification), Axis relies on the java.util.Calendar leniency to parse. E.g. 2008-02-31 (31st of februari) is invalid according to http://www.w3.org/TR/xmlschema-2/#dateTime. convertToDateTime() returns the 2nd of march instead. 
> This can be easily solved by setting the Calender leniency to false (setLenient(false)).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.