Message1184
I'm investigating an old bug registered against the
Debian package of
Jython :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=281038
While searching on the web for similar problems I
found this thread :
http://mail.python.org/pipermail/python-list/2004-August/232592.html
I think the root problem may be the same. But it does
not contain any
answer.
I think I have reduced the problem to a problem with
"import *" :
---------------------------------
import java
java.lang.Class.forName('org.postgresql.Driver')
try:
con=
java.sql.DriverManager.getConnection('jdbc:postgresql:skdb',
'admin', '')
# raise an SQLException because I have no postgres
server
except java.sql.SQLException, e:
print 'Caught SQLException'
print 'Class:', e.getClass().getName()
print 'Base class:',
e.getClass().getSuperclass().getName()
else:
print 'UnCaught'
---------------------------------
On my Debian testing box, with Jython 2.1, the Postgres
java driver and
java1.5.0_06 (Debian package of Sun JDK), this code
prints :
---------------------------------
Caught SQLException
Class: org.postgresql.util.PSQLException
Base class: java.sql.SQLException
---------------------------------
Now consider this code :
---------------------------------
from java.lang import Class
from java.lang import Exception as JavaException
from java.sql import *
Class.forName('org.postgresql.Driver')
try:
con=
DriverManager.getConnection('jdbc:postgresql:skdb',
'admin', '')
# raise an SQLException because I have no postgres
server
except SQLException, e:
print 'Caught SQLException'
print 'Class:', e.getClass().getName()
print 'Base class:',
e.getClass().getSuperclass().getName()
except JavaException, e:
print 'Caught JavaException'
print 'Class:', e.getClass().getName()
print 'Base class:',
e.getClass().getSuperclass().getName()
print 'Base base class:',
e.getClass().getSuperclass().getSuperclass().getName()
else:
print 'UnCaught'
---------------------------------
it prints :
---------------------------------
Caught JavaException
Class: org.postgresql.util.PSQLException
Base class: java.sql.SQLException
Base base class: java.lang.Exception
---------------------------------
I know the "import *" is discouraged with Jython. But
I wondered if
this precise limitation is known.
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:31 | admin | link | issue1531644 messages |
2008-02-20 17:17:31 | admin | create | |
|