fixed sonar findings

This commit is contained in:
jomu
2015-11-01 18:30:42 +00:00
parent 268ca04a69
commit 8fa14d6309
32 changed files with 174 additions and 298 deletions

View File

@ -4,6 +4,7 @@ import java.net.Authenticator;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
@ -50,13 +51,13 @@ public class SPContext {
}
@Override
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
public void checkClientTrusted(X509Certificate[] certs, String authType) {
// trust all SSLs, do not check
}
@Override
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs, String authType) {
public void checkServerTrusted(X509Certificate[] certs, String authType) {
// trust all SSLs, do not check
}
}};
// Install the all-trusting trust manager

View File

@ -9,36 +9,14 @@ import java.util.Date;
*/
public class SPHelper {
private static final SimpleDateFormat dateOnlyFormat = new SimpleDateFormat("yyyy-MM-dd");
// private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
/* -- Format for Date Only Field -- */
public static String toSPDate(Date d) {
public static synchronized String toSPDate(Date d) {
SimpleDateFormat dateOnlyFormat = new SimpleDateFormat("yyyy-MM-dd");
if (d == null) {
return "";
}
String result;
synchronized (dateOnlyFormat) {
result = dateOnlyFormat.format(d);
}
return result;
}
/* -- Format for DateTime Field -- */
/*
private static String toSPDateAndTime(Date d) {
if (d == null) {
return "";
}
String result;
synchronized (dateTimeFormat) {
result = dateTimeFormat.format(d);
}
return result;
return dateOnlyFormat.format(d);
}
*/
}

View File

@ -38,7 +38,7 @@ public abstract class SPJaxbObject<T> extends AbstractSpJaxbObject {
+ ":de.muehlencord.shared.sharepoint.api.usergroup"; //
/** the JAX-B context to use */
private static JAXBContext jaxbContext = null;
private static volatile JAXBContext jaxbContext = null;
/** the value object */
protected T value;

View File

@ -35,10 +35,8 @@ public class SPValidationEventHandler implements ValidationEventHandler {
switch (event.getSeverity()) {
case ValidationEvent.WARNING:
return true; // continue after warinings
case ValidationEvent.ERROR:
return false; // terminate after errors
case ValidationEvent.FATAL_ERROR:
return false; // terminate after fatal errors
case ValidationEvent.ERROR: // terminate after errors
case ValidationEvent.FATAL_ERROR: // terminate after fatal errors
default:
return false;
}

View File

@ -38,10 +38,8 @@ public class SPUser extends SPJaxbObject<User> {
returnValue = getValue().login;
}
if (returnValue == null) {
return null;
} else if (returnValue.equals("")) {
return null;
if ((returnValue == null) || (returnValue.equals (""))) {
return null;
} else {
return returnValue.substring(7); // drop [i:0#.w|
}