Details

    • Type: Bug Fix Bug Fix
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.3.1
    • Fix Version/s: 2.1
    • Component/s: Data Dictionary
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-12685IT Failure IdentityArchiveService criteria is null
      KULRICE-11822IT Failure RuleManagementContextDefinitionTest.testFindContextIds criteria is null
      KULRICE-11411Null Pointer Exception when exporting lookup with no form data
      KULRICE-493Deleting attachments causes sql exception
      KULRICE-12654IT Failure ksb.messaging.DistributedQueueTest and kim.test.service.IdentityArchiveServiceRemoteTest criteria is null
      KULRICE-9055"id was null" exceptions for group and role lookups
      KULRICE-11183Server side data validation errors don't bubble up on lookup criteria fields
      KULRICE-12032KualiPercent (KualiDecimal?) can't be used as a lookup criteria
      KULRICE-3136Rule Lookup - Inquiry - null ptr exception
      KULRICE-5486Clicking out of lookup lightbox and then selecting add causes Exception
    • Rice Module:
      KNS
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required

      Description

      Attempting to use a 'null' Lookup search criteria value causes an exception (see below). The query works fine if I simply pass in a non-null value to the hidden field. I found the bug in Rice 1.0.3.1, but am guessing it is in other versions as well. I will mark it as affecting that version, but that should be corrected after testing in other versions.

      Here is an example where I tried it on a hidden lookup field, and the same exception occurs when it is visible.

      <bean parent="FieldDefinition"
      p:attributeName="kmsDocument.lastKmsDocumentRevision.editorApprovalById"
      p:noLookup="true"
      p:noInquiry="true"
      p:hidden="true"
      p:defaultValue="#

      { null }

      "/>

      The problem seems to be that LookupDaoOjb.addCriteria(...) uses criteria.addColumnIsNull(String columnName), and criteria.addColumnIsNotNull(String columnName), when it should instead use criteria.addIsNull(String property), and criteria.addIsNotNull(String property)...since it is passing a protperty name instead of a column name.

      Here is the exception that is being thrown....it looks like the special logic to handle nulls forgets (/fails) to translate the object field name (editorApprovalyById) to the column name (EDTR_APRVL_BY_ID):

      ERROR org.apache.ojb.broker.accesslayer.JdbcAccessImpl.generateException() ::

      • SQLException during execution of sql-statement:
      • sql statement was 'SELECT count FROM kms_wrk_list_itm_t A0 INNER JOIN kms_doc_t A1 ON A0.DOC_ID=A1.DOC_ID AND A0.BRANCH_ID=A1.BRANCH_ID INNER JOIN kms_doc_rev_t A2 ON A1.LAST_KMS_DOC_REV_ID=A2.KMS_DOC_REV_ID WHERE editorApprovalById IS NULL '
      • Exception message is [Unknown column 'editorApprovalById' in 'where clause']
      • Vendor error code [1054]
      • SQL state code [42S22]
      • The root stack trace is -->
      • com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'editorApprovalById' in 'where clause'
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
        at com.mysql.jdbc.Util.getInstance(Util.java:381)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
        at org.enhydra.jdbc.core.CorePreparedStatement.executeQuery(CorePreparedStatement.java:92)
        at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown Source)
        at o

        Activity

        Hide
        Jeff Ruch added a comment -

        I tested this using the sample app search for country in the identity section. Search with a field that is hidden and defaulted to null just excludes the field from the search criteria. Search with a field that is hidden and defaulted to a non null value includes the field/value in the search criteria. In short, I am unable to reproduce this behavior in 2.01.

        Show
        Jeff Ruch added a comment - I tested this using the sample app search for country in the identity section. Search with a field that is hidden and defaulted to null just excludes the field from the search criteria. Search with a field that is hidden and defaulted to a non null value includes the field/value in the search criteria. In short, I am unable to reproduce this behavior in 2.01.
        Hide
        Mike Riley (Inactive) added a comment -

        Jeff, did you test entering 'null' into the field itself? That is supposed to try to find rows for which the corresponding field is null. (likewise with 'not null'). It tries, but then calls the wrong methods(s) to add the criteria (see note above: "The problem seems to be that LookupDaoOjb.addCriteria(...) uses criteria.addColumnIsNull(String columnName), and criteria.addColumnIsNotNull(String columnName), when it should instead use criteria.addIsNull(String property), and criteria.addIsNotNull(String property)...since it is passing a protperty name instead of a column name.")

        Show
        Mike Riley (Inactive) added a comment - Jeff, did you test entering 'null' into the field itself? That is supposed to try to find rows for which the corresponding field is null. (likewise with 'not null'). It tries, but then calls the wrong methods(s) to add the criteria (see note above: "The problem seems to be that LookupDaoOjb.addCriteria(...) uses criteria.addColumnIsNull(String columnName), and criteria.addColumnIsNotNull(String columnName), when it should instead use criteria.addIsNull(String property), and criteria.addIsNotNull(String property)...since it is passing a protperty name instead of a column name.")
        Hide
        Mike Riley (Inactive) added a comment -

        Oh, please excuse (i.e. forget) my last comment. I see that the change was made, and you were reporting that it is working now.

        Show
        Mike Riley (Inactive) added a comment - Oh, please excuse (i.e. forget) my last comment. I see that the change was made, and you were reporting that it is working now.
        Hide
        Jeff Ruch added a comment -

        Testing the sample app lookup for country using 'null' in the country name raises the error.

        Show
        Jeff Ruch added a comment - Testing the sample app lookup for country using 'null' in the country name raises the error.
        Hide
        Jeff Ruch added a comment -

        So the issue isn't related to hidden or default values. Using the string 'null' in a search criteria is handled differently than a normal string and raises the error.

        Show
        Jeff Ruch added a comment - So the issue isn't related to hidden or default values. Using the string 'null' in a search criteria is handled differently than a normal string and raises the error.
        Hide
        Jeff Ruch added a comment -

        Updated criteria add functions to ones using the property, rather than columns. The code has been tested and committed.

        Show
        Jeff Ruch added a comment - Updated criteria add functions to ones using the property, rather than columns. The code has been tested and committed.

          People

          • Assignee:
            Jeff Ruch
            Reporter:
            Mike Riley (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Structure Helper Panel