You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xmlgraphics.apache.org by bu...@apache.org on 2012/05/03 16:23:23 UTC

[Bug 53184] New: [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

          Priority: P2
            Bug ID: 53184
          Assignee: general@xmlgraphics.apache.org
           Summary: [PATCH] Unify date formatting between FOP and XGC as
                    well as tidying the date format code
          Severity: normal
    Classification: Unclassified
                OS: Linux
          Reporter: rmeyer@hotmail.co.uk
          Hardware: PC
            Status: NEW
           Version: Trunk
         Component: Utilities
           Product: XMLGraphicsCommons

Created attachment 28717
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28717&action=edit
Date formatting code changes as well as improved coverage of test cases

Both FOP and XGC projects had an identical method which formatted dates. This
patch looks to tidy up this code and have a single utility class which can be
used in XGC and referenced by FOP.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #13 from Pascal Sancho <pa...@takoma.fr> ---
(In reply to comment #12)
> After talking to Vincent, he suggested that FOP follows PDF specification
> 1.4, but I am certainly willing to change the patch to meet the latest
> specification if required.

Note that there is a new option config (see [1]):
  renderer[@mime="application/pdf"]/version

This should be taken into account if format is version dependent.

[1] http://xmlgraphics.apache.org/fop/trunk/configuration.html#pdf-renderer

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

Robert Meyer <rm...@hotmail.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #9 from Robert Meyer <rm...@hotmail.co.uk> ---
I have now changed the bug state bakc to NEW from NEEDINFO

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #16 from Glenn Adams <ga...@apache.org> ---
(In reply to comment #15)
> I have verified the code and will now close the issue. A new ticket (53208)
> been created relating to support for PDF Reference 1.7.

sounds good

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #15 from Robert Meyer <rm...@hotmail.co.uk> ---
I have verified the code and will now close the issue. A new ticket (53208)
been created relating to support for PDF Reference 1.7.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

Glenn Adams <ga...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Glenn Adams <ga...@apache.org> ---
please file an ICLA per [1] and i'll apply the patch; thanks

[1] http://www.apache.org/licenses/icla.txt

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #5 from Robert Meyer <rm...@hotmail.co.uk> ---
I am running the build on my home Windows machine and am getting failing tests
also, whereas the code was written, compiled and successfully passed the test
suite on my work Linux PC. I have spent several hours on it this evening but
have failed to identify and resolve the issue. I initially suspected that it
was because the date being formatted in the string wasn't including the offset,
but am still getting failing tests even with numerous changes and consulting
the existing code. I will resume my investigation once I get back in the office
which due to the bank holiday will now be Tuesday.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #2 from Chris Bowditch <bo...@hotmail.com> ---
Hi Robert, Glenn,

ICLA has been received by the Apache Secretary:
http://people.apache.org/committer-index.html

Thanks,

Chris

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #12 from Robert Meyer <rm...@hotmail.co.uk> ---
Hi Glenn,

The code I submitted has not changed the output from the existing method as
that also included a delimiter after the date:

    //Taken from PDFInfo.java in FOP

    protected String formatDateTime(Date time, TimeZone tz) {
        ...
            sb.append(Integer.toString(offsetMinutes));
            sb.append('\'');
        ...
    }


Reading Luis's comment on the existing patch I put submitted:

"Now, regarding the last ' after minutes, the third edition (1.4) spec says it
should be there while the 3200-1:2008 says it shouldn't... I had never noticed
it until now...."

After talking to Vincent, he suggested that FOP follows PDF specification 1.4,
but I am certainly willing to change the patch to meet the latest specification
if required.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #6 from Vincent Hennebert <vh...@gmail.com> ---
Try changing line 144 of DateFormatUtil.java from:
String dateFormat = (date.contains("Z")) ? "'Z'" : "Z";
to
String dateFormat = (date.contains("Z")) ? "+0000" : "Z";

I suppose that contrary to Linux, Mac and Windows systems assume local time
when no time zone information is present in the date to parse.

HTH,
Vincent

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #4 from Glenn Adams <ga...@apache.org> ---
(In reply to comment #3)
> Hi Glenn, Chris,
> 
> I was just about to post the fact I received the e-mail, but Chris just got
> there before me. Please let me know if there is anything else you need from
> me.
> 
> Best Regards,
> 
> Robert Meyer

test testDateFormattingISO8601 fails in the second assert below

String s = XMPSchemaAdapter.formatISO8601Date(dt, TimeZone.getTimeZone("GMT"));
assertEquals("2008-02-07T15:11:07Z", s);
assertEquals(dt, DateFormatUtil.parseISO8601Date(s));

with the following output

Testcase: testDateFormattingISO8601 took 0.01 sec
        FAILED
expected:<Thu Feb 07 07:11:07 PST 2008> but was:<Thu Feb 07 15:11:07 PST 2008>
junit.framework.AssertionFailedError: expected:<Thu Feb 07 07:11:07 PST 2008>
but was:<Thu Feb 07 15:11:07 PST 2008>
        at
org.apache.xmlgraphics.util.DateFormatUtilTestCase.testDateFormattingISO8601(DateFormatUtilTestCase.java:45)

i am running on MacOS X 10.6.8 and my current time zone is -8:00 (US/PDT)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #11 from Glenn Adams <ga...@apache.org> ---
(In reply to comment #8)
> Created attachment 28742 [details]
> Fix for existing patch code failing on Junit test
> 
> Thanks Vincent. After reading your first comment I came up with a near
> identical solution to your second comment and have now submitted this
> against the patch.

possible problem: ISO/IEC 32000:2008 Section 7.9.4 (aka PDF 1.7) specifies

A date shall be a text string of the form

(D:YYYYMMDDHHmmSSOHH'mm)

note that there is no delimiter after the mm field of the GMT offset; i notice
your code adds a delimiter

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

Robert Meyer <rm...@hotmail.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28717|0                           |1
        is obsolete|                            |

--- Comment #8 from Robert Meyer <rm...@hotmail.co.uk> ---
Created attachment 28742
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28742&action=edit
Fix for existing patch code failing on Junit test

Thanks Vincent. After reading your first comment I came up with a near
identical solution to your second comment and have now submitted this against
the patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #7 from Vincent Hennebert <vh...@gmail.com> ---
(In reply to comment #6)
Sorry, managed to confuse myself. The pattern should always have a "Z"
(unquoted), and the date to parse should be modified if it contains a 'Z'. In
formatDateToParse:

if (date.contains("Z")) {
    date = date.replace("Z", "+0000");
} else {
    /* the current code */
}

Something like that.

Vincent

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

Robert Meyer <rm...@hotmail.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

Glenn Adams <ga...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Glenn Adams <ga...@apache.org> ---
patch applied at http://svn.apache.org/viewvc?rev=1336053&view=rev

thanks Robert! please verify and close this bug if satisfied

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #3 from rmeyer@hotmail.co.uk ---
Hi Glenn, Chris,

I was just about to post the fact I received the e-mail, but Chris just got
there before me. Please let me know if there is anything else you need from me.

Best Regards,

Robert Meyer

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

rmeyer@hotmail.co.uk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |53185

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 53184] [PATCH] Unify date formatting between FOP and XGC as well as tidying the date format code

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53184

--- Comment #14 from Robert Meyer <rm...@hotmail.co.uk> ---
> Note that there is a new option config (see [1]):
>   renderer[@mime="application/pdf"]/version
> 
> This should be taken into account if format is version dependent.
> 
> [1] http://xmlgraphics.apache.org/fop/trunk/configuration.html#pdf-renderer

I agree with what you are both saying and it would be beneficial to implement
such a change in the future. I will open a new ticket for this as I feel the
current patch has fulfilled its original purpose.

-- 
You are receiving this mail because:
You are the assignee for the bug.