public static String getRelativePath(final String parentPath, final String absolutePath) {
        if (parentPath == null || absolutePath == null
                || (parentPath.length() > absolutePath.length())) {
            return null;
        }

        String relativePath = null;
        final File absoluteFile = new File(absolutePath);
        if (absoluteFile.isAbsolute()) {
            final File parentFile = new File(parentPath);

            // parentFile must be absolute
            if (parentFile.isAbsolute()) {
                final String dirPath = FilenameUtil.normalize(parentFile.getAbsolutePath());

                final String normalizedAbsolutePath = FilenameUtil.normalize(absolutePath);
                int dirLength = dirPath.length();

                if (normalizedAbsolutePath.substring(0, dirLength).equalsIgnoreCase(dirPath)) {
                    // Cut parent path
                    relativePath = normalizedAbsolutePath.substring(dirLength);
                    if (relativePath.startsWith("/")) {
                        relativePath = relativePath.substring(1);
                    }
                }
            } else {
                relativePath = FilenameUtil.normalize(absoluteFile.getPath());
            }
        } else {
            relativePath = FilenameUtil.normalize(absoluteFile.getPath());
        }

        return relativePath;
    }