diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceTypePublisherAdminServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceTypePublisherAdminServiceImpl.java index 6177a1e43fc..d4995c15033 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceTypePublisherAdminServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceTypePublisherAdminServiceImpl.java @@ -214,6 +214,9 @@ public class DeviceTypePublisherAdminServiceImpl implements DeviceTypePublisherA } catch (RegistryException e) { log.error("Failed to load tenant, tenantDomain: " + tenantDomain, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + } catch (ParseException e) { + log.error("Invalid stream definition for device type" + type " for tenant, tenantDomain: " + tenantDomain, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } @@ -335,7 +338,7 @@ public class DeviceTypePublisherAdminServiceImpl implements DeviceTypePublisherA } private void publishDynamicEventStream(String deviceType, String tenantDomain, List streamList) - throws IOException, UserStoreException, JWTClientException { + throws IOException, UserStoreException, JWTClientException, ParseException { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain, true); @@ -382,14 +385,9 @@ public class DeviceTypePublisherAdminServiceImpl implements DeviceTypePublisherA String version = (String) steamJson.get("version"); String streamId = name +":"+version; if (eventStreamAdminServiceStub.getStreamDefinitionDto(streamId) == null) { - log.error("its not there"); eventStreamAdminServiceStub.addEventStreamDefinitionAsString(streamContent); - } else { - log.error("its there"); } } - } catch (ParseException e) { - e.printStackTrace(); } finally { cleanup(eventStreamAdminServiceStub); PrivilegedCarbonContext.endTenantFlow();