fyzhou / beanio

Automatically exported from code.google.com/p/beanio
Apache License 2.0
0 stars 0 forks source link

BeanIO 2.1.0.M2 incompatible with spring batch 2.2.5.RELEASE #106

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

First, thanx for your framework, it's helping a lot :)

I saw that your integration with spring batch is not working anymore.

In BeanIOFlatFileItemWriter, you get a new instance of 
TransactionAwareBufferedWriter. The constructor has changed for 
TransactionAwareBufferedWriter(FileChannel, Runnable for callback) since Nov 
13, 2012.

I change for my code the method like that : 

/**
* Creates a buffered writer opened to the beginning of the file
* for the given file channel.
*/
private Writer createBufferedWriter(FileChannel fileChannel, String encoding) {
    try {
        Writer writer = Channels.newWriter(fileChannel, encoding);

        if (transactional) {
            writer = new TransactionAwareBufferedWriter(fileChannel, new Runnable() { 
                @Override
                public void run() { 
                    Stream.this.destroy();
                }
            });
                        ((TransactionAwareBufferedWriter) writer).setEncoding(encoding);
        }
        else {
            writer = new BufferedWriter(writer);
        }
            return writer;
        }
    catch (UnsupportedCharsetException ex) {
        throw new ItemStreamException("Bad encoding configuration for output file " + fileChannel, ex);
    }
}

Do you think there is some inconsistency now? I don't but ... :)

Regards,

Phil

Original issue reported on code.google.com by rolez.ph...@gmail.com on 8 Apr 2014 at 8:17

GoogleCodeExporter commented 8 years ago
I find this : https://groups.google.com/forum/#!topic/beanio/N-FRNHIZcCc

sry,

i won't downgrade my spring-batch version ^^ I'll continue with my patch

Thx

Original comment by rolez.ph...@gmail.com on 8 Apr 2014 at 9:00