Automatic cleanup

This commit is contained in:
Andrew Rabert 2019-01-22 00:08:49 -05:00
parent b86cc33bbf
commit ae55b32ac5
5 changed files with 11 additions and 8 deletions

View File

@ -635,7 +635,7 @@ public class CachedMusicService implements MusicService {
} }
@Override @Override
public void setInstance(Integer instance) throws Exception { public void setInstance(Integer instance) {
musicService.setInstance(instance); musicService.setInstance(instance);
} }

View File

@ -87,7 +87,7 @@ public class OfflineMusicService implements MusicService {
} }
@Override @Override
public MusicDirectory getMusicDirectory(String id, String artistName, boolean refresh, Context context, ProgressListener progressListener) throws Exception { public MusicDirectory getMusicDirectory(String id, String artistName, boolean refresh, Context context, ProgressListener progressListener) {
return getMusicDirectory(id, context); return getMusicDirectory(id, context);
} }

View File

@ -63,6 +63,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@ -714,7 +715,7 @@ public final class Util {
try { try {
MessageDigest md5 = MessageDigest.getInstance("MD5"); MessageDigest md5 = MessageDigest.getInstance("MD5");
return hexEncode(md5.digest(s.getBytes(Constants.UTF_8))); return hexEncode(md5.digest(s.getBytes(StandardCharsets.UTF_8)));
} catch (Exception x) { } catch (Exception x) {
throw new RuntimeException(x.getMessage(), x); throw new RuntimeException(x.getMessage(), x);
} }

View File

@ -19,6 +19,7 @@ package net.nullsum.audinaut.util.tags;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
@ -156,13 +157,13 @@ class ID3v2File extends Common {
int ID3_ENC_UTF16BE = 0x02; int ID3_ENC_UTF16BE = 0x02;
int ID3_ENC_UTF16LE = 0x01; int ID3_ENC_UTF16LE = 0x01;
if (encid == ID3_ENC_LATIN) { if (encid == ID3_ENC_LATIN) {
v = new String(raw, 1, len - 1, "ISO-8859-1"); v = new String(raw, 1, len - 1, StandardCharsets.ISO_8859_1);
} else if (encid == ID3_ENC_UTF8) { } else if (encid == ID3_ENC_UTF8) {
v = new String(raw, 1, len - 1, "UTF-8"); v = new String(raw, 1, len - 1, StandardCharsets.UTF_8);
} else if (encid == ID3_ENC_UTF16LE) { } else if (encid == ID3_ENC_UTF16LE) {
v = new String(raw, 3, len - 3, "UTF-16LE"); v = new String(raw, 3, len - 3, StandardCharsets.UTF_16LE);
} else if (encid == ID3_ENC_UTF16BE) { } else if (encid == ID3_ENC_UTF16BE) {
v = new String(raw, 3, len - 3, "UTF-16BE"); v = new String(raw, 3, len - 3, StandardCharsets.UTF_16BE);
} }
} catch (Exception ignored) { } catch (Exception ignored) {
} }

View File

@ -19,6 +19,7 @@ package net.nullsum.audinaut.util.tags;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
@ -38,7 +39,7 @@ class LameHeader extends Common {
s.seek(offset + 0x24); s.seek(offset + 0x24);
s.read(chunk); s.read(chunk);
String lameMark = new String(chunk, 0, chunk.length, "ISO-8859-1"); String lameMark = new String(chunk, 0, chunk.length, StandardCharsets.ISO_8859_1);
if (lameMark.equals("Info") || lameMark.equals("Xing")) { if (lameMark.equals("Info") || lameMark.equals("Xing")) {
s.seek(offset + 0xAB); s.seek(offset + 0xAB);