comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 690:f7946d36d1dd

Extend error messages with the linetype to give more info.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Wed, 16 Nov 2022 20:11:42 +0100 (2022-11-16)
parents 35653312f9cb
children 2233b172e06d
comparison
equal deleted inserted replaced
689:4d3b2cf24b30 690:f7946d36d1dd
2339 } 2339 }
2340 2340
2341 /** 2341 /**
2342 * Parses the given string and changes the value of the matching 2342 * Parses the given string and changes the value of the matching
2343 * header appropriately, or passes it on to the underlying 2343 * header appropriately, or passes it on to the underlying
2344 * DataResponse. 2344 * DataBlockResponse.
2345 * 2345 *
2346 * @param tmpLine the string that contains the header 2346 * @param tmpLine the string that contains the header
2347 * @return a non-null String if the header cannot be parsed or 2347 * @return a non-null String if the header cannot be parsed or
2348 * is unknown 2348 * is unknown
2349 */ 2349 */
2359 } 2359 }
2360 2360
2361 if (linetype != LineType.HEADER) { 2361 if (linetype != LineType.HEADER) {
2362 if (!isSet[TYPESIZES]) 2362 if (!isSet[TYPESIZES])
2363 isSet[TYPESIZES] = true; 2363 isSet[TYPESIZES] = true;
2364 return "Header expected, got: " + tmpLine; 2364 return "Header expected, got " + linetype + " line: " + tmpLine;
2365 } 2365 }
2366 2366
2367 // depending on the name of the header, we continue 2367 // depending on the name of the header, we continue
2368 try { 2368 try {
2369 switch (hlp.parse(tmpLine)) { 2369 switch (hlp.parse(tmpLine)) {
2786 * or additional lines are not allowed. 2786 * or additional lines are not allowed.
2787 */ 2787 */
2788 @Override 2788 @Override
2789 public String addLine(final String line, final LineType linetype) { 2789 public String addLine(final String line, final LineType linetype) {
2790 if (linetype != LineType.RESULT) 2790 if (linetype != LineType.RESULT)
2791 return "protocol violation: unexpected line in data block: " + line; 2791 return "protocol violation: unexpected " + linetype + " line in data block: " + line;
2792 // add to the backing array 2792 // add to the backing array
2793 data[++pos] = line; 2793 data[++pos] = line;
2794 2794
2795 // all is well 2795 // all is well
2796 return null; 2796 return null;