diff --git a/pom.xml b/pom.xml index 17358c04..c1bc3d2f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.mpatric mp3agic - 0.9.2-SNAPSHOT + 0.9.3 mp3agic A java library for reading mp3 files and manipulating mp3 file ID3 tags (ID3v1 and ID3v2.2 to ID3v2.4). diff --git a/src/main/java/com/mpatric/mp3agic/AbstractID3v2Tag.java b/src/main/java/com/mpatric/mp3agic/AbstractID3v2Tag.java index 7e490b30..539db3b4 100644 --- a/src/main/java/com/mpatric/mp3agic/AbstractID3v2Tag.java +++ b/src/main/java/com/mpatric/mp3agic/AbstractID3v2Tag.java @@ -154,7 +154,7 @@ private int unpackHeader(byte[] bytes) throws UnsupportedTagException, InvalidDa unpackFlags(bytes); if ((bytes[FLAGS_OFFSET] & 0x0F) != 0) throw new UnsupportedTagException("Unrecognised bits in header"); dataLength = BufferTools.unpackSynchsafeInteger(bytes[DATA_LENGTH_OFFSET], bytes[DATA_LENGTH_OFFSET + 1], bytes[DATA_LENGTH_OFFSET + 2], bytes[DATA_LENGTH_OFFSET + 3]); - if (dataLength < 1) throw new InvalidDataException("Zero size tag"); +// if (dataLength < 1) throw new InvalidDataException("Zero size tag"); return HEADER_LENGTH; } diff --git a/src/test/java/com/mpatric/mp3agic/Mp3FileTest.java b/src/test/java/com/mpatric/mp3agic/Mp3FileTest.java index f8657b8d..0a12b03f 100644 --- a/src/test/java/com/mpatric/mp3agic/Mp3FileTest.java +++ b/src/test/java/com/mpatric/mp3agic/Mp3FileTest.java @@ -15,6 +15,7 @@ public class Mp3FileTest { private static final String fs = File.separator; + private static final String MP3_NEVER_TAGGED = "src" + fs + "test" + fs + "resources" + fs + "never-tagged.mp3"; private static final String MP3_WITH_NO_TAGS = "src" + fs + "test" + fs + "resources" + fs + "notags.mp3"; private static final String MP3_WITH_ID3V1_AND_ID3V23_TAGS = "src" + fs + "test" + fs + "resources" + fs + "v1andv23tags.mp3"; private static final String MP3_WITH_DUMMY_START_AND_END_FRAMES = "src" + fs + "test" + fs + "resources" + fs + "dummyframes.mp3"; @@ -33,6 +34,8 @@ public void shouldLoadMp3WithNoTags() throws IOException, UnsupportedTagExceptio loadAndCheckTestMp3WithNoTags(new File(MP3_WITH_NO_TAGS), 256); loadAndCheckTestMp3WithNoTags(new File(MP3_WITH_NO_TAGS), 1024); loadAndCheckTestMp3WithNoTags(new File(MP3_WITH_NO_TAGS), 5000); + + loadAndCheckTestMp3NeverTagged(MP3_NEVER_TAGGED); } @Test @@ -356,6 +359,11 @@ private Mp3File copyAndCheckTestMp3WithUnicodeFields(Mp3File mp3File) throws Not } } + private Mp3File loadAndCheckTestMp3NeverTagged(String filename) throws IOException, UnsupportedTagException, InvalidDataException { + Mp3File mp3File = new Mp3File(filename); + return mp3File; + } + private Mp3File loadAndCheckTestMp3WithNoTags(String filename, int bufferLength) throws IOException, UnsupportedTagException, InvalidDataException { Mp3File mp3File = loadAndCheckTestMp3(filename, bufferLength); return loadAndCheckTestMp3WithNoTags(mp3File); diff --git a/src/test/resources/never-tagged.mp3 b/src/test/resources/never-tagged.mp3 new file mode 100644 index 00000000..f771cc9a Binary files /dev/null and b/src/test/resources/never-tagged.mp3 differ