fixed sonar bugs
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package de.muehlencord.shared.sharepoint.api;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -18,7 +17,13 @@ public class SPHelper {
|
||||
if (d == null) {
|
||||
return "";
|
||||
}
|
||||
return dateOnlyFormat.format(d);
|
||||
|
||||
String result;
|
||||
synchronized (dateOnlyFormat) {
|
||||
result = dateOnlyFormat.format(d);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/* -- Format for DateTime Field -- */
|
||||
@ -26,8 +31,12 @@ public class SPHelper {
|
||||
if (d == null) {
|
||||
return "";
|
||||
}
|
||||
String result;
|
||||
|
||||
return dateTimeFormat.format(d);
|
||||
synchronized (dateTimeFormat) {
|
||||
result = dateTimeFormat.format(d);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.util.file;
|
||||
|
||||
import static de.muehlencord.shared.util.StringUtil.getStackTraceString;
|
||||
@ -20,7 +16,6 @@ import java.text.Format;
|
||||
import static java.util.Arrays.asList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
|
||||
@ -170,11 +165,11 @@ public abstract class FileUtil {
|
||||
throw new IOException("Cannot get MD5 MessageDigest instance");
|
||||
}
|
||||
|
||||
try (InputStream is = Files.newInputStream(Paths.get(fileName))) {
|
||||
DigestInputStream dis = new DigestInputStream(is, md);
|
||||
int nread;
|
||||
try (InputStream is = Files.newInputStream(Paths.get(fileName));
|
||||
DigestInputStream dis = new DigestInputStream(is, md)) {
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
while ((nread = dis.read(buffer)) != -1) {
|
||||
while ((dis.read(buffer)) != -1) {
|
||||
md.update(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user