anonimatron
anonimatron copied to clipboard
Getting error: "Do not know how to anonymize type 'DATE'"
Hi there
I have a MySQL table that has a field of type 'DATETIME'. When I try to anonymize this table I get an UnsupportedOperationException saying "Do not know how to anonymize type 'DATE' " Following is an excerpt from my config file:
<table name="contact_">
<column name="birthday" type="DATE" />
</table>
Can you kindly let me know what is going wrong here? Same exception is thrown if the field is of type 'DATE'.
Best Shubhankit
I've reproduced this:
anonimatron_1 | Anonymizing table 'domain_operations', total progress [0%, ETA 7:34:32 PM]Exception in thread "main" java.lang.RuntimeException: java.lang.UnsupportedOperationException: Can not anonymize objects of type class java.sql.Timestamp
anonimatron_1 | at com.rolfje.anonimatron.jdbc.JdbcAnonymizerService.processTableColumns(JdbcAnonymizerService.java:241)
anonimatron_1 | at com.rolfje.anonimatron.jdbc.JdbcAnonymizerService.anonymizeTableInPlace(JdbcAnonymizerService.java:154)
anonimatron_1 | at com.rolfje.anonimatron.jdbc.JdbcAnonymizerService.anonymize(JdbcAnonymizerService.java:94)
anonimatron_1 | at com.rolfje.anonimatron.Anonimatron.anonymize(Anonimatron.java:99)
anonimatron_1 | at com.rolfje.anonimatron.Anonimatron.main(Anonimatron.java:67)
anonimatron_1 | Caused by: java.lang.UnsupportedOperationException: Can not anonymize objects of type class java.sql.Timestamp
anonimatron_1 | at com.rolfje.anonimatron.anonymizer.DateAnonymizer.anonymize(DateAnonymizer.java:42)
anonimatron_1 | at com.rolfje.anonimatron.anonymizer.AnonymizerService.anonymize(AnonymizerService.java:92)
anonimatron_1 | at com.rolfje.anonimatron.jdbc.JdbcAnonymizerService$2.processColumn(JdbcAnonymizerService.java:140)
anonimatron_1 | at com.rolfje.anonimatron.jdbc.JdbcAnonymizerService.processTableColumns(JdbcAnonymizerService.java:212)
anonimatron_1 | ... 4 more
anonimatron_1 | /usr/src/app
column is mysql type timestamp.
Currently the DateAnonymizer only handles java.sql.Date objects. Apparently the resultset returns DateTime objects because the database contains the timestamp datatype. I need to add a testcase for this situation and either fix the date anonymizer or create a datetime anonymizer
Related to #2