# HG changeset patch # User Martin van Dinther <martin.van.dinther@monetdbsolutions.com> # Date 1670523226 -3600 # Node ID b4e968e5bd741c5a94a0872deacd288bdde8637e # Parent f89882b076147b626557b65f80712768f0845a5f Some improvements. diff --git a/src/main/java/org/monetdb/jdbc/MonetConnection.java b/src/main/java/org/monetdb/jdbc/MonetConnection.java --- a/src/main/java/org/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java @@ -2791,7 +2791,7 @@ public class MonetConnection /** * addLine adds a String of data to this object's data array. - * Note that an IndexOutOfBoundsException can be thrown when an + * Note that an ArrayIndexOutOfBoundsException can be thrown when an * attempt is made to add more than the original construction size * specified. * @@ -3257,7 +3257,7 @@ public class MonetConnection // right, some protocol violation, // skip the rest of the result error = "M0M10!" + error; - in.discardRemainder(); + in.discardRemainder(error); break; } diff --git a/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java b/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java --- a/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java +++ b/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java @@ -15,10 +15,8 @@ import java.io.Reader; import java.io.UnsupportedEncodingException; /** - * Read text from a character-input stream, buffering characters so as - * to provide a means for efficient reading of characters, arrays and - * lines. This class is based on the BufferedReader class, and provides - * extra functionality useful for MCL. + * Read text from a character-input stream, buffering characters so as to + * provide a means for efficient reading of characters, arrays and lines. * * The BufferedMCLReader is typically used as layer inbetween an * InputStream and a specific interpreter of the data. @@ -40,7 +38,7 @@ import java.io.UnsupportedEncodingExcept * @see org.monetdb.mcl.net.MapiSocket * @see org.monetdb.mcl.io.BufferedMCLWriter */ -public final class BufferedMCLReader /* extends BufferedReader */ { +public final class BufferedMCLReader { private final BufferedReader inner; private String current = null; @@ -112,16 +110,18 @@ public final class BufferedMCLReader /* * * @return a string containing error messages, or null if there aren't any * @throws IOException if an IO exception occurs while talking to the server - * - * TODO(Wouter): should probably not have to be synchronized. */ - - - final public synchronized String discardRemainder() throws IOException { + final public String discardRemainder() throws IOException { return discard(null); } - final public synchronized String discardRemainder(String error) throws IOException { + /** + * Discard the remainder of the response but collect any further error messages. + * + * @return a string containing error messages, or null if there aren't any + * @throws IOException if an IO exception occurs while talking to the server + */ + final public String discardRemainder(String error) throws IOException { final StringBuilder sb; if (error != null) { @@ -133,6 +133,14 @@ public final class BufferedMCLReader /* return discard(sb); } + /** + * Discard the remainder of the response but collect any further error messages. + * + * @return a string containing error messages, or null if there aren't any + * @throws IOException if an IO exception occurs while talking to the server + * + * TODO(Wouter): should probably not have to be synchronized. + */ final synchronized String discard(StringBuilder errmsgs) throws IOException { while (lineType != LineType.PROMPT) { advance();