Bug 1306519 - Clob.getSubstring(int,int) returns empty or whole string
Clob.getSubstring(int,int) returns empty or whole string
Status: CLOSED CURRENTRELEASE
Product: JBoss Data Virtualization 6
Classification: JBoss
Component: Teiid (Show other bugs)
6.3.0
Unspecified Unspecified
unspecified Severity unspecified
: ER1
: 6.3.0
Assigned To: Van Halbert
Juraj Duráni
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-11 02:10 EST by Juraj Duráni
Modified: 2016-08-24 07:49 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-08-24 07:49:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker TEIID-3971 Blocker Closed Clob.getSubstring(int,int) returns empty or whole string 2016-06-08 08:00 EDT

  None (edit)
Description Juraj Duráni 2016-02-11 02:10:27 EST
Description of problem:
Method java.sql.Clob.getSubstring(int,int) returns either empty string (if second argument, length, is 0) or whole string (if length >= 1).

Steps to Reproduce:
> DDL
CREATE FOREIGN TABLE smalla(
    intkey integer PRIMARY KEY OPTIONS(NAMEINSOURCE 'intkey', NATIVE_TYPE 'int4'),
    objectvalue clob OPTIONS(NAMEINSOURCE 'objectvalue', NATIVE_TYPE 'text'))
  OPTIONS(NAMEINSOURCE 'smalla');

> Query:
SELECT * FROM smalla

> Java code:
Connection con = org.teiid.jdbc.TeiidDriver.getInstance().connect("jdbc:teiid:test@mm://localhost:31000", info);
ResultSet rs = con.createStatement().executeQuery("select * from source_pg.smalla");
rs.next();
LOG.info("CLOB: {}", rs.getClob(2).getClass());
LOG.info("CLOB: {}", rs.getClob(2).getSubString(1, 1));
LOG.info("CLOB: {}", rs.getClob(2).getSubString(1, 0));
LOG.info("CLOB: {}", rs.getClob(2).getSubString(1, -1));
con.close();

> Output:
08:03:44.089 [main] INFO  sandbox.MainClass - CLOB: class org.teiid.core.types.ClobImpl
08:03:44.091 [main] INFO  sandbox.MainClass - CLOB: -24
08:03:44.092 [main] INFO  sandbox.MainClass - CLOB: 
Exception in thread "main" java.sql.SQLException: Invalid length argument to getSubString(): -1
	at org.teiid.core.types.ClobImpl.getSubString(ClobImpl.java:154)
	at sandbox.MainClass.main(MainClass.java:81)
Comment 1 JBoss JIRA Server 2016-02-11 08:31:36 EST
Steven Hawkins <shawkins@redhat.com> updated the status of jira TEIID-3971 to Resolved
Comment 2 Juraj Duráni 2016-02-11 09:16:33 EST
Setting 'blocker' to ? because JIRA is blocker.
Comment 3 JBoss JIRA Server 2016-06-08 08:00:44 EDT
Steven Hawkins <shawkins@redhat.com> updated the status of jira TEIID-3971 to Closed

Note You need to log in before you can comment on or make changes to this bug.