From: SourceForge.net <no...@so...> - 2006-03-15 19:30:29
|
Bugs item #1447857, was opened at 2006-03-11 13:11 Message generated for change (Comment added) made by gregy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1447857&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: child java exception not catched by parent exception Initial Comment: 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. ---------------------------------------------------------------------- Comment By: Jan Gregor (gregy) Date: 2006-03-15 20:30 Message: Logged In: YES user_id=769940 tested with jython 2.2a too. same symptoms as with jython 2.1. ---------------------------------------------------------------------- Comment By: Jan Gregor (gregy) Date: 2006-03-11 13:16 Message: 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; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=1447857&group_id=12867 |