Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MP3File Constructor Issue #5

Open
Librichard opened this issue May 7, 2019 · 0 comments
Open

MP3File Constructor Issue #5

Librichard opened this issue May 7, 2019 · 0 comments

Comments

@Librichard
Copy link

The following code block breaks:

try
{
	String[] song_SingerAlbum = path.getFileName().toString().split(fileExtention)[0].split(" by ");
	String[] singer_album     = song_SingerAlbum[1].split(" on ");
	MP3File  mp3File          = new MP3File(path.toFile());
	ID3v1    id3Tag           = mp3File.getID3v1Tag();

	if (id3Tag == null)
	{
		id3Tag = new ID3v1();
		mp3File.setID3v1Tag(id3Tag);
	}
	id3Tag.setSongTitle(song_SingerAlbum[0]);
	id3Tag.setLeadArtist(singer_album[0]);
	id3Tag.setAlbumTitle(singer_album[1]);
	mp3File.save();
}
catch (IOException | TagException e)
{
	e.printStackTrace();
}

This is the error:

java.io.EOFException
at java.base/java.io.RandomAccessFile.readByte(RandomAccessFile.java:703)
at org.farng.mp3.id3.ID3v2_4Frame.read(ID3v2_4Frame.java:368)
at org.farng.mp3.id3.ID3v2_4Frame.(ID3v2_4Frame.java:353)
at org.farng.mp3.id3.ID3v2_4.read(ID3v2_4.java:522)
at org.farng.mp3.id3.ID3v2_4.(ID3v2_4.java:384)
at org.farng.mp3.MP3File.(MP3File.java:263)
at org.farng.mp3.MP3File.(MP3File.java:234)
at FileManipulation.lambda$1(FileManipulation.java:83)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at FileManipulation.doAddMP3Tags(FileManipulation.java:76)
at FileManipulation.doAskWhatToDo(FileManipulation.java:61)
at FileManipulation.main(FileManipulation.java:30)

NOTE: The very first time, I got error on set tag attributes, because I didn't check if it exists, but after I made it null safe, I always get error on the line that creates the mp3 file. It seems the file handling in the mp3 constructor is not good enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant