← Back to team overview

dhis2-devs team mailing list archive

[Bug 733843] Re: trailing-spaces-distinguish-category-options

 

Steps to reproduce.

Create a category "Health workers"
Create two category options "Doctors" and "Doctors " (with a trailing space). 
Create a category combo with the category
Create a dataelement with and assign the category option to it. 
Export data elements with DXF. 
Import the DXF file into a clean MySQL database. 

Exception similar to this will be thrown.

 ERROR 07:01:10,051 Internal process failed (AbstractStatementInternalProcess.java [Thread-25])
java.lang.RuntimeException: Failed to flush BatchHandler
        at org.amplecode.quick.batchhandler.AbstractBatchHandler.flush(AbstractBatchHandler.java:294)
        at org.hisp.dhis.importexport.dxf.converter.DXFConverter.read(DXFConverter.java:358)
        at org.hisp.dhis.importexport.DefaultImportService.importData(DefaultImportService.java:181)
        at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(ImportInternalProcess.java:89)
        at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:91)
        at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:40)
        at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:125)
        at java.lang.Thread.run(Thread.java:636)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'PCR?6wk' for key 'name'
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        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:1015)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1564)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1485)
        at org.amplecode.quick.batchhandler.AbstractBatchHandler.flush(AbstractBatchHandler.java:278)
        ... 7 more
java.lang.RuntimeException: Failed to flush BatchHandler
        at org.amplecode.quick.batchhandler.AbstractBatchHandler.flush(AbstractBatchHandler.java:294)
        at org.hisp.dhis.importexport.dxf.converter.DXFConverter.read(DXFConverter.java:358)
        at org.hisp.dhis.importexport.DefaultImportService.importData(DefaultImportService.java:181)
        at org.hisp.dhis.importexport.ImportInternalProcess.executeStatements(ImportInternalProcess.java:89)
        at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:91)
        at org.hisp.dhis.system.process.AbstractStatementInternalProcess.execute(AbstractStatementInternalProcess.java:40)
        at org.amplecode.cave.process.ProcessExecutor.run(ProcessExecutor.java:125)
        at java.lang.Thread.run(Thread.java:636)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'PCR?6wk' for key 'name'
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        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:1015)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1564)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1485)
        at org.amplecode.quick.batchhandler.AbstractBatchHandler.flush(AbstractBatchHandler.java:278)
        ... 7 more

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/733843

Title:
  trailing-spaces-distinguish-category-options

Status in DHIS 2 - District Health Information Software:
  New

Bug description:
  Two category options were created
  "Doctors"
  and 
  "Doctors ". 

  Was accepted upon insert, but fails when exported/imported with DXF.



References