From 0be4bef30ecb59d3283d2f95b02e1d5f5f2fc5c0 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Thu, 8 Dec 2022 16:20:34 +0800 Subject: [PATCH] fix md5 is null bug --- .../yutou/nas/Services/impl/MusicToolsServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java b/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java index 326c6bf..53fbe89 100644 --- a/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java +++ b/src/main/java/com/yutou/nas/Services/impl/MusicToolsServiceImpl.java @@ -251,6 +251,8 @@ public class MusicToolsServiceImpl implements IMusicToolsService { || file.getName().endsWith(".dff") || file.getName().endsWith(".cue") || file.getName().endsWith(".m3u") + || file.getName().endsWith(".txt") + || file.getName().endsWith(".db") ) { return null; } @@ -314,6 +316,9 @@ public class MusicToolsServiceImpl implements IMusicToolsService { data.setVariablebitrate(header.isVariableBitRate() ? 1 : 0); try { data.setMd5(header.getClass().getMethod("getMd5").invoke(header).toString()); + if(data.getMd5().startsWith("00000")&&data.getMd5().endsWith("00000")){ + throw new NullPointerException("md5 is null"); + } } catch (Exception ignored) { data.setMd5(Tools.getFileMD5(file)); } @@ -387,6 +392,9 @@ public class MusicToolsServiceImpl implements IMusicToolsService { data.setVariablebitrate(header.isVariableBitRate() ? 1 : 0); try { data.setMd5(header.getClass().getMethod("getMd5").invoke(header).toString()); + if(data.getMd5().startsWith("00000")&&data.getMd5().endsWith("00000")){ + throw new NullPointerException("md5 is null"); + } } catch (Exception ignored) { data.setMd5(Tools.getFileMD5(file)); }