Menu ▾ ▴

#9 Premature end of document

2018.1
closed
7
2018-06-27
2015-11-25
No

Hi,

I'm getting the message "Premature end of document" at a certain point in a file of data I downloaded from a tacho via CAN messages.

I checked the data from the CAN bus, and it's correctly written to the binary file.

Other tacho viewers (Tachosys) do not have a problem with the file, and I can't see a problem in that section of binary data, according to the standard.

If I could step through the code to work out the problem I would, but I'm new to this c++ and the environment.

Does anyone know what might be wrong with the file?

Thanks.

Ed.

3 Attachments

Related

Bugs: #9

Discussion

  • Ed Goldstein

    Ed Goldstein - 2016-01-07

    Hi Everyone,

    I have tracked down the problem here. Names and addresses are supposed to be left justified and padded with spaces.

    THis Tachograph is padding with zeros. See screenshots. it is also inserting a 02 instead of a 01 at the start of the workshop address field.

    When I replaced the zeros with spaces, and the 02 with 01, it all works fine.

    Therefore, no problem with ReadESM, more a problem with the tachograph. This data may well have come directly off the workshop card itself though. I don't know how to tell.

    Cheers,

    Ed.

     

    Last edit: Ed Goldstein 2016-01-07
  • mranderson2007

    mranderson2007 - 2016-01-09

    Thank you for your detailed bug report and investigation. Your effort is appreciated.

    As I am not the original author of readesm, I have no deep understanding of the standard. Even if this is not a bug in readesm, maybe it is a problem for which readesm ideally should (can?) have a workaround (and maybe display a hint to the user regarding a violation of the standard)?

     
  • Ed Goldstein

    Ed Goldstein - 2016-01-10

    Yes. I agree.
    In the DataDefinitions.xml, it's specified as a cpstring, and the field sizes are specified, so unless there really is no data left in the file, it should not just give up.

    I don't know if cpstring should have it's own datatype, so it can it's own toString to help with this?.

    <DataType name="VuCalibrationRecord">
        <title>VuCalibrationRecord</title>
        <comment>Used in the technical block on the vehicle unit, See page 163 of l207.pdf</comment>
        <content>
            <int name="calibrationPurpose" length="1" table="calibrationPurpose" />
            <cpstring name="workshopName" length="36" />
            <cpstring name="workshopAddress" length="36" />
            <FullCardNumber name="workshopCardNumber" />
            <TimeReal name="workshopCardExpiryDate" />
    

    The standard says (although this is in the section for "Printing"):

    PRT_005 String data fields are printed left aligned and filled up with spaces to data item length, or truncated to data item length when needed (names and addresses).

     

    Last edit: Ed Goldstein 2016-01-10
  • mranderson2007

    mranderson2007 - 2016-06-26

    As far as I see, parsing of the data completes successfully. It is the display of the XHTML data that fails.

    So, as a temporary workaround it should be possible to use the "Export as HTML" function and open it in a standalone browser. If the browser also refuses to render the page, try changing the file ending from xhtml to html.

    I am not sure yet how to properly fix this.

     
    • Ed Goldstein

      Ed Goldstein - 2016-06-26

      Yes, you are right. if i convert to html on the command line, it works fine.
      if I open the parser, then export to html, it just prints the same failure.
      Thank you.

      To: 9@bugs.readesm.p.re.sf.net
      From: mranderson2010@users.sf.net
      Subject: [readesm:bugs] #9 Premature end of document
      Date: Sun, 26 Jun 2016 02:26:07 +0000

      As far as I see, parsing of the data completes successfully. It is the display of the XHTML data that fails.

      So, as a temporary workaround it should be possible to use the "Export as HTML" function and open it in a standalone browser. If the browser also refuses to render the page, try changing the file ending from xhtml to html.

      I am not sure yet how to properly fix this.

      [bugs:#9] Premature end of document

      Status: open

      Group:

      Labels: Premature end of document Premature errors rendering

      Created: Wed Nov 25, 2015 03:35 PM UTC by Ed Goldstein

      Last Updated: Sun Jan 10, 2016 07:26 AM UTC

      Owner: nobody

      Attachments:

      TestTachoData.esm (1.6 kB; application/octet-stream)
      end_of_data.png (117.1 kB; image/png)
      readesm_error.png (89.1 kB; image/png)

      Hi,

      I'm getting the message "Premature end of document" at a certain point in a file of data I downloaded from a tacho via CAN messages.

      I checked the data from the CAN bus, and it's correctly written to the binary file.

      Other tacho viewers (Tachosys) do not have a problem with the file, and I can't see a problem in that section of binary data, according to the standard.

      If I could step through the code to work out the problem I would, but I'm new to this c++ and the environment.

      Does anyone know what might be wrong with the file?

      Thanks.

      Ed.

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/readesm/bugs/9/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #9

  • Marcin Wesolowski

    I faced similar problem while downloading from Stoneridge SE5000 tachograph - some strings are null-terminated instead of being filled up with spaces (but surprisingly most strings are correct), which causes XML parser to crash. In my case it was vuApprovalNumber field in Technical Data TREP). The same field downloaded from VDO tachograph is filled with spaces and thus parser works correctly.

    I know it's a violation of the standard, but I bet it would be easier to make workaround in ReadESM than to fix Stoneridge tachographs ;)

     
    • Ed Goldstein

      Ed Goldstein - 2017-03-30

      Yes. I have seen it in various different fields. Other readers seem to handle it.


      From: Marcin Wesolowski degu-monster@users.sf.net
      Sent: 30 March 2017 13:26
      To: [readesm:bugs]
      Subject: [readesm:bugs] #9 Premature end of document

      I faced similar problem while downloading from Stoneridge SE5000 tachograph - some strings are null-terminated instead of being filled up with spaces (but surprisingly most strings are correct), which causes XML parser to crash. In my case it was vuApprovalNumber field in Technical Data TREP). The same field downloaded from VDO tachograph is filled with spaces and thus parser works correctly.

      I know it's a violation of the standard, but I bet it would be easier to make workaround in ReadESM than to fix Stoneridge tachographs ;)


      [bugs:#9]https://sourceforge.net/p/readesm/bugs/9/ Premature end of document

      Status: open
      Group:
      Labels: Premature end of document Premature errors rendering
      Created: Wed Nov 25, 2015 03:35 PM UTC by Ed Goldstein
      Last Updated: Sun Jun 26, 2016 02:26 AM UTC
      Owner: nobody
      Attachments:

      Hi,

      I'm getting the message "Premature end of document" at a certain point in a file of data I downloaded from a tacho via CAN messages.

      I checked the data from the CAN bus, and it's correctly written to the binary file.

      Other tacho viewers (Tachosys) do not have a problem with the file, and I can't see a problem in that section of binary data, according to the standard.

      If I could step through the code to work out the problem I would, but I'm new to this c++ and the environment.

      Does anyone know what might be wrong with the file?

      Thanks.

      Ed.


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/readesm/bugs/9/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #9

  • mranderson2007

    mranderson2007 - 2018-06-23
    • assigned_to: mranderson2007
    • Group: --> 2018-1
    • Priority: 5 --> 7
     
  • mranderson2007

    mranderson2007 - 2018-06-24

    Alright, after three patches, this is finally ready for testing.

    • BCDs fixed
    • Actually decode using the specified code pages
    • Replace any null characters in fields consisting of code page number and string

    Please give it a try (Subversion revision 475 or newer).

     

    Last edit: mranderson2007 2018-06-26
  • mranderson2007

    mranderson2007 - 2018-06-24
    • status: open --> closed
     
  • Ed Goldstein

    Ed Goldstein - 2018-06-25

    Thanks for doing this fix. Is there an executable available for testing? I can't see one, and i don't think i can build it.

     
    • mranderson2007

      mranderson2007 - 2018-06-25

      Sorry, no, there is no executable, yet. We are working on it, but it will take some time. (ReadESM is basically a spare time project and we need a day or two on a weekend to make things pretty and get everything wrapped up)

      On which platform are you running ReadESM? Windows?

       
      • Ed Goldstein

        Ed Goldstein - 2018-06-26

        Fair enough. I understand.

        Yes. I am running Windows 10.

        However, if you can open the file that I attached to the bug report, then that's the test that I would run anyway.

        Get Outlook for Androidhttps://aka.ms/ghei36

        From: mranderson2007
        Sent: Tuesday 26 June, 01:58
        Subject: [readesm:bugs] Re: #9 Premature end of document
        To: [readesm:bugs]

        Sorry, no, there is no executable, yet. We are working on it, but it will take some time. (ReadESM is basically a spare time project and we need a day or two on a weekend to make things pretty and get everything wrapped up)
        On which platform are you running ReadESM? Windows?
        [bugs:#9]https://sourceforge.net/p/readesm/bugs/9/ Premature end of document
        Status: closed
        Group: 2018-1
        Labels: Premature end of document Premature errors rendering
        Created: Wed Nov 25, 2015 03:35 PM UTC by Ed Goldstein
        Last Updated: Mon Jun 25, 2018 06:44 AM UTC
        Owner: mranderson2007
        Attachments:
        TestTachoData.esmhttps://sourceforge.net/p/readesm/bugs/9/attachment/TestTachoData.esm (1.6 kB; application/octet-stream) end_of_data.pnghttps://sourceforge.net/p/readesm/bugs/9/attachment/end_of_data.png (117.1 kB; image/png) readesm_error.pnghttps://sourceforge.net/p/readesm/bugs/9/attachment/readesm_error.png (89.1 kB; image/png)
        Hi,
        I'm getting the message "Premature end of document" at a certain point in a file of data I downloaded from a tacho via CAN messages.
        I checked the data from the CAN bus, and it's correctly written to the binary file.
        Other tacho viewers (Tachosys) do not have a problem with the file, and I can't see a problem in that section of binary data, according to the standard.
        If I could step through the code to work out the problem I would, but I'm new to this c++ and the environment.
        Does anyone know what might be wrong with the file?
        Thanks.
        Ed.
        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/readesm/bugs/9/
        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

         

        Related

        Bugs: #9

        • mranderson2007

          mranderson2007 - 2018-06-26

          However, if you can open the file that I attached to the bug report, then that's the test that I would run anyway.

          The initial file TestTachoData.esm looks good here with the mentioned patches.

           

Log in to post a comment.