Bug 47941 - AFP Renderer Truncates TLE Values
Summary: AFP Renderer Truncates TLE Values
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: trunk
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-06 00:53 UTC by Chris Bowditch
Modified: 2012-04-01 06:39 UTC (History)
0 users



Attachments
XSL-FO to reproduce the problem (2.94 KB, application/octet-stream)
2009-10-07 06:47 UTC, Chris Bowditch
Details
additional sample (4.40 KB, application/octet-stream)
2009-10-19 03:50 UTC, Harald G. Henne
Details
my output for additional sample (19.34 KB, text/plain)
2009-10-19 03:54 UTC, Harald G. Henne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Bowditch 2009-10-06 00:53:20 UTC
2 of the longer TLE Values in attached XSL-FO File are truncated by AFP Renderer. Apecifically the TLEs with name JES0 and ACC1 are truncated using a recent revision of FOP trunk. I can't see any specific limit for TLE records in the MO:DCA specification.
Comment 1 Venkat Reddy 2009-10-07 03:18:28 UTC
Hi Chris,

Can you please attach the XSL-FO file you used for this test case?

Thanks,
Venkat.


(In reply to comment #0)
> 2 of the longer TLE Values in attached XSL-FO File are truncated by AFP
> Renderer. Apecifically the TLEs with name JES0 and ACC1 are truncated using a
> recent revision of FOP trunk. I can't see any specific limit for TLE records in
> the MO:DCA specification.
Comment 2 Chris Bowditch 2009-10-07 06:47:45 UTC
Created attachment 24355 [details]
XSL-FO to reproduce the problem
Comment 3 Chris Bowditch 2009-10-07 06:48:42 UTC
Sorry - I seem to be having some problems with Bugzilla and attachments. I did attach the XSL-FO File when I logged the bug but Bugzilla had a problem with the content type and didn't tell me. Grmbl
Comment 4 Harald G. Henne 2009-10-19 03:45:36 UTC
In the world of AFP a TLE is normally written out by the
two triplets 0x02 and 0x36. The max lenght of any triplet
is 254 bytes and this limit is the reason for the mentioned truncation. 
On the other side it is quite common to remove any trailing blanks 
of TLE values. 

I checked out the current trunk and the produced afp is not valid.

my afp dump:

    0xD3A090: TLE Tag Logical Element [322] (Offset 34)
              T02: Fully Qualified Name [6]
                   FQNType:    0x0B (Attribute GID)
                   FQNFmt:     0x00 (Character string)
                   FQName:     "JES0"
              T36: Attribute Value [46]
                   Reserved:   00 00 
                   AttVal:     "JES00927200       90INITIATION     REGULAR  "
                   (hex:)      D1 C5 E2 F0 F0 F9 F2 F7 F2 F0 F0 40 40 40 40 40 
                               40 40 F9 F0 C9 D5 C9 E3 C9 C1 E3 C9 D6 D5 40 40 
                               40 40 40 D9 C5 C7 E4 D3 C1 D9 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 F6 F9 F0 60 F5 F0 F1 40 40 40 F3 F9 
                   F0 60 40 F1 F2 F7 40 40 40 40 F2 F7 F2 F0 F0 F0 
                   F2 F1 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T80: Attribute Qualifier [8]
                   SeqNum:     0x00000000 (0)
                   LevNum:     0x00000001 (1)
    0xD3A090: TLE Tag Logical Element [340] (Offset 365)
              T02: Fully Qualified Name [6]
                   FQNType:    0x0B (Attribute GID)
                   FQNFmt:     0x00 (Character string)
                   FQName:     "ACC1"
              T36: Attribute Value [64]
                   Reserved:   00 00 
                   AttVal:     "ACC1374316469000000    690-501    EN                          "
                   (hex:)      C1 C3 C3 F1 F3 F7 F4 F3 F1 F6 F4 F6 F9 F0 F0 F0 
                               F0 F0 F0 40 40 40 40 F6 F9 F0 60 F5 F0 F1 40 40 
                               40 40 C5 D5 40 40 40 40 40 40 40 40 40 40 40 40 
                               40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 F0 F0 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 F0 F0 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T40: - unknown triplet - [62]
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                   40 40 40 40 40 40 40 40 40 40 40 40 40 40 
              T80: Attribute Qualifier [8]
                   SeqNum:     0x00000001 (1)
                   LevNum:     0x00000001 (1)
    0xD3A090: TLE Tag Logical Element [124] (Offset 714)
              T02: Fully Qualified Name [6]
                   FQNType:    0x0B (Attribute GID)
                   FQNFmt:     0x00 (Character string)
                   FQName:     "ADR1"
              T36: Attribute Value [104]
                   Reserved:   00 00 
                   AttVal:     "ADR1MICKEY MOUSE                                                                                      "
                   (hex:)      C1 C4 D9 F1 D4 C9 C3 D2 C5 E8 40 D4 D6 E4 E2 C5 
                               40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                               40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                               40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                               40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                               40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 
                               40 40 40 40 40 40 
              T80: Attribute Qualifier [8]
                   SeqNum:     0x00000002 (2)
                   LevNum:     0x00000001 (1)
...
Comment 5 Harald G. Henne 2009-10-19 03:50:03 UTC
Created attachment 24393 [details]
additional sample
Comment 6 Harald G. Henne 2009-10-19 03:54:33 UTC
Created attachment 24394 [details]
my output for  additional sample
Comment 7 Harald G. Henne 2009-10-19 05:00:16 UTC
secondly i tried it with a small testcase holding
10 TLEs with increasing value length:

input:
<afp:tag-logical-element name="name250" value=  ..."/>
<afp:tag-logical-element name="name251" value=  ...1"/>
<afp:tag-logical-element name="name252" value=  ...12"/>
<afp:tag-logical-element name="name253" value=  ...123"/>
<afp:tag-logical-element name="name254" value=  ...1234"/>
<afp:tag-logical-element name="name255" value=  ...12345"/>
<afp:tag-logical-element name="name256" value=  ...123456"/>
<afp:tag-logical-element name="name257" value=  ...1234567"/>
<afp:tag-logical-element name="name258" value=  ...12345678"/>
<afp:tag-logical-element name="name259" value=  ...123456789"/>

the first failure will be for TLE with name "name253" and it just looks like 
a overflow.

$ grep T36 testcase001.dmp 
              T36: Attribute Value [251]
              T36: Attribute Value [252]
              T36: Attribute Value [253]
              T36: Attribute Value [0]
              T36: Attribute Value [0]
              T36: Attribute Value [0]
              T36: Attribute Value [1]
              T36: Attribute Value [2]
              T36: Attribute Value [3]
              T36: Attribute Value [4]

in my opinion the best will be to split up such problem TLEs and write out several
TLE structed fields with incremented triplet 0x80 'Sequence Number'. 

Unfortunately i did no java debugging for the last few years i have first to setup 
eclipse or IntelliJ on my computer.
Comment 8 Venkat Reddy 2009-10-20 07:12:49 UTC
It is better to warn the user atleast when used more than 254 bytes for the TLE value, so that he will get an idea about the truncation happened because of lengthy input value.

(In reply to comment #7)
> secondly i tried it with a small testcase holding
> 10 TLEs with increasing value length:
> input:
> <afp:tag-logical-element name="name250" value=  ..."/>
> <afp:tag-logical-element name="name251" value=  ...1"/>
> <afp:tag-logical-element name="name252" value=  ...12"/>
> <afp:tag-logical-element name="name253" value=  ...123"/>
> <afp:tag-logical-element name="name254" value=  ...1234"/>
> <afp:tag-logical-element name="name255" value=  ...12345"/>
> <afp:tag-logical-element name="name256" value=  ...123456"/>
> <afp:tag-logical-element name="name257" value=  ...1234567"/>
> <afp:tag-logical-element name="name258" value=  ...12345678"/>
> <afp:tag-logical-element name="name259" value=  ...123456789"/>
> the first failure will be for TLE with name "name253" and it just looks like 
> a overflow.
> $ grep T36 testcase001.dmp 
>               T36: Attribute Value [251]
>               T36: Attribute Value [252]
>               T36: Attribute Value [253]
>               T36: Attribute Value [0]
>               T36: Attribute Value [0]
>               T36: Attribute Value [0]
>               T36: Attribute Value [1]
>               T36: Attribute Value [2]
>               T36: Attribute Value [3]
>               T36: Attribute Value [4]
> in my opinion the best will be to split up such problem TLEs and write out
> several
> TLE structed fields with incremented triplet 0x80 'Sequence Number'. 
> Unfortunately i did no java debugging for the last few years i have first to
> setup 
> eclipse or IntelliJ on my computer.
Comment 9 Adrian Cumiskey 2009-10-22 06:21:17 UTC
This bug was originally misdiagnosed.  The TLE values were not being truncated as Chris suggested.  As I see it, Harald is correct in his description of the issue.  Triplets are a maximum of 254 bytes, therefore Attribute Value Triplets can legally hold a maximum of 250 bytes including the header.  So the solution as I see it is that the value must be truncated to 250 characters and a warning provided.  I have now resolved this in trunk.

Adrian.
Comment 10 Chris Bowditch 2009-10-22 08:01:43 UTC
Thanks for the fix Adrian. You are correct that my original report wasn't technically accurate but then I didn't have time to look into the details. Still I am happy with the final resolution.
Comment 11 Glenn Adams 2012-04-01 06:39:32 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed