Donate Share

Java mp3info

Tracker: Patches

5 Fix for ArrayIndexOutOfBoundsException on genre -1 - ID: 1216776
Last Update: Attachment added ( kyank )

A number of MP3 files in my library contain ID3 tags
with a genre value of -1. The getGenreS method in
ID3Tag currently does not handle this gracefully,
producing an ArrayIndexOutOfBoundsException when it
attempts to retrieve the corresponding genre name from
the genres array.

The fix is to return UNKNOWN_GENRE if the genre value
is less than zero:

/** @return String representation of the genre */
public String getGenreS () {
if (genre >= genres.length || genre < 0)
return UNKNOWN_GENRE;
return genres[genre];
}

Patched copy of the latest CVS version of ID3Tag.java
attached.


Kevin Yank ( kyank ) - 2005-06-07 23:59

5

Open

None

Nobody/Anonymous

None

None

Public


Comments

No follow-up comments have been posted.

Attached File ( 1 )

Filename Description Download
ID3Tag.java Patched ID3Tag class Download

Change ( 1 )

Field Old Value Date By
File Added 137619: ID3Tag.java 2005-06-08 00:00 kyank