1
0
Fork 0
mirror of https://github.com/airsonic/airsonic.git synced 2025-10-03 09:49:17 +02:00

use String.format("%tF") instead of "%tY-%tm-%td" to avoid java.util.MissingFormatArgumentException: Format specifier '%tm' errors

As to why java suddenly started complaining about java.util.MissingFormatArgumentException: Format specifier '%tm' errors I have no idea but the fact is that it did on the 1st of may 2020:

```
Failed to download Podcast from https://example.com/1.mp3
java.util.MissingFormatArgumentException: Format specifier '%tm'
```

Given that the intention of this format string is to produce an ISO date (YYYY-MM-DD) and given that String.format has a special formatter for this which does _not_ produce this error it seems logical to use it.
This commit is contained in:
Yetangitu 2020-05-03 00:12:06 +00:00 committed by François-Xavier Thomas
parent 9293a2681a
commit 069af69281

View file

@ -657,7 +657,7 @@ public class PodcastService {
File channelDir = getChannelDirectory(channel); File channelDir = getChannelDirectory(channel);
String episodeDate = String.format("%tY-%tm-%td", episode.getPublishDate()); String episodeDate = String.format("%tF", episode.getPublishDate());
String filename = channel.getTitle() + " - " + episodeDate + " - " + episode.getId() + " - " + episode.getTitle(); String filename = channel.getTitle() + " - " + episodeDate + " - " + episode.getId() + " - " + episode.getTitle();
filename = filename.substring(0, Math.min(filename.length(), 146)); filename = filename.substring(0, Math.min(filename.length(), 146));