Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-1695

Crowd 2.0.X creates NULL attribute value for any blank text box in a Directory definition with Oracle DBs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 2.0.3
    • 2.0, 2.0.1, 2.0.2
    • None
    • None
    • Oracle 10g
      Driver ojdbc14.jar

    Description

      <Issue Title and Description updated>

      In a Crowd Directory definition, if any filed is left blank and then the Directory is saved, Oracle will not store the empty values as an empty attribute. It will create attributes with NULL values in table CWD_DIRECTORY_ATTRIBUTE.

      This fact will cause any update to these attributes to fail.

      The problem happens with any directory type and to any field tha can be kept blank (ie. User DN (Connector tab), User DN (Configuration tab), Group DN)

      Workaround
      Since Oracle will not replaces the "null" values by spaces (SQL didn't work), the null values must be replaced by any string (ie. abc) so that the admin can edit them from the UI again.

      Example:
      1-) Go to Directories -> Create a Connector.
      2-) Fill in all the fields, but keep the User DN blank
      3-) Save the Connector
      4-) Try to add an value to the User DN field
      5-) The following error is displayed:

      org.springframework.transaction.IllegalTransactionStateException: Transaction is already completed - do not call commit or rollback more than once per transaction
      	at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:772)
      	at com.atlassian.xwork.interceptors.TransactionalInvocation.commitOrRollbackTransaction(TransactionalInvocation.java:93)
      	at com.atlassian.xwork.interceptors.TransactionalInvocation.invokeInTransaction(TransactionalInvocation.java:63)
      	at com.atlassian.xwork.interceptors.XWorkTransactionInterceptor.intercept(XWorkTransactionInterceptor.java:56)
      	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
      	at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
      	at com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:273)
      	at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:202)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      	at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
      	at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      	at com.atlassian.plugin.servlet.filter.IteratingFilterChain.doFilter(IteratingFilterChain.java:46)
      	at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:55)
      	at com.atlassian.plugin.servlet.filter.ServletFilterModuleContainerFilter.doFilter(ServletFilterModuleContainerFilter.java:41)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      	at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:88)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
      	at com.atlassian.crowd.console.filter.ChangePasswordFilter.doFilterInternal(ChangePasswordFilter.java:91)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
      
      

      Logs:

      2009-10-16 16:21:54,591 http-8095-Processor23 DEBUG [hibernate.event.def.AbstractFlushingEventListener] executing flush
      2009-10-16 16:21:54,591 http-8095-Processor23 DEBUG [org.hibernate.jdbc.ConnectionManager] registering flush begin
      2009-10-16 16:21:54,591 http-8095-Processor23 DEBUG [hibernate.persister.entity.AbstractEntityPersister] Updating entity: [com.atlassian.crowd.model.directory.Directory#32770]
      2009-10-16 16:21:54,591 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.SQL] update cwd_directory set directory_name=?, lower_directory_name=?, created_date=?, updated_date=?, active=?, description=?, impl_class=?, lower_impl_class=?, directory_type=? where id=?
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [hibernate.persister.entity.AbstractEntityPersister] Dehydrating entity: [com.atlassian.crowd.model.directory.Directory#32770]
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'AD1' to parameter: 1
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'ad1' to parameter: 2
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.TimestampType] binding '2009-10-16 16:13:38' to parameter: 3
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.TimestampType] binding '2009-10-16 16:21:54' to parameter: 4
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.TrueFalseType] binding 'true' to parameter: 5
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding null to parameter: 6
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'com.atlassian.crowd.integration.directory.connector.MicrosoftActiveDirectory' to parameter: 7
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'com.atlassian.crowd.integration.directory.connector.microsoftactivedirectory' to parameter: 8
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.type.LongType] binding '32770' to parameter: 10
      2009-10-16 16:21:54,592 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] Executing batch size: 1
      2009-10-16 16:21:54,594 http-8095-Processor23 DEBUG [org.hibernate.jdbc.Expectations] success of batch update unknown: 0
      2009-10-16 16:21:54,594 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2009-10-16 16:21:54,594 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] closing statement
      2009-10-16 16:21:54,594 http-8095-Processor23 DEBUG [hibernate.persister.collection.AbstractCollectionPersister] Deleting rows of collection: [com.atlassian.crowd.model.directory.Directory.attributes#32770]
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [hibernate.persister.collection.AbstractCollectionPersister] no rows to delete
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [hibernate.persister.collection.AbstractCollectionPersister] Updating rows of collection: com.atlassian.crowd.model.directory.Directory.attributes#32770
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [hibernate.persister.collection.AbstractCollectionPersister] done updating rows: 0 updated
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [hibernate.persister.collection.AbstractCollectionPersister] Inserting rows of collection: [com.atlassian.crowd.model.directory.Directory.attributes#32770]
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.SQL] insert into cwd_directory_attribute (directory_id, attribute_name, attribute_value) values (?, ?, ?)
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.LongType] binding '32770' to parameter: 1
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'ldap.group.dn' to parameter: 2
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding '' to parameter: 3
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.SQL] insert into cwd_directory_attribute (directory_id, attribute_name, attribute_value) values (?, ?, ?)
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.LongType] binding '32770' to parameter: 1
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'ldap.role.dn' to parameter: 2
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding '' to parameter: 3
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] reusing prepared statement
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.SQL] insert into cwd_directory_attribute (directory_id, attribute_name, attribute_value) values (?, ?, ?)
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.LongType] binding '32770' to parameter: 1
      2009-10-16 16:21:54,595 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding 'ldap.user.dn' to parameter: 2
      2009-10-16 16:21:54,596 http-8095-Processor23 DEBUG [org.hibernate.type.StringType] binding '' to parameter: 3
      2009-10-16 16:21:54,596 http-8095-Processor23 DEBUG [hibernate.persister.collection.AbstractCollectionPersister] done inserting rows: 3 inserted
      2009-10-16 16:21:54,596 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] Executing batch size: 3
      2009-10-16 16:21:54,634 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2009-10-16 16:21:54,634 http-8095-Processor23 DEBUG [org.hibernate.jdbc.AbstractBatcher] closing statement
      2009-10-16 16:21:54,636 http-8095-Processor23 DEBUG [org.hibernate.util.JDBCExceptionReporter] Could not execute JDBC batch update [insert into cwd_directory_attribute (directory_id, attribute_name, attribute_value) values (?, ?, ?)]
      java.sql.BatchUpdateException: ORA-00001: unique constraint (SYSTEM.SYS_C005829) violated
      
      	at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
      	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10656)
      	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
      	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
      	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
      	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
      

      Attachments

        1. Logs.txt
          54 kB
        2. StackTrace.txt
          14 kB

        Issue Links

          Activity

            People

              pkuo Peggy
              rbattaglin Renan Battaglin
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: