Yves Martin <[EMAIL PROTECTED]> writes:
> Hello,
>
> I'm writing a task which aim is to parse a Ant Project with 'helper.parse(p,
> myURL)'
>
> It works well when myURL is a File on disk - but it failed with "Source not
> supported by this plugin" when it is a URL... whereas I saw some parts of
> ProjectHelper2 designed to load a URL resource.
>
> I would like to avoid to inherit from ProjectHelper2 to work-around the check
> that failed.
I would like to understand why a BuildException is thrown when trying to parse
a URL ?
I disabled that exception throwing and in fact, I just use
helper.parse(project, URL) with a URL and it works perfectly well.
If there is no "good" reason or constraint about that exception, I would be
pleased to see that part of code removed. Or simply disabled by a project
property, why not. What do you think about it ? Is it possible to get it for
release 1.6.3 (it will be a great help for me to release my build system) ?
Thanks in advance for your help
<ProjectHelper2>
public void parse(Project project, Object source, RootHandler handler)
throws BuildException {
AntXMLContext context = handler.context;
File buildFile = null;
URL url = null;
String buildFileName = null;
if (source instanceof File) {
buildFile = (File) source;
buildFile = fu.normalize(buildFile.getAbsolutePath());
context.setBuildFile(buildFile);
buildFileName = buildFile.toString();
// } else if (source instanceof InputStream ) {
} else if (source instanceof URL) {
// if (handler.getCurrentAntHandler() != elementHandler) {
// throw new BuildException(
// "Source " + source.getClass().getName()
// + " not supported by this plugin for "
// + " non task xml");
// }
url = (URL) source;
buildFileName = url.toString();
// } else if (source instanceof InputSource ) {
} else {
throw new BuildException("Source " + source.getClass().getName()
+ " not supported by this plugin");
}
--
Yves Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]