From 20f8708edb2bef76fadcd97cb3c785e28a309212 Mon Sep 17 00:00:00 2001 From: megala21 Date: Wed, 17 May 2017 15:50:57 +0530 Subject: [PATCH] Fixing issues in virtual fire alarm --- .../advanced/core/AgentUtilOperations.java | 18 +++++++++--------- pom.xml | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java index 9123c5fac7..4ce5d5188b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/advanced/core/AgentUtilOperations.java @@ -29,6 +29,7 @@ import org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.advanced.transport. import java.io.*; import java.net.URL; +import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.security.PrivateKey; import java.security.PublicKey; @@ -67,15 +68,14 @@ public class AgentUtilOperations { try { ClassLoader loader = AgentUtilOperations.class.getClassLoader(); URL path = loader.getResource(propertiesFileName); - System.out.println(path); - String root = path.getPath().replace( - "wso2-firealarm-virtual-agent-advanced.jar!/deviceConfig.properties", - "").replace("jar:", "").replace("file:", ""); - - agentManager.setRootPath(root); - - propertiesInputStream = new FileInputStream( - root + AgentConstants.AGENT_PROPERTIES_FILE_NAME); + log.info(AgentConstants.LOG_APPENDER + path); + String rootPath = path.getPath().replace("wso2-firealarm-virtual-agent-advanced.jar!/deviceConfig" + + ".properties", "").replace("jar:", "").replace("file:", ""); + + rootPath = URLDecoder.decode(rootPath, StandardCharsets.UTF_8.toString()); + agentManager.setRootPath(rootPath); + String deviceConfigFilePath = rootPath + AgentConstants.AGENT_PROPERTIES_FILE_NAME; + propertiesInputStream = new FileInputStream(deviceConfigFilePath); //load a properties file from class path, inside static method properties.load(propertiesInputStream); diff --git a/pom.xml b/pom.xml index 1059802699..6bfe5570e6 100644 --- a/pom.xml +++ b/pom.xml @@ -1132,7 +1132,7 @@ [2.0.0, 3.0.0) - 1.2.15 + 1.2.25 3.0.36-SNAPSHOT