String canonicalContainer = container.getCanonicalPath();
return canonicalDesired.startsWith(canonicalContainer);
}
protected File getAndVerifyFormatDir(String paramName, String xslid) throws BadParameterEx, IOException {
if (xslid == null) {
throw new BadParameterEx(paramName, "missing "+paramName+" param");
}
checkLegalId(paramName, xslid);
File formatDir = new File(userXslDir + xslid);
if(!formatDir.exists()) {
throw new BadParameterEx(paramName, "Format bundle "+xslid+" does not exist");
}
if(!formatDir.isDirectory()) {
throw new BadParameterEx(paramName, "Format bundle "+xslid+" is not a directory");
}
if(!new File(formatDir, VIEW_XSL_FILENAME).exists()) {
throw new BadParameterEx(paramName, "Format bundle "+xslid+" is not a valid format bundle because it does not have a "+VIEW_XSL_FILENAME+" file");
}
if (!containsFile(new File(userXslDir), formatDir)) {
throw new BadParameterEx(paramName, "Format bundle "+xslid+" is not a format bundle id because it does not reference a file contained within the userXslDir");
}
return formatDir;
}