Changeset: 4320e6891536 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=4320e6891536
Modified Files:
src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
Branch: default
Log Message:
Replace AssertionError() with SQLException().
JDBC driver should not throw an AssertionError as it may stop the calling
application.
diffs (44 lines):
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -1934,11 +1934,12 @@ public class MonetConnection extends Mon
@Override
public void complete() throws SQLException {
String error = "";
- if (!isSet[NAMES]) error += "name header missing\n";
+ if (!isSet[NAMES]) error = "name header missing\n";
if (!isSet[TYPES]) error += "type header missing\n";
if (!isSet[TABLES]) error += "table name header
missing\n";
if (!isSet[LENS]) error += "column width header
missing\n";
- if (error != "") throw new SQLException(error, "M0M10");
+ if (!error.isEmpty())
+ throw new SQLException(error, "M0M10");
}
/**
@@ -2015,7 +2016,7 @@ public class MonetConnection extends Mon
/**
* Returns a line from the cache. If the line is already
present in the
- * cache, it is returned, if not apropriate actions are taken
to make
+ * cache, it is returned, if not appropriate actions are taken
to make
* sure the right block is being fetched and as soon as the
requested
* line is fetched it is returned.
*
@@ -2079,13 +2080,11 @@ public class MonetConnection extends Mon
}
// ok, need to fetch cache block first
- parent.executeQuery(
- commandTempl,
- "export " + id + " " + ((block
* cacheSize) + blockOffset) + " " + cacheSize
- );
+ parent.executeQuery(commandTempl,
+ "export " + id + " " + ((block
* cacheSize) + blockOffset) + " " + cacheSize);
rawr = resultBlocks[block];
if (rawr == null)
- throw new AssertionError("block " +
block + " should have been fetched by now :(");
+ throw new SQLException("resultBlocks["
+ block + "] should have been fetched by now", "M0M10");
}
return rawr.getRow(blockLine);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list