diff options
Diffstat (limited to 'base')
5 files changed, 50 insertions, 1 deletions
diff --git a/base/server/cms/src/com/netscape/cms/servlet/admin/GroupService.java b/base/server/cms/src/com/netscape/cms/servlet/admin/GroupService.java index 065f93c8f..5f9a3b947 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/admin/GroupService.java +++ b/base/server/cms/src/com/netscape/cms/servlet/admin/GroupService.java @@ -334,6 +334,9 @@ public class GroupService extends PKIService implements GroupResource { @Override public GroupMemberCollection findGroupMembers(String groupID, Integer start, Integer size) { + + if (groupID == null) throw new BadRequestException("Group ID is null."); + try { GroupMemberProcessor processor = new GroupMemberProcessor(getLocale(headers)); processor.setUriInfo(uriInfo); diff --git a/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorService.java b/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorService.java index 53ff8e9a2..310e08206 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorService.java +++ b/base/server/cms/src/com/netscape/cms/servlet/admin/KRAConnectorService.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Request; import javax.ws.rs.core.UriInfo; +import com.netscape.certsrv.base.BadRequestException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.PKIException; import com.netscape.certsrv.system.KRAConnectorInfo; @@ -49,6 +50,9 @@ public class KRAConnectorService extends PKIService implements KRAConnectorResou @Override public void addConnector(KRAConnectorInfo info) { + + if (info == null) throw new BadRequestException("KRA connector info is null."); + try { KRAConnectorProcessor processor = new KRAConnectorProcessor(getLocale(headers)); processor.addConnector(info); @@ -60,6 +64,10 @@ public class KRAConnectorService extends PKIService implements KRAConnectorResou @Override public void removeConnector(String host, String port) { + + if (host == null) throw new BadRequestException("KRA connector host is null."); + if (port == null) throw new BadRequestException("KRA connector port is null."); + try { KRAConnectorProcessor processor = new KRAConnectorProcessor(getLocale(headers)); processor.removeConnector(host, port); diff --git a/base/server/cms/src/com/netscape/cms/servlet/tks/TPSConnectorService.java b/base/server/cms/src/com/netscape/cms/servlet/tks/TPSConnectorService.java index 9351ffe60..28e3dbb7d 100644 --- a/base/server/cms/src/com/netscape/cms/servlet/tks/TPSConnectorService.java +++ b/base/server/cms/src/com/netscape/cms/servlet/tks/TPSConnectorService.java @@ -111,6 +111,9 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public TPSConnectorData getConnector(String id) { + + if (id == null) throw new BadRequestException("TPS connector ID is null."); + try { if (connectorExists(id)) return createTPSConnectorData(id); throw new ResourceNotFoundException("Connector " + id + " not found."); @@ -122,6 +125,10 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public TPSConnectorData getConnector(String host, String port) { + + if (host == null) throw new BadRequestException("TPS connector host is null."); + if (port == null) throw new BadRequestException("TPS connector port is null."); + try { String id = getConnectorID(host, port); if (id != null) return createTPSConnectorData(id); @@ -135,6 +142,10 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public Response createConnector(String tpsHost, String tpsPort) { + + if (tpsHost == null) throw new BadRequestException("TPS connector host is null."); + if (tpsPort == null) throw new BadRequestException("TPS connector port is null."); + try { String id = getConnectorID(tpsHost, tpsPort); if (id != null) { @@ -176,6 +187,10 @@ public class TPSConnectorService implements TPSConnectorResource { throw new BadRequestException("Invalid connector ID"); } + if (data == null) { + throw new BadRequestException("Invalid connector data"); + } + if (!connectorExists(id)) { throw new ResourceNotFoundException("TPS connection does not exist"); } @@ -243,6 +258,10 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public void deleteConnector(String host, String port) { + + if (host == null) throw new BadRequestException("TPS connector host is null."); + if (port == null) throw new BadRequestException("TPS connector port is null."); + String id; try { id = getConnectorID(host, port); @@ -255,6 +274,9 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public KeyData createSharedSecret(String id) { + + if (id == null) throw new BadRequestException("TPS connector ID is null."); + try { if (!connectorExists(id)) { throw new ResourceNotFoundException("TPS connection does not exist"); @@ -311,6 +333,9 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public KeyData replaceSharedSecret(String id) { + + if (id == null) throw new BadRequestException("TPS connector ID is null."); + try { if (!connectorExists(id)) { throw new ResourceNotFoundException("TPS connection does not exist"); @@ -345,9 +370,12 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public void deleteSharedSecret(String id) { + + if (id == null) throw new BadRequestException("TPS connector ID is null."); + try { if (!connectorExists(id)) { - return; + throw new ResourceNotFoundException("TPS connection does not exist"); } // get user @@ -374,6 +402,9 @@ public class TPSConnectorService implements TPSConnectorResource { @Override public KeyData getSharedSecret(String id) { + + if (id == null) throw new BadRequestException("TPS connector ID is null."); + try { if (!connectorExists(id)) { throw new ResourceNotFoundException("TPS connection does not exist"); diff --git a/base/server/cmscore/src/com/netscape/cmscore/logging/AuditService.java b/base/server/cmscore/src/com/netscape/cmscore/logging/AuditService.java index 89ac6263e..1d07114b1 100644 --- a/base/server/cmscore/src/com/netscape/cmscore/logging/AuditService.java +++ b/base/server/cmscore/src/com/netscape/cmscore/logging/AuditService.java @@ -35,6 +35,7 @@ import org.apache.commons.lang.StringUtils; import org.jboss.resteasy.plugins.providers.atom.Link; import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.base.BadRequestException; import com.netscape.certsrv.base.EBaseException; import com.netscape.certsrv.base.IConfigStore; import com.netscape.certsrv.base.PKIException; @@ -116,6 +117,8 @@ public class AuditService extends PKIService implements AuditResource { @Override public Response updateAuditConfig(AuditConfig auditConfig) { + if (auditConfig == null) throw new BadRequestException("Audit config is null."); + CMS.debug("AuditService.updateAuditConfig()"); try { diff --git a/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestService.java b/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestService.java index 4fcddb7e4..bd02b6752 100644 --- a/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestService.java +++ b/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestService.java @@ -141,6 +141,8 @@ public class SelfTestService extends PKIService implements SelfTestResource { @Override public SelfTestData getSelfTest(String selfTestID) { + if (selfTestID == null) throw new BadRequestException("Self test ID is null."); + CMS.debug("SelfTestService.getSelfTest(\"" + selfTestID + "\")"); try { @@ -156,6 +158,8 @@ public class SelfTestService extends PKIService implements SelfTestResource { @Override public void executeSelfTests(String action) { + if (action == null) throw new BadRequestException("Action is null."); + CMS.debug("SelfTestService.executeSelfTests(\"" + action + "\")"); if (!"run".equals(action)) { |