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;
public class EnrolmentInfo implements Serializable{
public class EnrolmentInfo implements Serializable {
private static final long serialVersionUID = 1998101712L;
@ -40,7 +40,8 @@ public class EnrolmentInfo implements Serializable{
private Status status;
private String owner;
public EnrolmentInfo() {}
public EnrolmentInfo() {
}
public EnrolmentInfo(Device device, String owner, OwnerShip ownership, Status status) {
this.device = device;
@ -109,11 +110,9 @@ public class EnrolmentInfo implements Serializable{
public boolean equals(Object obj) {
if (obj instanceof EnrolmentInfo) {
EnrolmentInfo tempInfo = (EnrolmentInfo) obj;
if (owner != null && ownership != null) {
if (tempInfo.getOwner() != null && tempInfo.getOwnership() != null) {
if (owner.equals(tempInfo.getOwner()) && ownership.equals(tempInfo.getOwnership())) {
return true;
}
if (this.owner != null && this.ownership != null) {
if (this.owner.equals(tempInfo.getOwner()) && this.ownership.equals(tempInfo.getOwnership())) {
return true;
}
}
}

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

Loading…
Cancel
Save