realrolfje / anonimatron

Anonimatron. Providing GDPR compliance since 2010.
https://realrolfje.github.io/anonimatron/
MIT License
100 stars 47 forks source link

Do not know how to anonymize type 'UK_POST_CODE'. #168

Open szhorvath opened 2 years ago

szhorvath commented 2 years ago

Hi,

When I try to use the UK postcode anonymizer I get this error:

Exception in thread "main" java.lang.RuntimeException: java.lang.UnsupportedOperationException: Do not know how to anonymize type 'UK_POST_CODE'.

Any idea what I am doing wrong?

Many thanks

realrolfje commented 2 years ago

Hi, UK_POST_CODE seems to be the correct term to use. Can you share (part of) your configuration file so I can see what might be wrong? Thanks!

szhorvath commented 2 years ago

Hi @realrolfje,

Here is the part. Everything works fine with DUTCH_ZIP_CODE but not with the UK one.

<?xml version="1.0" encoding="UTF-8"?>
<configuration jdbcurl="jdbc:mysql://mariadb:3306/testdb" userid="root" password="secret">
    <table name="agents">
        <column name="first_name" type="ELVEN_NAME" />
        <column name="last_name" type="ELVEN_NAME" />
        <column name="mobile" type="RANDOMDIGITS" />
        <column name="company" type="ROMAN_NAME" />
        <column name="telephone" type="RANDOMDIGITS" />
        <column name="address_1" type="STRING" />
        <column name="address_2" type="STRING" />
        <column name="postcode" type="UK_POST_CODE" />
    </table>
</configuration>

Thanks

realrolfje commented 2 years ago

Hi Sandor, I just reproduced your situation and concluded that it is a bug in Anonimatron. The UK Postal Code Anonymizer is not registered in class AnonymizerService.

An easy workaround for now is to manually include it in your configuration, like so:

<?xml version="1.0" encoding="UTF-8"?>
<configuration jdbcurl="jdbc:mysql://mariadb:3306/testdb" userid="root" password="secret">

    <anonymizerclass>com.rolfje.anonimatron.anonymizer.UkPostCodeAnonymizer</anonymizerclass>

    <table name="agents">
        <column name="first_name" type="ELVEN_NAME" />
        <column name="last_name" type="ELVEN_NAME" />
        <column name="mobile" type="RANDOMDIGITS" />
        <column name="company" type="ROMAN_NAME" />
        <column name="telephone" type="RANDOMDIGITS" />
        <column name="address_1" type="STRING" />
        <column name="address_2" type="STRING" />
        <column name="postcode" type="UK_POST_CODE" />
    </table>
</configuration>

I hope this helps, cheers.