realrolfje/anonimatron

Can not write synonyms of data type date

Closed this issue · 1 comments

Describe the bug
The table contains a column of type Date (informix database).
Anonymization works well, but writing the synonym file an exception rises, see below.

To Reproduce
Steps to reproduce the behavior:

  1. Create a database with a table containing a Date field with valid data.
  2. Configure Anonimatron as follows using a config file config.myTableName.xml:
  1. Start with the following command:
    ./anonimatron.sh -config ./config.myTableName.xml -synonyms syn.myTableName.txt -jdbcurl "jdbc:informix-sqli://myServer:1535/myDatabase:INFORMIXSERVER=myServerName" -userid anUserId -password aSecretPassword

  2. No error in log file, but printed on terminal:

Expected behavior
Synonyms are written to syn.myTableName.txt

Logs, screenshots
Following is printed to the terminal:
Writing Synonyms to /.../anonymization/syn.myTableName.txt ...Exception in thread "main" java.lang.ClassCastException: java.sql.Date cannot be cast to java.lang.String
at com.rolfje.anonimatron.synonyms.Base64StringFieldHandler.convertUponGet(Base64StringFieldHandler.java:25)
at org.exolab.castor.mapping.GeneralizedFieldHandler.getValue(GeneralizedFieldHandler.java:171)
at org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:355)
at org.exolab.castor.xml.Marshaller.processAttribute(Marshaller.java:2556)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1469)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:2010)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:945)
at com.rolfje.anonimatron.synonyms.SynonymMapper.writeToFile(SynonymMapper.java:53)
at com.rolfje.anonimatron.anonymizer.SynonymCache.toFile(SynonymCache.java:70)
at com.rolfje.anonimatron.Anonimatron.anonymize(Anonimatron.java:107)
at com.rolfje.anonimatron.Anonimatron.main(Anonimatron.java:48)

Desktop (please complete the following information):

  • OS: SUSE Linux Enterprise Server 12 SP4
  • Java version: openjdk version "1.8.0_242"

Additional context

Sorry my fault. Is working now.