Hi, all. In evaluating diffs currently happening in JDK 1.6 derbyall, I ran across this strange diff:

398d397
< ERROR 38000: The exception 'java.sql.SQLException: The external routine is not allowed to execute SQL statements.' was thrown while evaluating an expression.

Basically what is happening is in JDK 1.6 Derby is not wrapping 38001 inside 38000. The reason? Well, in JDK 1.6, Derby public methods throws SQLExceptions that are *not* a subclass of EmbedSQLException.

This results in different logic in the method StandardException.unexpectedUserException():

        public static StandardException unexpectedUserException(Throwable t)
        {
                /*
                ** If we have a SQLException that isn't a Util
                ** (i.e. it didn't come from cloudscape), then we check
                ** to see if it is a valid user defined exception range
                ** (38001-38XXX).  If so, then we convert it into a
                ** StandardException without further ado.
                */
                if ((t instanceof SQLException) &&
                    !(t instanceof EmbedSQLException))
                {
                        SQLException sqlex  = (SQLException)t;
                        String state = sqlex.getSQLState();
                        if ((state != null) &&
                                (state.length() == 5) &&
                                state.startsWith("38") &&
                                !state.equals("38000"))
                        {
                                StandardException se = new 
StandardException(state, sqlex.getMessage());
                                if (sqlex.getNextException() != null)           
                                {       
                                        
se.setNestedException(sqlex.getNextException());
                                }
                                return se;
                        }
                }

So, my question is, should I codify this by creating a jdk16 master file for procedureInTrigger.sql? Or is this something we need to try and address?

What also is curious is that this should have shown up elsewhere. I'm noticing a lot of other JDK 1.6-specific master files -- maybe this is part of it?

Thanks,

David

Reply via email to