Issue1447857

classification
Title: child java exception not catched by parent exception
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, gregy
Priority: low Keywords:

Created on 2006-03-11.12:11:16 by anonymous, last changed 2006-08-06.00:48:54 by cgroves.

Messages
msg1109 (view) Author: Nobody/Anonymous (nobody) Date: 2006-03-11.12:11:16
my code catches java.sql.SQLException but it doesn't
catch exception of class org.postgresql.util.PSQLException.

equivalent java code works ok. both codes are included.

jython jr.py throws this:
org.postgresql.util.PSQLException: ERROR: syntax error
at or near "aaaaa"

java Jr print 'sqlexception' so exception is catched.
msg1110 (view) Author: Jan Gregor (gregy) Date: 2006-03-11.12:16:12
Logged In: YES 
user_id=769940

jython code
-----------

from java.sql import *
from java.lang import *

from org.postgresql.util import PSQLException

conn = None

try:
    Class.forName("org.postgresql.Driver")

    url = "jdbc:postgresql:mydb"
    user = "admin"
    password = " "

    conn = DriverManager.getConnection(url, user, password)

except ClassNotFoundException:
    print("Unable to load Driver Class ")
except SQLException, e:
    print e

try:
    stmt = conn.createStatement()
    stmt.execute("aaaaa")
except (SQLException), se:
    print 'SQLException'


java code
----------

  public String test ()
  {
        Connection conn = null;

        try {
            Class.forName("org.postgresql.Driver");

            String url = "jdbc:postgresql:mydb";
            String user = "admin";
            String password = " ";

            conn = DriverManager.getConnection(url, user,
password);

        } catch (ClassNotFoundException e) {
            System.out.println("Unable to load Driver Class ");
            System.exit(0);
        } catch (SQLException ee) {
            ee.printStackTrace();
            System.exit(0);
        }

        try {
            Statement stmt = conn.createStatement();
            stmt.execute("aaaaa");
        } catch (SQLException se) {
            System.out.println("sqlexception");
            se.printStackTrace();
        }
        return null;
  }
msg1111 (view) Author: Jan Gregor (gregy) Date: 2006-03-15.19:30:28
Logged In: YES 
user_id=769940

tested with jython 2.2a too. same symptoms as with jython 2.1.
msg1112 (view) Author: Charlie Groves (cgroves) Date: 2006-08-06.00:48:54
Logged In: YES 
user_id=1174327

Same problem as 1531644
History
Date User Action Args
2006-03-11 12:11:16anonymouscreate