fixed sonar bugs
This commit is contained in:
@ -43,7 +43,7 @@ public class CidrTool {
|
||||
}
|
||||
|
||||
|
||||
protected static final int[] CIDR2MASK = new int[]{0x00000000, 0x80000000,
|
||||
private static final int[] CIDR2MASK = new int[]{0x00000000, 0x80000000,
|
||||
0xC0000000, 0xE0000000, 0xF0000000, 0xF8000000, 0xFC000000,
|
||||
0xFE000000, 0xFF000000, 0xFF800000, 0xFFC00000, 0xFFE00000,
|
||||
0xFFF00000, 0xFFF80000, 0xFFFC0000, 0xFFFE0000, 0xFFFF0000,
|
||||
|
||||
@ -11,7 +11,7 @@ import org.apache.log4j.Logger;
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
public class PortScan {
|
||||
public final class PortScan {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger(PortScan.class);
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ public class FTPConnection {
|
||||
/** the default timeout in ms */
|
||||
public static final int DEFAULTTIMEOUT = 30000;
|
||||
/** the logger object */
|
||||
private final Logger LOGGER = Logger.getLogger(FTPConnection.class);
|
||||
private final static Logger LOGGER = Logger.getLogger(FTPConnection.class);
|
||||
/** the username to connect with */
|
||||
private String userName;
|
||||
/** the password to connect with */
|
||||
|
||||
@ -9,8 +9,8 @@ import java.util.Date;
|
||||
*/
|
||||
public class SPHelper {
|
||||
|
||||
private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
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) {
|
||||
@ -27,6 +27,7 @@ public class SPHelper {
|
||||
}
|
||||
|
||||
/* -- Format for DateTime Field -- */
|
||||
/*
|
||||
private static String toSPDateAndTime(Date d) {
|
||||
if (d == null) {
|
||||
return "";
|
||||
@ -38,5 +39,6 @@ public class SPHelper {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@ -24,16 +25,30 @@ import org.xml.sax.SAXException;
|
||||
*/
|
||||
public abstract class SPJaxbObject<T> extends AbstractSpJaxbObject {
|
||||
|
||||
private static JAXBContext jaxbContext = null;
|
||||
/** the logging object. */
|
||||
private final static Logger LOGGER = Logger.getLogger(SPJaxbObject.class);
|
||||
|
||||
/**
|
||||
* list of packages to search in
|
||||
*/
|
||||
private static final String packages = "" //
|
||||
private final static String packages = "" //
|
||||
+ "de.muehlencord.shared.sharepoint.api.batch" //
|
||||
+ ":de.muehlencord.shared.sharepoint.api.lists" //
|
||||
+ ":de.muehlencord.shared.sharepoint.api.usergroup"; //
|
||||
|
||||
/** the JAX-B context to use */
|
||||
private static JAXBContext jaxbContext = null;
|
||||
|
||||
/** the value object */
|
||||
protected T value;
|
||||
/** the class type of the object */
|
||||
protected Class<T> cl;
|
||||
|
||||
/**
|
||||
* returns the jax-b context.
|
||||
* @return the jax-b context.
|
||||
* @throws JAXBException if the context cannot be obtained.
|
||||
*/
|
||||
public static JAXBContext getJaxbContext() throws JAXBException {
|
||||
if (jaxbContext == null) {
|
||||
jaxbContext = JAXBContext.newInstance(packages);
|
||||
@ -41,8 +56,6 @@ public abstract class SPJaxbObject<T> extends AbstractSpJaxbObject {
|
||||
return jaxbContext;
|
||||
}
|
||||
|
||||
protected T value;
|
||||
protected Class<T> cl;
|
||||
|
||||
public SPJaxbObject(Class<T> cl, SPContext context) throws JAXBException {
|
||||
super(context);
|
||||
@ -116,8 +129,7 @@ public abstract class SPJaxbObject<T> extends AbstractSpJaxbObject {
|
||||
try {
|
||||
value = cl.newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
// TODO add logging, correct error handling
|
||||
LOGGER.debug (ex.toString(), ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -125,10 +137,3 @@ public abstract class SPJaxbObject<T> extends AbstractSpJaxbObject {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* History:
|
||||
*
|
||||
* $$Log$$
|
||||
*
|
||||
*/
|
||||
|
||||
@ -17,6 +17,7 @@ import org.apache.log4j.Logger;
|
||||
*/
|
||||
public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
|
||||
/** the logging object. */
|
||||
private final static Logger LOGGER = Logger.getLogger(ServiceLogHandler.class);
|
||||
|
||||
@Override
|
||||
@ -34,17 +35,19 @@ public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
@Override
|
||||
public boolean handleFault(SOAPMessageContext arg0) {
|
||||
SOAPMessage message = arg0.getMessage();
|
||||
try {
|
||||
message.writeTo(System.out);
|
||||
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
||||
message.writeTo(os);
|
||||
LOGGER.error(os.toString("UTF-8"));
|
||||
} catch (SOAPException | IOException e) {
|
||||
// TODO add error handling
|
||||
LOGGER.debug(e.toString(), e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(SOAPMessageContext arg0) {
|
||||
LOGGER.info ("Test");
|
||||
LOGGER.info("Test");
|
||||
SOAPMessage message = arg0.getMessage();
|
||||
boolean isOutboundMessage = (Boolean) arg0.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
|
||||
if (isOutboundMessage) {
|
||||
@ -52,13 +55,11 @@ public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
} else {
|
||||
LOGGER.debug("INBOUND MESSAGE");
|
||||
}
|
||||
try {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
||||
message.writeTo(os);
|
||||
LOGGER.debug (os.toString("UTF-8"));
|
||||
os.close();
|
||||
LOGGER.debug(os.toString("UTF-8"));
|
||||
} catch (SOAPException | IOException e) {
|
||||
// TODO add error handling
|
||||
LOGGER.debug(e.toString(), e);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -1,16 +1,7 @@
|
||||
package de.muehlencord.shared.sharepoint.api.authentication;
|
||||
|
||||
import com.microsoft.schemas.sharepoint.soap.authentication.Authentication;
|
||||
import com.microsoft.schemas.sharepoint.soap.authentication.AuthenticationSoap;
|
||||
import com.microsoft.schemas.sharepoint.soap.authentication.LoginResult;
|
||||
import de.muehlencord.shared.sharepoint.api.AbstractAuthenticator;
|
||||
import de.muehlencord.shared.sharepoint.api.SPContext;
|
||||
import de.muehlencord.shared.sharepoint.api.SPObject;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import javax.xml.ws.BindingProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -22,6 +13,7 @@ public class SPAuthentication extends SPObject {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/*
|
||||
private AuthenticationSoap getAuthenticationPort() throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException {
|
||||
URL wsURL = new URL(getContext().getSiteURL().toString() + "/_vti_bin/Authentication.asmx");
|
||||
URL wsdlURL = new URL(SPContext.class.getResource("/wsdl/authentication.wsdl").toExternalForm());
|
||||
@ -30,4 +22,5 @@ public class SPAuthentication extends SPObject {
|
||||
((BindingProvider) alertsPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsURL.toString());
|
||||
return alertsPort;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package de.muehlencord.shared.sharepoint.api.lists;
|
||||
|
||||
import com.microsoft.schemas.sharepoint.soap.lists.GetListCollectionResponse;
|
||||
import com.microsoft.schemas.sharepoint.soap.lists.GetListResponse.GetListResult;
|
||||
import com.microsoft.schemas.sharepoint.soap.lists.Lists;
|
||||
import com.microsoft.schemas.sharepoint.soap.lists.ListsSoap;
|
||||
import de.muehlencord.shared.sharepoint.api.SPContext;
|
||||
@ -125,6 +124,7 @@ public class SPLists extends SPJaxbObject<de.muehlencord.shared.sharepoint.api.l
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
private List getListByName(String listName) {
|
||||
for (List list : this.getValue().lists) {
|
||||
if (list.getName().equals(listName)) {
|
||||
@ -134,5 +134,6 @@ public class SPLists extends SPJaxbObject<de.muehlencord.shared.sharepoint.api.l
|
||||
// return null, if list is not found
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,7 @@
|
||||
package de.muehlencord.shared.sharepoint.api.sites;
|
||||
|
||||
import com.microsoft.schemas.sharepoint.soap.webs.GetWebResponse;
|
||||
import com.microsoft.schemas.sharepoint.soap.webs.Webs;
|
||||
import com.microsoft.schemas.sharepoint.soap.webs.WebsSoap;
|
||||
import de.muehlencord.shared.sharepoint.api.SPContext;
|
||||
import de.muehlencord.shared.sharepoint.api.SPObject;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import javax.xml.ws.BindingProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -22,6 +13,7 @@ public class SPSite extends SPObject {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/*
|
||||
public void getRootWeb() throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException {
|
||||
String rootWebUrl = StringUtils.removeEndIgnoreCase(getContext().getSiteURL().toString(), "/");
|
||||
GetWebResponse.GetWebResult result = getWebsPort(getContext().getSiteURL()).getWeb(rootWebUrl);
|
||||
@ -35,4 +27,5 @@ public class SPSite extends SPObject {
|
||||
((BindingProvider) websPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsURL.toString());
|
||||
return websPort;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ public class NtlmAuthenticatorTest extends BaseTest {
|
||||
@Ignore // Depends on available sharepoint currently
|
||||
public void testAuthentication() throws MalformedURLException, NoSuchAlgorithmException, KeyManagementException {
|
||||
SPSite instance = new SPSite(context);
|
||||
instance.getRootWeb();
|
||||
// instance.getRootWeb();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user