Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>com.mpatric</groupId>
<artifactId>mp3agic</artifactId>
<version>0.9.2-SNAPSHOT</version>
<version>0.9.3</version>
<name>mp3agic</name>
<description>A java library for reading mp3 files and manipulating mp3 file ID3 tags (ID3v1 and ID3v2.2 to
ID3v2.4).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mpatric/mp3agic/AbstractID3v2Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 8 additions & 0 deletions src/test/java/com/mpatric/mp3agic/Mp3FileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Binary file added src/test/resources/never-tagged.mp3
Binary file not shown.