Menu

#7 Null pointer exception when try to reading no tags

open
None
5
2011-12-12
2009-10-13
No

First, sorry by my poor english is not my native language. Well, i'm doing a program with this library and when i try to read the id tags (Vorbis Comments metadata class) in a flac file that don't have any description in any fields and it launch me a java.lang.NullPointerException at org.kc7bfi.jflac.metadata.VorbisComment.getCommentByName(VorbisComment.java:80). I don't know if there is a way to validate it before execute the method. Try to reproduce it:
i) take a flac file with no tag description in any field on it.
ii) try to read some tags with the VorbisComment metadata block

when the program use the getCommentByName( String key ) method, it search for the lenght of the 'comments' field, that it is not initializaded, NULL value have in runtime. When the flac file don't have tags then arraise the exception because you can't get a 'value' from a NULL object.
There is no getter methods to know the value of comments list, to ask if there is comment (just a true, false return). Is a protected method so i can't access directly. Well i'm still wondering why i get a VorbisComment metadata if there is no real data on it. If flac format support empty metadata i think there must be a way to validate its contents.
Try to reproduce it and tell me if someone happen the same thing.

Thank you =)

Discussion


Log in to post a comment.