Added runtime exception to DCA

revert-70aa11f8
mharindu 9 years ago
parent 1903b375f3
commit 0c43338f5d

@ -20,7 +20,7 @@ package org.wso2.carbon.device.mgt.common;
import java.io.Serializable; import java.io.Serializable;
public class EnrolmentInfo implements Serializable{ public class EnrolmentInfo implements Serializable {
private static final long serialVersionUID = 1998101712L; private static final long serialVersionUID = 1998101712L;
@ -40,7 +40,8 @@ public class EnrolmentInfo implements Serializable{
private Status status; private Status status;
private String owner; private String owner;
public EnrolmentInfo() {} public EnrolmentInfo() {
}
public EnrolmentInfo(Device device, String owner, OwnerShip ownership, Status status) { public EnrolmentInfo(Device device, String owner, OwnerShip ownership, Status status) {
this.device = device; this.device = device;
@ -109,14 +110,12 @@ public class EnrolmentInfo implements Serializable{
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof EnrolmentInfo) { if (obj instanceof EnrolmentInfo) {
EnrolmentInfo tempInfo = (EnrolmentInfo) obj; EnrolmentInfo tempInfo = (EnrolmentInfo) obj;
if (owner != null && ownership != null) { if (this.owner != null && this.ownership != null) {
if (tempInfo.getOwner() != null && tempInfo.getOwnership() != null) { if (this.owner.equals(tempInfo.getOwner()) && this.ownership.equals(tempInfo.getOwnership())) {
if (owner.equals(tempInfo.getOwner()) && ownership.equals(tempInfo.getOwnership())) {
return true; return true;
} }
} }
} }
}
return false; return false;
} }
} }

@ -128,6 +128,10 @@ public class DynamicClientRegistrationUtil {
serviceProvider.setDescription("Service Provider for application " + applicationName); serviceProvider.setDescription("Service Provider for application " + applicationName);
ApplicationManagementService appMgtService = ApplicationManagementService.getInstance(); ApplicationManagementService appMgtService = ApplicationManagementService.getInstance();
if (appMgtService == null) {
throw new IllegalStateException("Error occurred while retrieving Application Management" +
"Service");
}
appMgtService.createApplication(serviceProvider); appMgtService.createApplication(serviceProvider);
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName); ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName);
@ -230,7 +234,7 @@ public class DynamicClientRegistrationUtil {
ApplicationManagementService appMgtService = ApplicationManagementService.getInstance(); ApplicationManagementService appMgtService = ApplicationManagementService.getInstance();
if (appMgtService == null) { if (appMgtService == null) {
throw new APIManagementException("Error occurred while retrieving Application Management" + throw new IllegalStateException("Error occurred while retrieving Application Management" +
"Service"); "Service");
} }
ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName); ServiceProvider createdServiceProvider = appMgtService.getApplication(applicationName);

Loading…
Cancel
Save