space is replaced by %20 in file path while creating file and file is created at new location

2.1k views Asked by At

I have installed my software in below mention path. i am getting resulting path of directory created at different location as my installation path contains space. can some one help me how to resolve this issue.

installation path :

/home/test/glh/QA oist/

expected endpoint reference directory :

/home/test/glh/QA oist/server/Tomcat/webapps/ibis/WEB-INF/services

resulting endpoint reference directory :

/home/test/glh/QA%20oist/server/Tomcat/webapps/ibis/WEB-INF/services





 File repDir = new File(axisConf.getRepository().getFile());
        String serviceName = IISUtilsHandler.replaceChars(module.getModuleName(), " ", "");
        File serviceNameDir = new File(repDir + File.separator + "services" + File.separator + serviceName);

                  if ((moduleProperties.getBoolProperty("ValidateResponse", false) || moduleProperties.getBoolProperty("ValidateRequest", false))
            && moduleProperties.containsProperty("SchemaFileGenerationError")) {
            String schemaGenerationError = moduleProperties.getProperty("SchemaFileGenerationError");
            throw new IException("WebServiceConnector.Deploy.ErrorBecauseSchemaGenerationFailed", schemaGenerationError);
        }

        File serviceDir = new File(serviceNameDir, "META-INF");
        if (!serviceDir.mkdirs()) {
            throw new InubitException("CreateDirError", serviceDir.toString());
        }
        IISFileHandler.writeStringToFile(serviceDir + File.separator + "services.xml", createServiceXml(moduleProperties, module));
        IISFileHandler.writeStringToFile(serviceDir + File.separator + "service.wsdl", moduleProperties.getProperty("WsdlData"));
1

There are 1 answers

1
Ganesh Toni On

Please share more details and sample code you are using to get/generate installation file path. However you can add below java code to replace special character (%20) with space on the fly

File dir = new File( new URI(installation_path.replaceAll(" ", "%20")) );