Merge pull request #72 from mminella/BATCH-1799

Batch-1799: Removed Arrays.copyof to support JDK 1.5
This commit is contained in:
Michael Minella
2012-11-16 11:37:51 -08:00

View File

@@ -19,7 +19,6 @@ import java.io.IOException;
import java.io.Writer;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Arrays;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
@@ -191,7 +190,9 @@ public class TransactionAwareBufferedWriter extends Writer {
public void write(char[] cbuf, int off, int len) throws IOException {
if (!transactionActive()) {
byte[] bytes = new String(Arrays.copyOfRange(cbuf, off, off + len)).getBytes(encoding);
char [] subArray = new char[len];
System.arraycopy(cbuf, off, subArray, 0, len);
byte[] bytes = new String(subArray).getBytes(encoding);
int length = bytes.length;
ByteBuffer bb = ByteBuffer.wrap(bytes);
int bytesWritten = channel.write(bb);