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