BATCH-1779: Removed Arrays.copyOf to support JDK 1.5

This commit is contained in:
Michael Minella
2012-11-16 13:36:00 -06:00
parent b9f2ddcb6a
commit 19bf980428

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);