ID3v1Tag fails silently to set a genre field to a non-standard ID3v1 genre

Issue #339 wontfix
Dan Gravell created an issue

If we try to set an ID3v1 tag to something not within the prescribed ID3v1 genre list, JaudioTagger fails silently.

id3v1Tag.setField(FieldKey.GENRE, “my custom genre”);

After this call, the genre field is untouched but the method call completes satisfactorily. I don’t think this is a good idea, because it’s unclear as to what the result of the call was.

setField does already declare FieldDataInvalidException - I think ideally FieldDataInvalidException should be thrown for invalid genres.

setGenre, however, doesn’t. So if we were to add that to the throws clause we will break backwards compatibility.

The workaround for clients is to pre-sanitise the call to JaudioTagger.

Comments (3)

  1. IJabz repo owner

    Didn’t you request the opposite of this a few years back ?

    If we throw an exception then clients would definently have to pre-sanitise calls, whereas at least this way ignorance is bliss and they dont hit issues.

  2. Dan Gravell reporter

    Hah! I don’t remember requesting the opposite, no. This is documented in the Javadoc (although a little confusingly) under `setGenre` so if you want to keep this behaviour, that’s fine, just close this off.

  3. Log in to comment