From 572e93a3574c3b8635d5e904b7cefdfbca0acadf Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Wed, 10 Feb 2021 09:24:38 +0530 Subject: [PATCH] Fix server startup issues --- .../device/type/template/DeviceTypeManager.java | 10 ++++++++-- .../meta/data/MetaRepositoryBasedLicenseManager.java | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java index cfb86df3f9..2022447e64 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java @@ -123,9 +123,15 @@ public class DeviceTypeManager implements DeviceManager { //add license to registry. this.licenseManager = new MetaRepositoryBasedLicenseManager(); try { - licenseManager.getLicense(deviceType, DeviceTypePluginConstants.LANGUAGE_CODE_ENGLISH_US); + if (deviceTypeConfiguration.getLicense() != null) { + License defaultLicense = new License(); + defaultLicense.setLanguage(deviceTypeConfiguration.getLicense().getLanguage()); + defaultLicense.setVersion(deviceTypeConfiguration.getLicense().getVersion()); + defaultLicense.setText(deviceTypeConfiguration.getLicense().getText()); + licenseManager.addLicense(deviceType, defaultLicense); + } } catch (LicenseManagementException e) { - String msg = "Error occurred while loading license of device type: " + deviceType; + String msg = "Error occurred while adding default license of device type: " + deviceType; throw new DeviceTypeDeployerPayloadException(msg, e); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java index 2b5aab2f36..391e3e1fe3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java @@ -117,6 +117,5 @@ public class MetaRepositoryBasedLicenseManager implements LicenseManager { log.error(msg, e); throw new LicenseManagementException(msg, e); } - } }