Subject | Re: After UDF exception, the current connection stops working |
---|---|
Author | vmdd_tech |
Post date | 2004-01-06T17:32:45Z |
Hello Roman,
Your test case did not really cover what I reported. Below is
a modification of your test case. (I am sorry I don't know how
to write junit test case):
try {
String query = "SELECT id, substr(long_str,1,2) FROM
test_table";
ResultSet rs;
try {
rs = stmt.executeQuery(query);
assertTrue("Should have at least one row", rs.next());
rs.close();
} catch(SQLException ex) {
// it is ok as well, since substr is declared as
CSTRING(80)
// and truncation error happens
System.out.println ("Query 1 is causing exception");
}
try {
rs = stmt.executeQuery(query);
assertTrue("Should have at least one row", rs.next());
Object tmp = rs.getObject (1); //This should cause
null pointer exception
System.out.println ("Value of Id is " + tmp.toString
());
rs.close();
} catch(SQLException ex) {
// it is ok as well, since substr is declared as
CSTRING(80)
// and truncation error happens
System.out.println ("Query 2 is causing exception");
}
} finally {
stmt.close();
}
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
Your test case did not really cover what I reported. Below is
a modification of your test case. (I am sorry I don't know how
to write junit test case):
try {
String query = "SELECT id, substr(long_str,1,2) FROM
test_table";
ResultSet rs;
try {
rs = stmt.executeQuery(query);
assertTrue("Should have at least one row", rs.next());
rs.close();
} catch(SQLException ex) {
// it is ok as well, since substr is declared as
CSTRING(80)
// and truncation error happens
System.out.println ("Query 1 is causing exception");
}
try {
rs = stmt.executeQuery(query);
assertTrue("Should have at least one row", rs.next());
Object tmp = rs.getObject (1); //This should cause
null pointer exception
System.out.println ("Value of Id is " + tmp.toString
());
rs.close();
} catch(SQLException ex) {
// it is ok as well, since substr is declared as
CSTRING(80)
// and truncation error happens
System.out.println ("Query 2 is causing exception");
}
} finally {
stmt.close();
}
--- In Firebird-Java@yahoogroups.com, "Roman Rokytskyy"
<rrokytskyy@a...> wrote:
> Hi,it
>
> Sorry, I cannot reproduce your bug report. In CVS,
> client-java/src/test/org/firebirdsql/jdbc/ directory you will find a
> class TestFBResultSet, its last method testBugReport1() tries to
> reproduce your bug. Please, modify the code of that method so, that
> will cause NullPointerException you're talking about.
>
> > I don't think the problem is in my Venus.doShowResultset because
> > a different SQL Manager from Hypersonic has the same problem.
> > As a matter of fact my Venus.doShowResultset should not be called
> > in the first place. Here is the code:
> >
> > try {
> > executionTime_i = System.currentTimeMillis ();
> > res_i = stmt_i.executeQuery (sql);
> > executionTime_i = System.currentTimeMillis () -
> > executionTime_i;
> > }
> > catch (SQLException e) {
> > dispStatus ("ERROR: Failed to execute the cmd. Reason: " +
> > e.getMessage ());
> > e.printStackTrace ();
> > return;
> >}
> >
> >
> > // tmpPane.append
> >
> > final JTextArea tmpPane2 = tmpPane;
> > Runnable subThread = new Runnable () {
> > public void run () {
> > int rowCnt = doShowResultset (tmpPane2);
> > dispStatus (rowCnt + " row(s) in " +
> > executionTime_i + " ms (" + new java.util.Date ().toString () +
> > ")");
> > if (graphics_i != null) update (graphics_i);
> > }
> > };
> > SwingUtilities.invokeLater (subThread);
>
> Can it be that you close the statement before the doShowResultset is
> called?
>
> Best regards,
> Roman Rokytskyy