From: <pj...@us...> - 2008-12-09 08:45:37
|
Revision: 5723 http://jython.svn.sourceforge.net/jython/?rev=5723&view=rev Author: pjenvey Date: 2008-12-09 08:45:33 +0000 (Tue, 09 Dec 2008) Log Message: ----------- avoid an NPE when getSQLState is null thanks Matthew Harrison Modified Paths: -------------- trunk/jython/src/com/ziclix/python/sql/zxJDBC.java Modified: trunk/jython/src/com/ziclix/python/sql/zxJDBC.java =================================================================== --- trunk/jython/src/com/ziclix/python/sql/zxJDBC.java 2008-12-08 19:44:12 UTC (rev 5722) +++ trunk/jython/src/com/ziclix/python/sql/zxJDBC.java 2008-12-09 08:45:33 UTC (rev 5723) @@ -336,8 +336,9 @@ String state = ((SQLException)throwable).getSQLState(); // The SQL standard is not freely available, but // http://www.postgresql.org/docs/current/static/errcodes-appendix.html - // contains most of the SQLSTATES codes - if (state.length() == 5) { // Otherwise, the state is not following the standard. + // contains most of the SQLSTATES codes. + // Otherwise, the state is not following the standard. + if (state != null && state.length() == 5) { if (state.startsWith("23")) { //Class 23 => Integrity Constraint Violation type = IntegrityError; } else if (state.equals("40002")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |