Ref: do not re-invent the wheel, use existing lib
This commit is contained in:
@@ -150,9 +150,9 @@ public class DirectoryManager {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
String extension = file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase();
|
||||
String name = file.getName().substring(0, file.getName().length() - 1 * extension.length());
|
||||
if (".wool".equals(extension)) {
|
||||
String extension = FilenameUtils.getExtension(file.getName()).toLowerCase();
|
||||
String name = FilenameUtils.removeExtension(file.getName());
|
||||
if ("wool".equals(extension)) {
|
||||
// check if the md5 of the file is ok
|
||||
String md5_local = Utils.md5(file.getAbsolutePath());
|
||||
|
||||
@@ -166,7 +166,7 @@ public class DirectoryManager {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
catch (StringIndexOutOfBoundsException e) { // because the file does not have an . in his path
|
||||
catch (IllegalArgumentException e) { // because the file does not have an . in his path
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user