diff --git a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java index 30602c37..8a42a2cc 100644 --- a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java +++ b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java @@ -8,6 +8,7 @@ package nl.cwi.monetdb.mcl.connection.helpers; +import java.nio.Buffer; import java.nio.CharBuffer; /** @@ -56,7 +57,7 @@ private static int getNewCapacity(CharBuffer buffer) { public static CharBuffer reallocateBuffer(CharBuffer buffer) { int newCapacity = getNewCapacity(buffer); CharBuffer newBuffer = CharBuffer.wrap(new char[newCapacity]); - buffer.flip(); + ((Buffer)buffer).flip(); newBuffer.put(buffer.array()); return newBuffer; } diff --git a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java index 831c4936..43635391 100644 --- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java +++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.net.Socket; import java.net.SocketException; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.CharBuffer; @@ -56,7 +57,7 @@ public abstract class AbstractSocket implements Closeable { this.bufferIn = ByteBuffer.wrap(new byte[getFullBlockSize()]); this.bufferOut = ByteBuffer.wrap(new byte[getFullBlockSize()]); this.stringsDecoded = CharBuffer.allocate(getFullBlockSize()); - this.stringsDecoded.flip(); + ((Buffer)this.stringsDecoded).flip(); this.stringsEncoded = CharBuffer.allocate(getFullBlockSize()); } @@ -151,7 +152,7 @@ private void readToInputBuffer() throws IOException { this.utf8Decoder.reset(); this.utf8Decoder.decode(this.bufferIn, this.stringsDecoded,true); this.utf8Decoder.flush(this.stringsDecoded); - this.stringsDecoded.flip(); + ((Buffer)this.stringsDecoded).flip(); } /** @@ -193,7 +194,7 @@ public CharBuffer readLine(CharBuffer lineBuffer) throws IOException { } this.stringsDecoded.position(sourcePosition); lineBuffer.position(destinationPosition); - lineBuffer.flip(); + ((Buffer)lineBuffer).flip(); return lineBuffer; } @@ -204,7 +205,7 @@ public CharBuffer readLine(CharBuffer lineBuffer) throws IOException { * @throws IOException If an error in the underlying connection happened */ private void writeToOutputBuffer(boolean toFlush) throws IOException { - this.stringsEncoded.flip(); + ((Buffer)this.stringsEncoded).flip(); this.utf8Encoder.reset(); CoderResult res; int written = 0; diff --git a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/OldMapiSocket.java b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/OldMapiSocket.java index ba34371b..6b2336b2 100644 --- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/OldMapiSocket.java +++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/OldMapiSocket.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.Buffer; import java.nio.ByteBuffer; /** @@ -241,7 +242,7 @@ public int read(ByteBuffer b, int off, int len) throws IOException { connection.getPort() + ": Incomplete block read from stream"); } b.position(size); - b.flip(); + ((Buffer)b).flip(); return size; } diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java index a055f565..ef6883e7 100644 --- a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java @@ -20,6 +20,7 @@ import nl.cwi.monetdb.mcl.responses.UpdateResponse; import java.io.IOException; +import java.nio.Buffer; import java.nio.CharBuffer; import java.text.SimpleDateFormat; import java.util.Map; @@ -126,7 +127,7 @@ public void fetchNextResponseData() throws IOException { newbuffer.put("!22000"); newbuffer.put(this.lineBuffer.array(), 0, limit); newbuffer.limit(limit + 6); - newbuffer.flip(); + ((Buffer)newbuffer).flip(); this.lineBuffer = newbuffer; } this.lineBuffer.position(1); diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java index 72b31a81..211247ef 100644 --- a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java @@ -16,6 +16,7 @@ import nl.cwi.monetdb.mcl.protocol.ProtocolException; import java.math.BigDecimal; +import java.nio.Buffer; import java.nio.CharBuffer; import java.sql.Types; import java.util.Calendar; @@ -163,7 +164,7 @@ static int oldMapiParseTupleLine(OldMapiProtocol protocol, int lineNumber, int[] } } // put the unescaped string in the right place - tupleLineBuffer.flip(); + ((Buffer)tupleLineBuffer).flip(); oldMapiStringToJavaDataConversion(protocol, tupleLineBuffer.array(), 0, tupleLineBuffer.limit(), lineNumber, values[column], typesMap[column]); } else if ((i - 1) - cursor == 4 && OldMapiTupleLineParserHelper.charIndexOf(array,