From 0c7f1adcbae758729935dca4f42156ac8f31850b Mon Sep 17 00:00:00 2001 From: Maninda Date: Thu, 5 Jan 2017 19:36:52 +0530 Subject: [PATCH] Fixed some issues reported with FindBugs while security plugin is enabled. --- .../communication/http/FireAlarmHTTPCommunicator.java | 2 +- .../pom.xml | 1 + .../plugin/config/VirtualFirealarmConfig.java | 2 ++ .../pom.xml | 1 + .../adapter/websocket/config/WebsocketConfig.java | 5 +++-- .../output/adapter/websocket/util/WebsocketUtils.java | 2 ++ .../android/bean/wrapper/AndroidDeviceInfo.java | 2 +- .../android/common/GsonMessageBodyHandler.java | 8 +------- .../org.wso2.carbon.device.mgt.mobile.android/pom.xml | 1 + .../android/impl/util/MobileDeviceManagementUtil.java | 2 ++ .../api/common/util/GsonMessageBodyHandler.java | 8 +------- .../windows/api/common/util/WindowsAPIUtils.java | 2 +- .../windows/api/operations/util/OperationHandler.java | 10 +++++----- .../enrollment/impl/EnrollmentServiceImpl.java | 4 +++- .../wstep/impl/CertificateEnrollmentServiceImpl.java | 2 +- .../org.wso2.carbon.device.mgt.mobile.windows/pom.xml | 1 + .../windows/impl/util/MobileDeviceManagementUtil.java | 2 ++ 17 files changed, 29 insertions(+), 26 deletions(-) diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java index 98dbc6dc7..ead68c528 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/agent/communication/http/FireAlarmHTTPCommunicator.java @@ -111,7 +111,7 @@ public class FireAlarmHTTPCommunicator extends HTTPTransportHandler { AgentManager agentManager = AgentManager.getInstance(); String pathContext = request.getPathInfo(); - String separator = File.separator; + String separator = File.separatorChar=='\\' ? "\\\\" : File.separator ; if (pathContext.toUpperCase().contains( separator + AgentConstants.TEMPERATURE_CONTROL)) { diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml index 40eba7c2e..8a52af509 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/pom.xml @@ -83,6 +83,7 @@ org.wso2.carbon.event.input.adapter.core, org.wso2.carbon.event.input.adapter.core.exception, org.jivesoftware.smack.*, + javax.xml, javax.xml.bind, javax.xml.bind.annotation, javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}", diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java index a5a75611e..9bb1380e5 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/config/VirtualFirealarmConfig.java @@ -6,6 +6,7 @@ import org.w3c.dom.Document; import org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin.config.exception.VirtualFirealarmConfigurationException; import org.wso2.carbon.utils.CarbonUtils; +import javax.xml.XMLConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; @@ -50,6 +51,7 @@ public class VirtualFirealarmConfig { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 6400c6f34..c72d27c77 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -134,6 +134,7 @@ org.wso2.carbon.event.output.adapter.core.*, + javax.xml, javax.xml.namespace; version=0.0.0, org.apache.axis2, org.apache.axis2.client, diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java index 3499cd5e6..64efd5295 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/config/WebsocketConfig.java @@ -75,7 +75,8 @@ public class WebsocketConfig { return websocketValidationConfigs; } - public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigs) { - websocketValidationConfigs = websocketValidationConfigs; + public void setWebsocketValidationConfigs(WebsocketValidationConfigs websocketValidationConfigsTemp) { + websocketValidationConfigs = websocketValidationConfigsTemp; } + } diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java index 162bc9955..86e30712f 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/src/main/java/org/wso2/carbon/device/mgt/output/adapter/websocket/util/WebsocketUtils.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.output.adapter.websocket.util; import org.w3c.dom.Document; import org.wso2.carbon.device.mgt.output.adapter.websocket.config.WebsocketValidationConfigurationFailedException; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; @@ -34,6 +35,7 @@ public class WebsocketUtils { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java index bf775edfe..41fbb5857 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDeviceInfo.java @@ -300,7 +300,7 @@ public class AndroidDeviceInfo extends DeviceInfo implements Serializable { } public Date getUpdatedTime() { - if(this.updatedTime.equals((Object)null)) { + if(this.updatedTime == null) { this.updatedTime = new Date(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java index a1ae89d15..297630029 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/common/GsonMessageBodyHandler.java @@ -83,13 +83,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter, Messag OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); try { - Type jsonType; - if (type.equals(type)) { - jsonType = type; - } else { - jsonType = type; - } - getGson().toJson(object, jsonType, writer); + getGson().toJson(object, type, writer); } finally { writer.close(); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml index bad6eab68..e89d77a25 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/pom.xml @@ -59,6 +59,7 @@ org.osgi.framework, org.osgi.service.component, org.apache.commons.logging, + javax.xml, javax.xml.bind.*, javax.sql, javax.xml.parsers; version=0.0.0, diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java index 3e409653e..210c73502 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/util/MobileDeviceManagementUtil.java @@ -38,6 +38,7 @@ import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; @@ -66,6 +67,7 @@ public class MobileDeviceManagementUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/GsonMessageBodyHandler.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/GsonMessageBodyHandler.java index ecb720866..683d747cd 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/GsonMessageBodyHandler.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/GsonMessageBodyHandler.java @@ -82,13 +82,7 @@ public class GsonMessageBodyHandler implements MessageBodyWriter, Messag OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); try { - Type jsonType; - if (type.equals(type)) { - jsonType = type; - } else { - jsonType = type; - } - getGson().toJson(object, jsonType, writer); + getGson().toJson(object, type, writer); } finally { writer.close(); } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/WindowsAPIUtils.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/WindowsAPIUtils.java index 274c7ffae..d77f2a5ab 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/WindowsAPIUtils.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/common/util/WindowsAPIUtils.java @@ -187,10 +187,10 @@ public class WindowsAPIUtils { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); AuthenticatorConfigService authenticatorConfigService = (AuthenticatorConfigService) ctx.getOSGiService(AuthenticatorConfigService.class, null); - AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST"); if (authenticatorConfigService == null) { throw new IllegalStateException("AuthenticatorConfiguration service has not initialized."); } + AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST"); if (authenticatorConfig == null) { throw new IllegalStateException("BST authenticatorConfig has not initialized."); } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java index 8b0db0222..52ff4c4e2 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationHandler.java @@ -181,7 +181,7 @@ public class OperationHandler { if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) { pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); for (Operation operation : pendingDataOperations) { - if ((OperationCode.Command.DEVICE_RING.equals(operation.getCode())) && + if ((OperationCode.Command.DEVICE_RING.getCode().equals(operation.getCode())) && (operation.getId() == status.getCommandReference())) { operation.setStatus(Operation.Status.COMPLETED); updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), @@ -213,7 +213,7 @@ public class OperationHandler { } for (Operation operation : pendingDataOperations) { - if ((OperationCode.Command.WIPE_DATA.equals(operation.getCode())) && + if ((OperationCode.Command.WIPE_DATA.getCode().equals(operation.getCode())) && (operation.getId() == status.getCommandReference())) { operation.setStatus(Operation.Status.COMPLETED); updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), @@ -306,13 +306,13 @@ public class OperationHandler { if (status.getTargetReference() == null) { updateDeviceOperations(status, syncmlDocument, deviceIdentifier); } else { - if ((OperationCode.Command.DEVICE_LOCK.equals(status.getTargetReference()))) { + if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(status.getTargetReference()))) { updateLockOperation(status, syncmlDocument, deviceIdentifier); } - if ((OperationCode.Command.DEVICE_RING.equals(status.getTargetReference()))) { + if ((OperationCode.Command.DEVICE_RING.getCode().equals(status.getTargetReference()))) { ring(status, syncmlDocument, deviceIdentifier); } - if (equals(OperationCode.Command.WIPE_DATA.equals(status.getTargetReference()))) { + if ((OperationCode.Command.WIPE_DATA.getCode().equals(status.getTargetReference()))) { dataWipe(status, syncmlDocument, deviceIdentifier); } } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java index 7cd57a495..d59243549 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.java @@ -51,6 +51,7 @@ import org.xml.sax.SAXException; import javax.annotation.Resource; import javax.jws.WebService; import javax.servlet.ServletContext; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -102,7 +103,7 @@ public class EnrollmentServiceImpl implements EnrollmentService { String headerTo = null; String encodedWap; List
headers = getHeaders(); - for (Header headerElement : headers != null ? headers : null) { + for (Header headerElement : headers) { String nodeName = headerElement.getName().getLocalPart(); if (PluginConstants.SECURITY.equals(nodeName)) { Element element = (Element) headerElement.getObject(); @@ -231,6 +232,7 @@ public class EnrollmentServiceImpl implements EnrollmentService { signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded()); DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); + domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder builder; builder = domFactory.newDocumentBuilder(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java index 8e587bfc0..a749214ba 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.java @@ -112,7 +112,7 @@ public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentSe String headerTo = null; String encodedWap; List
headers = getHeaders(); - for (Header headerElement : headers != null ? headers : null) { + for (Header headerElement : headers) { String nodeName = headerElement.getName().getLocalPart(); if (PluginConstants.SECURITY.equals(nodeName)) { Element element = (Element) headerElement.getObject(); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml index 6890f755a..3a74f23de 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/pom.xml @@ -55,6 +55,7 @@ org.osgi.framework, org.osgi.service.component, org.apache.commons.logging, + javax.xml, javax.xml.bind.*, javax.sql, javax.naming, diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java index c658eb6d0..72bf59ef2 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/util/MobileDeviceManagementUtil.java @@ -38,6 +38,7 @@ import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import java.io.File; @@ -66,6 +67,7 @@ public class MobileDeviceManagementUtil { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilder docBuilder = factory.newDocumentBuilder(); return docBuilder.parse(file); } catch (Exception e) {