Derby
  1. Derby
  2. DERBY-5885

The order of argument names in messages.xml is sometimes wrong when the arguments occur in the message out of sequence.

    Details

      Description

      In most Derby messages, arguments appear in ascending order. That is,

      {0} occurs in the message first, then {1}, then {2}, and so on. Sometimes, however, arguments occur out of sequence. When this happens, the names in the <arg> sub-elements may not agree with the order that the arguments actually occur in the message. This causes MessageBuilder to garble the dita source for the Reference Guide page titled "SQL error messages and exceptions".

      For instance, here is the messages.xml element for SQLState 22014:

      <msg>
      <name>22014</name>
      <text>The start position for LOCATE is invalid; it must be a positive integer. The index to start the search from is '{2}'. The string to search for is '{0}

      '. The string to search from is '

      {1}'. </text>
      <arg>startIndex</arg>
      <arg>searchString</arg>
      <arg>fromString</arg>
      </msg>

      This gives rise to the following garbled text in the generated reference guide page:

      "The start position for LOCATE is invalid; it must be a positive integer. The index to start the search from is '<fromString>'. The string to search for is '<startIndex>'. The string to search from is '<searchString>'. "

      We should re-order the <arg> sub-elements so that the first <arg> sub-lement corresponds to {0}, the second <arg> sub-element corresponds to {1}

      , and so on.

        Issue Links

          Activity

          Hide
          Rick Hillegas added a comment -

          Resolving this issue because I have fixed all the message headers which looked wrong to me. Future fixes can probably be committed under this issue without needing to re-open it.

          Show
          Rick Hillegas added a comment - Resolving this issue because I have fixed all the message headers which looked wrong to me. Future fixes can probably be committed under this issue without needing to re-open it.
          Hide
          Rick Hillegas added a comment -

          It turns out that the messages mentioned by DERBY-2705 were corrected by the work on this issue. We just needed to check in the generated error documentation in order to see that. I have resolved DERBY-2705 as fixed.

          Show
          Rick Hillegas added a comment - It turns out that the messages mentioned by DERBY-2705 were corrected by the work on this issue. We just needed to check in the generated error documentation in order to see that. I have resolved DERBY-2705 as fixed.
          Hide
          Rick Hillegas added a comment -

          Linking to DERBY-2705. The messages mentioned by that issue also have out-of-order argument names. We can do the cleanup on this issue and then close DERBY-2705.

          Show
          Rick Hillegas added a comment - Linking to DERBY-2705 . The messages mentioned by that issue also have out-of-order argument names. We can do the cleanup on this issue and then close DERBY-2705 .
          Hide
          Rick Hillegas added a comment -

          Attaching derby-5885-01-ab-reorderMessageArgs.diff. The previous rev of the patch raised 2 errors in the regression tests because some canonized message text has changed.

          The revised patch is identical to the previous rev except for the addition of a couple more corrected canons:

          M java/testing/org/apache/derbyTesting/functionTests/master/paramij.out
          M java/testing/org/apache/derbyTesting/functionTests/master/refActions2.out

          Committed at subversion revision 1367150.

          Show
          Rick Hillegas added a comment - Attaching derby-5885-01-ab-reorderMessageArgs.diff. The previous rev of the patch raised 2 errors in the regression tests because some canonized message text has changed. The revised patch is identical to the previous rev except for the addition of a couple more corrected canons: M java/testing/org/apache/derbyTesting/functionTests/master/paramij.out M java/testing/org/apache/derbyTesting/functionTests/master/refActions2.out Committed at subversion revision 1367150.
          Hide
          Rick Hillegas added a comment -

          Attaching derby-5885-01-aa-reorderMessageArgs.diff. This re-orders some arg descriptors in messages.xml to agree with the text of the corresponding messages. I am running regression tests now.

          This patch makes two major changes:

          1) Some arg descriptors were re-ordered to agree with the message text.

          2) While I was in there I noticed that many arg descriptors were just the vacuous term "value". That term doesn't give the reader any information when browsing the Reference Guide section on error messages. That term also doesn't give translators any information now that message arguments are printed out in header comments in the generated English message properties file (see DERBY-5878).

          Along the way I corrected some other defects in the English messages:

          3) I fixed some capitalization and grammar problems.

          4) I removed some messages which are no longer referenced by the code.

          I also noticed that some message constructors in the code did not agree with the number and order of arguments in the actual message text. So...

          5) I corrected some message constructors.

          In addition, I found I needed more debug information while making these changes:

          6) I made MessageBuilder print out a more detailed error when it trips over a discrepancy between the number of args in a message and the number of corresponding arg descriptors.

          7) I made JDBC.assertRSContains() print out the missing rows when running in chatty debug mode and comparing actual and expected row sets.

          Finally...

          8) I corrected some canonized test results.

          Touches the following files:

          --------------

          M java/engine/org/apache/derby/loc/messages.xml
          M java/shared/org/apache/derby/shared/common/reference/SQLState.java

          Items (1) - (4).

          --------------

          M java/engine/org/apache/derby/impl/sql/compile/SelectNode.java
          M java/engine/org/apache/derby/impl/sql/compile/BinaryLogicalOperatorNode.java
          M java/engine/org/apache/derby/impl/sql/execute/InternalTriggerExecutionContext.java
          M java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java
          M java/engine/org/apache/derby/iapi/types/XML.java
          M java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java
          M java/client/org/apache/derby/client/am/SectionManager.java

          Item (5).

          --------------

          M java/build/org/apache/derbyBuild/MessageBuilder.java

          Item (6).

          --------------

          M java/testing/org/apache/derbyTesting/junit/JDBC.java

          Item (7).

          --------------

          M java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java

          Item (8).

          Show
          Rick Hillegas added a comment - Attaching derby-5885-01-aa-reorderMessageArgs.diff. This re-orders some arg descriptors in messages.xml to agree with the text of the corresponding messages. I am running regression tests now. This patch makes two major changes: 1) Some arg descriptors were re-ordered to agree with the message text. 2) While I was in there I noticed that many arg descriptors were just the vacuous term "value". That term doesn't give the reader any information when browsing the Reference Guide section on error messages. That term also doesn't give translators any information now that message arguments are printed out in header comments in the generated English message properties file (see DERBY-5878 ). Along the way I corrected some other defects in the English messages: 3) I fixed some capitalization and grammar problems. 4) I removed some messages which are no longer referenced by the code. I also noticed that some message constructors in the code did not agree with the number and order of arguments in the actual message text. So... 5) I corrected some message constructors. In addition, I found I needed more debug information while making these changes: 6) I made MessageBuilder print out a more detailed error when it trips over a discrepancy between the number of args in a message and the number of corresponding arg descriptors. 7) I made JDBC.assertRSContains() print out the missing rows when running in chatty debug mode and comparing actual and expected row sets. Finally... 8) I corrected some canonized test results. Touches the following files: -------------- M java/engine/org/apache/derby/loc/messages.xml M java/shared/org/apache/derby/shared/common/reference/SQLState.java Items (1) - (4). -------------- M java/engine/org/apache/derby/impl/sql/compile/SelectNode.java M java/engine/org/apache/derby/impl/sql/compile/BinaryLogicalOperatorNode.java M java/engine/org/apache/derby/impl/sql/execute/InternalTriggerExecutionContext.java M java/engine/org/apache/derby/impl/services/reflect/UpdateLoader.java M java/engine/org/apache/derby/iapi/types/XML.java M java/engine/org/apache/derby/iapi/types/SqlXmlUtil.java M java/client/org/apache/derby/client/am/SectionManager.java Item (5). -------------- M java/build/org/apache/derbyBuild/MessageBuilder.java Item (6). -------------- M java/testing/org/apache/derbyTesting/junit/JDBC.java Item (7). -------------- M java/testing/org/apache/derbyTesting/functionTests/tests/lang/ErrorCodeTest.java Item (8).
          Hide
          Rick Hillegas added a comment -

          Linking to DERBY-5879 because this issue was discovered during the localization audit.

          Show
          Rick Hillegas added a comment - Linking to DERBY-5879 because this issue was discovered during the localization audit.

            People

            • Assignee:
              Rick Hillegas
              Reporter:
              Rick Hillegas
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development