Derby
  1. Derby
  2. DERBY-5839

dblook run on toursdb fails on triggers with java.lang.StringIndexOutOfBoundsException in dblook.log

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.9.2.2, 10.10.1.1
    • Component/s: Tools
    • Environment:
    • Issue & fix info:
      High Value Fix, Newcomer, Repro attached
    • Bug behavior facts:
      Regression

      Description

      Running dblook on toursdb (either in packaged demo/databases/toursdb in the bin distribution or generated/toursdb after a build) fails to generate ddl for triggers and gives a java.lang.StringIndexOutOfBoundsException in the dblook.log.

      To reproduce:

      java org.apache.derby.tools.dblook -d 'jdbc:derby:toursdb'

      output shows:

      – ----------------------------------------------
      – Note: At least one unexpected error/warning message was
      – DDL Statements for triggersration. See dblook.log
      – ----------------------------------------------

      dblook.log contains:

      java.lang.StringIndexOutOfBoundsException
      at java.lang.String.substring(String.java:1131)
      at org.apache.derby.tools.dblook.getColumnListFromDescription(dblook.java:664)
      at org.apache.derby.impl.tools.dblook.DB_Trigger.createTrigger(DB_Trigger.java:130)
      at org.apache.derby.impl.tools.dblook.DB_Trigger.doTriggers(DB_Trigger.java:82)
      at org.apache.derby.tools.dblook.go(dblook.java:547)
      at org.apache.derby.tools.dblook.<init>(dblook.java:142)
      at org.apache.derby.tools.dblook.main(dblook.java:97)

      This seems to be a regression in 10.9. 10.8 works fine for me

        Activity

        Hide
        Mamta A. Satoor added a comment -

        I have been working on this issue and problem appears to be that starting 10.9, we have extended SYSTRIGGERS.REFERENCEDCOLUMNS to hold more information that it used to in prior releases. Prior to 10.9, REFERENCEDCOLUMNS held informatoin about the columns(optional). on which the trigger is defined. Starting 10.9, in addition to the columns info on which trigger is defined, we also hold information about the columns being used inside the trigger action plan. REFERENCEDCOLUMNS is an internal structure which users should not rely but dblook uses the information to construct trigger statements. I will debug more to see why the additional information in REFERENCEDCOLUMNS causing an issue with dblook in 10.9

        Show
        Mamta A. Satoor added a comment - I have been working on this issue and problem appears to be that starting 10.9, we have extended SYSTRIGGERS.REFERENCEDCOLUMNS to hold more information that it used to in prior releases. Prior to 10.9, REFERENCEDCOLUMNS held informatoin about the columns(optional). on which the trigger is defined. Starting 10.9, in addition to the columns info on which trigger is defined, we also hold information about the columns being used inside the trigger action plan. REFERENCEDCOLUMNS is an internal structure which users should not rely but dblook uses the information to construct trigger statements. I will debug more to see why the additional information in REFERENCEDCOLUMNS causing an issue with dblook in 10.9
        Hide
        Mamta A. Satoor added a comment -

        Committed fix for this jira with following comment
        ********************************
        DERBY-5839 (dblook run on toursdb fails on triggers with java.lang.StringIndexOutOfBoundsException in dblook.log)

        We document that SYSTRIGGERS.REFERENCEDCOLUMNS is not part of the public API and hence that allows Derby to change underneath the behavior of the column. Prior to 10.9, this column only had information about columns referenced by UPDATE trigger. But, with 10.9, we use this column to also hold information about the trigger columns being used inside trigger action plan. This enables Derby to read only necessary columns from trigger table. But because of this change, it is not enough in dblook to check if SYSTRIGGERS.REFERENCEDCOLUMNS.wasNull. We need to also check if the string representation of that column is "NULL". Making this change fixes DERBY-5839
        ********************************

        Please let me know if there is any feedback.

        Show
        Mamta A. Satoor added a comment - Committed fix for this jira with following comment ******************************** DERBY-5839 (dblook run on toursdb fails on triggers with java.lang.StringIndexOutOfBoundsException in dblook.log) We document that SYSTRIGGERS.REFERENCEDCOLUMNS is not part of the public API and hence that allows Derby to change underneath the behavior of the column. Prior to 10.9, this column only had information about columns referenced by UPDATE trigger. But, with 10.9, we use this column to also hold information about the trigger columns being used inside trigger action plan. This enables Derby to read only necessary columns from trigger table. But because of this change, it is not enough in dblook to check if SYSTRIGGERS.REFERENCEDCOLUMNS.wasNull. We need to also check if the string representation of that column is "NULL". Making this change fixes DERBY-5839 ******************************** Please let me know if there is any feedback.
        Hide
        Mamta A. Satoor added a comment -

        Since this does not involve any engine changes and only test change, I have backported it to 10.9 too with revision 1370464.

        Show
        Mamta A. Satoor added a comment - Since this does not involve any engine changes and only test change, I have backported it to 10.9 too with revision 1370464.

          People

          • Assignee:
            Mamta A. Satoor
            Reporter:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development