You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2017/07/31 05:41:53 UTC

[4/7] incubator-trafodion git commit: throw exception whe calling APIs of LOB after free() is called

throw exception whe calling APIs of LOB after free() is called


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/e762add3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/e762add3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/e762add3

Branch: refs/heads/master
Commit: e762add3f76881b61a94a0ef2cfecee895006135
Parents: eee713b
Author: Weiqing Xu <we...@esgyn.cn>
Authored: Thu Jul 27 20:16:02 2017 +0800
Committer: Weiqing Xu <we...@esgyn.cn>
Committed: Thu Jul 27 20:16:02 2017 +0800

----------------------------------------------------------------------
 .../src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java       | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e762add3/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java
----------------------------------------------------------------------
diff --git a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java
index c33c4f0..f7280fe 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java
@@ -50,6 +50,7 @@ public class TrafT4Clob extends TrafT4Lob implements Clob {
 
 	@Override
 	public InputStream getAsciiStream() throws SQLException {
+		testAvailability();
 		if (data_ != null) {
 			return new ByteArrayInputStream(((String) data_).getBytes());
 		}
@@ -105,6 +106,7 @@ public class TrafT4Clob extends TrafT4Lob implements Clob {
 
 	@Override
 	public long position(String searchstr, long start) throws SQLException {
+		testAvailability();
 		//start--;
 
 		if (start <= 0 || start > ((String) data_).length()) {
@@ -128,6 +130,7 @@ public class TrafT4Clob extends TrafT4Lob implements Clob {
 
 	@Override
 	public OutputStream setAsciiStream(long pos) throws SQLException {
+		testAvailability();
 		if (pos < 1) {
 			throw TrafT4Messages.createSQLException(this.connection_.props_, this.connection_.getLocale(),
 					"out_of_lob_bound_msg", null);
@@ -138,12 +141,14 @@ public class TrafT4Clob extends TrafT4Lob implements Clob {
 
 	@Override
 	public Writer setCharacterStream(long pos) throws SQLException {
+		testAvailability();
 		TrafT4Writer writer = new TrafT4Writer(this, pos);
 		return writer;
 	}
 
 	@Override
 	public int setString(long pos, String str) throws SQLException {
+		testAvailability();
 		int startIndex = (int) pos - 1;
 		if (startIndex < 0) {
 			throw TrafT4Messages.createSQLException(this.connection_.props_, this.connection_.getLocale(),
@@ -165,6 +170,7 @@ public class TrafT4Clob extends TrafT4Lob implements Clob {
 
 	@Override
 	public int setString(long pos, String str, int offset, int len) throws SQLException {
+		testAvailability();
 		int start = (int) pos - 1;
 		String replacestr = str.substring(offset, offset + len);
 		StringBuilder buf = new StringBuilder(((String) data_));
@@ -179,6 +185,7 @@ public class TrafT4Clob extends TrafT4Lob implements Clob {
 
 	@Override
 	public void truncate(long len) throws SQLException {
+		testAvailability();
 		if (len > ((String) data_).length()) {
 			throw TrafT4Messages.createSQLException(connection_.props_, null, null, null);
 		}