Results 1 to 1 of 1

Thread: Row count in the file header and using RandomAccessFile in the StepExecutionListener

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    19

    Default Row count in the file header and using RandomAccessFile in the StepExecutionListener

    Hi,

    I have to put the total row count in the header of a file. I am trying to update the file in the 'afterStep' callback of StepExecutionListener. I am doing this by creating an object of RandomAccessFile (with "rw" mode) an updating the first line of the file (the main file on which the writer worked upon) with RandomAccessFile.writeBytes method. But this does not seem to be working at all. Nothing happens. No error or exception but no updated either. My main file gets generated properly with all the expected data inside it but there is no update in the header.

    To dig in further I have tried to create a totally new file also in the callback method and even that is not being created. Bizzarely a empty 0-byte file with only 'file' as a name is created in the directory. Again, the main file is generated properly.

    I am using a CompositeItemWriter which delegates the file writing to a FlatFileItemWriter extended class. I am also using Header and Footer callbacks.

    Please advise. Thanks a lot. What am I missing?


    Edit: Please delete this thread. It was a file resource path issue which is resolved. Sorry for any inconvenience.
    Last edited by haqyunus; Aug 27th, 2011 at 01:03 PM. Reason: Found out the issue. It can be closed now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •