JetBrains/intellij-community — pull request #226 by kukido (2014-11-24 03:38:11+00:00)
Title: Fixed flow for Ant build file validation

Pull request to fix AntConfiguration flow when a build file is added.

Currently the build file is marked as Ant file prior to inner structure validation.

AntSupport.markFileAsAntFile(file, xmlFile.getProject(), true);

It means that although the validation is performed, it does not throw an exception for build files without required attributes.

if (!AntDomFileDescription.isAntFile(((XmlFile)xmlFile))) {
throw new AntNoFileException("the file is not recognized as an ANT file", file);
}

The flow just falls to less strict check and hence the invalid Ant build file is added. Due to the previous call of marking the file as Ant file, pretty much any XML file can be added as Ant file.

if (vFile != null && ForcedAntFileAttribute.isAntFile(vFile)) {
return true;
}

I changed the order that marking the file as Ant file is happening after the inner structure validation.