if (currentPath != null && entityPath.startsWith(currentPath + File.pathSeparator)) {
if (currentPath != null && entityPath.startsWith(currentPath + File.separator)) {
    private Element readConfigRootElement(final ServletContext context, String name, final String configFile) throws ServletException {                if (configFile != null) {            InputStream input = context.getResourceAsStream(configFile);                        if (input == null) {                input = getClass().getResourceAsStream(configFile);            }            if (input == null) {                throw new ServletException("Could not load " + name + ": " + configFile);            }                        try {                SAXBuilder build = new SAXBuilder();                build.setExpandEntities(true);                build.setEntityResolver(new EntityResolver() {                    // TODO: understand the API better and use something less hackish                    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {                        if (systemId == null) {                            return null;                        }                        String entityPath = systemId.substring("file://".length());                                                // relative to configuration file                        File file = new File(context.getRealPath(configFile));                                                // remove home path automatically appended                         String currentPath = new File(System.getProperty("user.dir")).getCanonicalPath();                        if (currentPath != null && entityPath.startsWith(currentPath + File.pathSeparator)) {                            entityPath = entityPath.substring(currentPath.length() + 1);                        }                                                File entityFile = new File(file.getParentFile(), entityPath);                        FileInputStream fileInputStream = new FileInputStream(entityFile);                                                return new InputSource(fileInputStream);                    }                                    });                                Document document = build.build(input);                return document.getRootElement();            } catch (JDOMException e) {                e.printStackTrace();            } catch (IOException e) {                e.printStackTrace();            }        } else {            logger.warn("parameter[" + name + "] no configuration file was provided");        }        return null;    }