monitor.beginTask(Messages.DeploymentDescriptorPropertyCache_1, 3);
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
PropertyGroup groups[] = null;
IStructuredModel model = null;
List groupList = new ArrayList();
List urlPatterns = new ArrayList();
Float[] version = new Float[1];
SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 2);
DocumentBuilder builder = CommonXML.getDocumentBuilder(false);
builder.setEntityResolver(getEntityResolver());
builder.setErrorHandler(getErrorHandler(path));
try {
InputSource inputSource = new InputSource();
String s = FileContentCache.getInstance().getContents(path);
inputSource.setCharacterStream(new StringReader(s));
inputSource.setSystemId(path.toString());
Document document = builder.parse(inputSource);
_parseDocument(path, version, groupList, urlPatterns, subMonitor, document);
}
catch (SAXException e1) {
/* encountered a fatal parsing error, try our own parser */
try {
/**
* Chiefly because the web.xml file itself is editable, use
* SSE to get the DOM Document because it is more fault
* tolerant.
*/
model = StructuredModelManager.getModelManager().getModelForRead(file);
monitor.worked(1);
if (model instanceof IDOMModel) {
IDOMDocument document = ((IDOMModel) model).getDocument();
_parseDocument(path, version, groupList, urlPatterns, subMonitor, document);
}
}
catch (Exception e) {
Logger.logException(e);
}
finally {
if (model != null) {
model.releaseFromRead();
}
}
}
catch (IOException e1) {
/* file is unreadable, create no property groups */