[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-12-16 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791819#action_12791819
 ] 

Henri Yandell commented on LANG-530:



Arbitrarily moving DateUtils to FastDateFormat concerns me. So does running 
regexp on the user input. However I think the following will a) fix 80% of 
issues and b) be safe:

if the pattern in question ends in ZZ, which all of the ones in DateFormatUtils 
do, then go ahead and do the regexp. If it ends in ZZ, then it's not part of a 
literal, so there's no concern for clash. There might be other ZZ's that don't 
get fixed, but this will ensure the items in DateFormatUtils work and cover 
another set of formats.

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
> Attachments: LANG-530-exception.patch
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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



[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-12-16 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791812#action_12791812
 ] 

Henri Yandell commented on LANG-530:


Suggested regexp: str.replaceAll("([-+][0-9][0-9]):([0-9][0-9])", "$1$2");

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
> Attachments: LANG-530-exception.patch
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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



[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-12-16 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12791811#action_12791811
 ] 

Henri Yandell commented on LANG-530:


No simple matter to parse the ZZ and then send the code on to 
SimpleDateFormat.parseObject. 

Definitely an option to point DateUtils to FastDateFormat and have an exception 
thrown if TimeZoneNumberRule.INSTANCE.COLON is in the pattern. Potential 
downside - FastDateFormat maintains a static cache of patterns used and we'd be 
exposing DateUtils users to that memory usage.

Another option is to modify the incoming String to not have the ':'. Either in 
DateUtils, or as it's a better fit, in the same code as above but with the 
modification instead of the exception. Downside is who knows what's in the 
pattern's literals.

A meld of the two:

Switch to FastDateFormat
If the pattern in use equals one of DateFormatUtils' ones, then use regexp.
Otherwise throw exception.

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.time.*
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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



[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-12-12 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789724#action_12789724
 ] 

Henri Yandell commented on LANG-530:


In either case - the better place for the fix is inside DateUtils rather than 
FastDateFormat.

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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



[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-12-12 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789722#action_12789722
 ] 

Henri Yandell commented on LANG-530:


Alternatively, implement parse(..) such that it handles ZZ before relying on 
SimpleDateFormat.

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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



[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-12-12 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12789720#action_12789720
 ] 

Henri Yandell commented on LANG-530:


I think the solution (so to speak) here is for DateUtils to throw an exception 
if a pattern is passed in containing ZZ. Might need a bit of parsing to avoid 
causing problems for people using the literal 'ZZ'.

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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



[jira] Commented: (LANG-530) parseDate cannot parse ISO8601 dates produced by FastDateFormat

2009-10-13 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12764977#action_12764977
 ] 

Henri Yandell commented on LANG-530:


Fixing this is not so easy. LANG-462 points out that FastDateFormat does not 
currently support parse/parseObject.

> parseDate cannot parse ISO8601 dates produced by FastDateFormat
> ---
>
> Key: LANG-530
> URL: https://issues.apache.org/jira/browse/LANG-530
> Project: Commons Lang
>  Issue Type: Bug
>Affects Versions: 2.4
>Reporter: Aaron Zeckoski
> Fix For: 3.0
>
>
> I cannot see why this is failing but here is my code:
>Date parseDate(String dateStr) {
>Date d = null;
>if (dateStr != null && ! "".equals(dateStr)) {
>try {
>// try to parse the date from ISO8601, general
> formats, and RFC-2822
>d = DateUtils.parseDate(dateStr, new String[] {
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()
>});
>} catch (ParseException e) {
>// nothing to do
>log.info("Failed to parse: " + dateStr + ":" + e, e);
>d = null;
>}
>}
>return d;
>}
> The string I am sending in to that method was generated like this:
> String isoDateStr = 
> DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
> The exception is:
> 2009-09-03 13:29:37,644 [399355...@qtp3-2] INFO
> search.SOLRSearchService  - Failed to parse:
> 2009-09-03T13:29:30+01:00:java.text.ParseException: Unable to parse
> the date: 2009-09-03T13:29:30+01:00
> java.text.ParseException: Unable to parse the date: 2009-09-03T13:29:30+01:00
>at org.apache.commons.lang.time.DateUtils.parseDate(DateUtils.java:285)
>at 
> org.steeple.impl.search.SOLRSearchService.parseDate(SOLRSearchService.java:412)
>at 
> org.steeple.impl.search.SOLRSearchService.execute(SOLRSearchService.java:311)
> 

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