[jira] Updated: (TUSCANY-582) Date fields sometimes not preserved when using DataHelper.
[ http://issues.apache.org/jira/browse/TUSCANY-582?page=all ] Brian Murray updated TUSCANY-582: - Attachment: DateConversionTestCase.java Tuscany582.patch Some minor revisions resulting from a code review with a peer. Date fields sometimes not preserved when using DataHelper. -- Key: TUSCANY-582 URL: http://issues.apache.org/jira/browse/TUSCANY-582 Project: Tuscany Issue Type: Bug Components: Java SDO Implementation Reporter: Brian Murray Assigned To: Frank Budinsky Priority: Minor Attachments: DateConversionTestCase.java, DateConversionTestCase.java, DateConversionTestCase.java, DateConversionTestCase.java, Tuscany582.patch, Tuscany582.patch, Tuscany582.patch While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless). // The output of each println (from a single run) is placed in comments beside it public void testShowErrorsInSimpleFashion() throws Exception { Date temp = new Date(System.currentTimeMillis()); // In following sequence - would expect the Day value (here, 21) to be maintained. System.out.println(temp = + temp); // temp = Fri Jul 21 03:51:01 EDT 2006 String day = data_helper.toDay(temp); System.out.println(day = + day); // day = ---21 EDT Date date2 = data_helper.toDate(day); System.out.println(date2 = + date2); // date2 = Thu Feb 29 23:00:00 EST 1968 String day2 = data_helper.toDay(date2); System.out.println(day2 = + day2); // day2 = ---29 EST } When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is ---dd zz). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect. Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21). Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior. Side note: The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added: DateTime- Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day Duration-Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day MonthDay-Month, Day YearMonth-Month, Year YearMonthDay-Month, Year, Day, YearMonth, MonthDay -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (TUSCANY-582) Date fields sometimes not preserved when using DataHelper.
[ http://issues.apache.org/jira/browse/TUSCANY-582?page=all ] Brian Murray updated TUSCANY-582: - Attachment: Tuscany582.patch Updates to both Tuscany582.patch and DataHelperImpl.java. The most recent versions are the correct versions. The updates reflect the need to parse negative Date, DateTime, Duration, Year, YearMonth, and YearMonthDay. For Duration it is treated as a negative value. For the others, -1 indicates a BCE (formerly BC) value. Date fields sometimes not preserved when using DataHelper. -- Key: TUSCANY-582 URL: http://issues.apache.org/jira/browse/TUSCANY-582 Project: Tuscany Issue Type: Bug Components: Java SDO Implementation Reporter: Brian Murray Assigned To: Frank Budinsky Priority: Minor Attachments: DateConversionTestCase.java, DateConversionTestCase.java, Tuscany582.patch, Tuscany582.patch While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless). // The output of each println (from a single run) is placed in comments beside it public void testShowErrorsInSimpleFashion() throws Exception { Date temp = new Date(System.currentTimeMillis()); // In following sequence - would expect the Day value (here, 21) to be maintained. System.out.println(temp = + temp); // temp = Fri Jul 21 03:51:01 EDT 2006 String day = data_helper.toDay(temp); System.out.println(day = + day); // day = ---21 EDT Date date2 = data_helper.toDate(day); System.out.println(date2 = + date2); // date2 = Thu Feb 29 23:00:00 EST 1968 String day2 = data_helper.toDay(date2); System.out.println(day2 = + day2); // day2 = ---29 EST } When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is ---dd zz). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect. Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21). Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior. Side note: The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added: DateTime- Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day Duration-Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day MonthDay-Month, Day YearMonth-Month, Year YearMonthDay-Month, Year, Day, YearMonth, MonthDay -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (TUSCANY-582) Date fields sometimes not preserved when using DataHelper.
[ http://issues.apache.org/jira/browse/TUSCANY-582?page=all ] Brian Murray updated TUSCANY-582: - Attachment: DateConversionTestCase.java Some updates to insure that negative values are parsed. Also, remove parsing for and test cases for Duration with timezone included. Date fields sometimes not preserved when using DataHelper. -- Key: TUSCANY-582 URL: http://issues.apache.org/jira/browse/TUSCANY-582 Project: Tuscany Issue Type: Bug Components: Java SDO Implementation Reporter: Brian Murray Assigned To: Frank Budinsky Priority: Minor Attachments: DateConversionTestCase.java, DateConversionTestCase.java, DateConversionTestCase.java, Tuscany582.patch, Tuscany582.patch While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless). // The output of each println (from a single run) is placed in comments beside it public void testShowErrorsInSimpleFashion() throws Exception { Date temp = new Date(System.currentTimeMillis()); // In following sequence - would expect the Day value (here, 21) to be maintained. System.out.println(temp = + temp); // temp = Fri Jul 21 03:51:01 EDT 2006 String day = data_helper.toDay(temp); System.out.println(day = + day); // day = ---21 EDT Date date2 = data_helper.toDate(day); System.out.println(date2 = + date2); // date2 = Thu Feb 29 23:00:00 EST 1968 String day2 = data_helper.toDay(date2); System.out.println(day2 = + day2); // day2 = ---29 EST } When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is ---dd zz). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect. Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21). Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior. Side note: The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added: DateTime- Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day Duration-Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day MonthDay-Month, Day YearMonth-Month, Year YearMonthDay-Month, Year, Day, YearMonth, MonthDay -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (TUSCANY-582) Date fields sometimes not preserved when using DataHelper.
[ http://issues.apache.org/jira/browse/TUSCANY-582?page=all ] Brian Murray updated TUSCANY-582: - Attachment: DateConversionTestCase.java I have attached an updated version of DateConversionTestCase.java that does show the problem caused by daylight savings time which existed in the original test case. (If somebody has the authority to do so, could you please remove the initial version?) In the newer version the verification is done by comparing individual fields from a Calendar object. Date fields sometimes not preserved when using DataHelper. -- Key: TUSCANY-582 URL: http://issues.apache.org/jira/browse/TUSCANY-582 Project: Tuscany Issue Type: Bug Components: Java SDO Implementation Reporter: Brian Murray Assigned To: Frank Budinsky Priority: Minor Attachments: DateConversionTestCase.java, DateConversionTestCase.java, Tuscany582.patch While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless). // The output of each println (from a single run) is placed in comments beside it public void testShowErrorsInSimpleFashion() throws Exception { Date temp = new Date(System.currentTimeMillis()); // In following sequence - would expect the Day value (here, 21) to be maintained. System.out.println(temp = + temp); // temp = Fri Jul 21 03:51:01 EDT 2006 String day = data_helper.toDay(temp); System.out.println(day = + day); // day = ---21 EDT Date date2 = data_helper.toDate(day); System.out.println(date2 = + date2); // date2 = Thu Feb 29 23:00:00 EST 1968 String day2 = data_helper.toDay(date2); System.out.println(day2 = + day2); // day2 = ---29 EST } When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is ---dd zz). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect. Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21). Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior. Side note: The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added: DateTime- Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day Duration-Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day MonthDay-Month, Day YearMonth-Month, Year YearMonthDay-Month, Year, Day, YearMonth, MonthDay -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (TUSCANY-582) Date fields sometimes not preserved when using DataHelper.
[ http://issues.apache.org/jira/browse/TUSCANY-582?page=all ] Brian Murray updated TUSCANY-582: - Attachment: Tuscany582.patch The attached patch addresses the problem mentioned in this issue (Tuscany-582). The change for this original problem is a one line fix (setting isLenient to false). Previously, an earlier SimpleDateFormat in the list of possibilties was matching for a String that should have matched the Day format. It also includes changes to the toDate method to allow permitted variations (e.g. incusion or exclusion of time zone) to be converted to a Date using DataHelper.toDate(). Previously, many Strings that should give a valid result from DateHelper.toDate() would have resulted in null. I have created a test case that addresses both the original issue, as well as the secondary issue also addressed. I will attach it shortly. Would a committer please review the patch and test case and let me know of any issues? Date fields sometimes not preserved when using DataHelper. -- Key: TUSCANY-582 URL: http://issues.apache.org/jira/browse/TUSCANY-582 Project: Tuscany Issue Type: Bug Components: Java SDO Implementation Reporter: Brian Murray Assigned To: Frank Budinsky Priority: Minor Attachments: Tuscany582.patch While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless). // The output of each println (from a single run) is placed in comments beside it public void testShowErrorsInSimpleFashion() throws Exception { Date temp = new Date(System.currentTimeMillis()); // In following sequence - would expect the Day value (here, 21) to be maintained. System.out.println(temp = + temp); // temp = Fri Jul 21 03:51:01 EDT 2006 String day = data_helper.toDay(temp); System.out.println(day = + day); // day = ---21 EDT Date date2 = data_helper.toDate(day); System.out.println(date2 = + date2); // date2 = Thu Feb 29 23:00:00 EST 1968 String day2 = data_helper.toDay(date2); System.out.println(day2 = + day2); // day2 = ---29 EST } When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is ---dd zz). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect. Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21). Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior. Side note: The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added: DateTime- Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day Duration-Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day MonthDay-Month, Day YearMonth-Month, Year YearMonthDay-Month, Year, Day, YearMonth, MonthDay -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (TUSCANY-582) Date fields sometimes not preserved when using DataHelper.
[ http://issues.apache.org/jira/browse/TUSCANY-582?page=all ] Brian Murray updated TUSCANY-582: - Attachment: DateConversionTestCase.java Attached is the test case that uncovered the original issue and has been used to verify both the fix for that defect as well as the other defect mentioned above. Please let me know of any concerns. Date fields sometimes not preserved when using DataHelper. -- Key: TUSCANY-582 URL: http://issues.apache.org/jira/browse/TUSCANY-582 Project: Tuscany Issue Type: Bug Components: Java SDO Implementation Reporter: Brian Murray Assigned To: Frank Budinsky Priority: Minor Attachments: DateConversionTestCase.java, Tuscany582.patch While I find it mildly surprising that you can convert from a Day to a Date, I would expect that in doing so the Day (Date.getDate()) value within Date would be accurate (even if all other fields are meaningless). // The output of each println (from a single run) is placed in comments beside it public void testShowErrorsInSimpleFashion() throws Exception { Date temp = new Date(System.currentTimeMillis()); // In following sequence - would expect the Day value (here, 21) to be maintained. System.out.println(temp = + temp); // temp = Fri Jul 21 03:51:01 EDT 2006 String day = data_helper.toDay(temp); System.out.println(day = + day); // day = ---21 EDT Date date2 = data_helper.toDate(day); System.out.println(date2 = + date2); // date2 = Thu Feb 29 23:00:00 EST 1968 String day2 = data_helper.toDay(date2); System.out.println(day2 = + day2); // day2 = ---29 EST } When I look in DataHelperImpl.java, I see a series of Date Patterns. It seems that Day is being matched to an earlier pattern than the expected one (the expected one is ---dd zz). When I move that pattern to first in the list, the outcome is affected. Were it not matching an earlier pattern, I would think that moving the correct one to the front of the list would not have an effect. Leaving DataHelperImpl.java unaltered, Day = 21 EDT, and Day2 = 29 EST (in the case above). However, if I put the appropriate pattern first in the list, Day2 is instead = 20 EST. Interestingly, it is still not the correct day (21). Frank pointed out that there have been recent updates to DataHelper, however I've retested with build level 425652 and see the same behavior. Side note: The following is not a JIRA issue, but it is related. In the second table on page 146 the Date conversions for most types are essentially to the same type, to Date, and to String. It seems that several more are possible. The following seem capable of being added: DateTime- Month, MonthDay, YearMonth, YearMonthDay, Time, Year, Duration, Day Duration-Month, MonthDay, YearMonth, YearMonthDay, Time, Year, DateTime, Day MonthDay-Month, Day YearMonth-Month, Year YearMonthDay-Month, Year, Day, YearMonth, MonthDay -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]