trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sand...@apache.org
Subject [4/7] incubator-trafodion git commit: throw exception whe calling APIs of LOB after free() is called
Date Mon, 31 Jul 2017 05:41:53 GMT
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 <weiqing.xu@esgyn.cn>
Authored: Thu Jul 27 20:16:02 2017 +0800
Committer: Weiqing Xu <weiqing.xu@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);
 		}


Mime
View raw message