From fd1afb6fc4b2219bda3275eb5bc69eebd0a99f6d Mon Sep 17 00:00:00 2001 From: mcgitty <4326639+mcgitty@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:38:17 -0700 Subject: [PATCH] Use File to parse path, which honors / in Windows. --- .gitignore | 4 ++++ src/main/java/org/wso2/soaptorest/WSDLProcessor.java | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 4c1a033..99ae847 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,7 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* .idea/ +.classpath +.project +.settings/ +/target/ diff --git a/src/main/java/org/wso2/soaptorest/WSDLProcessor.java b/src/main/java/org/wso2/soaptorest/WSDLProcessor.java index 84a45ef..97c6623 100644 --- a/src/main/java/org/wso2/soaptorest/WSDLProcessor.java +++ b/src/main/java/org/wso2/soaptorest/WSDLProcessor.java @@ -81,9 +81,10 @@ void init(String path) throws SOAPToRESTException { wsdlReader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false); wsdlReader.setFeature(JAVAX_WSDL_IMPORT_DOCUMENTS, false); try { - String systemId = ""; - if (path.lastIndexOf(File.separator) > 0) { - systemId = path.substring(0, path.lastIndexOf(File.separator)); + File file = new File(path); + String systemId = file.getParent(); + if (systemId == null) { + systemId = ""; } wsdlDefinition = wsdlReader.readWSDL(systemId, WSDLProcessingUtil.getSecuredParsedDocumentFromPath(path, systemId)); initializeModels(wsdlDefinition, systemId);