Hi Abhinav,

Can you attach your most recent version of MessageUtils patch to DERBY-6801?

I should have some time over the next few days to have a closer look.

bryan

On 7/13/2015 2:00 PM, Abhinav Gupta wrote:
Hi Bryan,

If I try this alternative way, I get this error

[javac] 
/home/abhinav/Documents/Derby/Derby-6801/java/shared/org/apache/derby/shared/common/error/MessageUtils.java:88:
 error: ')' expected
     [javac]         return (cause instanceof carrier.getClass())
     [javac]                                                                    
      ^
     [javac] 
/home/abhinav/Documents/Derby/Derby-6801/java/shared/org/apache/derby/shared/common/error/MessageUtils.java:88:
 error: illegal start of expression
     [javac]         return (cause instanceof carrier.getClass())
     [javac]                                                                    
       ^
     [javac] 
/home/abhinav/Documents/Derby/Derby-6801/java/shared/org/apache/derby/shared/common/error/MessageUtils.java:88:
 error: ';' expected
     [javac]         return (cause instanceof carrier.getClass())
     [javac]                                                                    
        ^
     [javac] 
/home/abhinav/Documents/Derby/Derby-6801/java/shared/org/apache/derby/shared/common/error/MessageUtils.java:89:
 error: not a statement
     [javac]                 ? cause : null;
     [javac]                                 ^
     [javac] 4 errors


I understand from this, that java is unable to parse "carrier.getClass()", am I 
right ? Also I think I don't understand what would be passed as an argument for the 
Exception carrier, when getArgumentFerry(SQLException se, Exception carrier) is called ?



On Mon, Jul 13, 2015 at 8:23 AM, Bryan Pendleton <[email protected] 
<mailto:[email protected]>> wrote:

        Now when I included buildSqlerrmc(),  It needs 
StandardException.getArgumentFerry() to be precise.

        How should we solve this ?


    Hi Abhinav,

    Another possibility would be to move StandardException.getArgumentFerry
    out of StandardException and into MessageUtils.

    It's not a very complicated function, although it does need to
    be able to run 'instanceof'.

    Perhaps a MessageUtils implementation of this function could be
    something like:


         /**
          * Unpack the exception, looking for a StandardException, which carries
          * the Derby messageID and arguments.
          * @see org.apache.derby.impl.jdbc.SQLExceptionFactory
          * @see org.apache.derby.impl.jdbc.Util
          */
         public static Exception getArgumentFerry(SQLException se, Exception 
carrier)
         {
             Throwable cause = se.getCause();
             return (cause instanceof carrier.getClass()) ? cause : null;
         }

    Something like this might be an alternative approach.

    bryan



Reply via email to