You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stephan Piesker <pi...@zedat.fu-berlin.de> on 2011/11/17 22:23:20 UTC

Issue 51829

Idea for solving the issue (51 829).
Problem is that an error log is generated, although this is given by the
user as optional. The following code:
<import optional="true">
    <url file="foo.x"/>
</ import>
The import class first checks whether the file exists from url. And right
there is the problem. The method of isExists URLResource class is called,
and this in turn uses the connect method of URLResource. In this attempt
to open a file and a failure, he said brings the error log. I can believe
that you can not just call the connect method in isExists and therefore
the solution must sign a modified function. This method then returns true
or false.

So solution:
URLResource.java file line 229:
connect away and try to open the file. For failure to return a false and a
true success.

question:
Where should I send the changed file?
Should I make a JUnittest this?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Issue 51829

Posted by Stephan Piesker <pi...@zedat.fu-berlin.de>.
> On 2011-11-17, Stephan Piesker wrote:
>
>> Idea for solving the issue (51 829).
>> Problem is that an error log is generated, although this is given by the
>> user as optional. The following code:
>> <import optional="true">
>>     <url file="foo.x"/>
>> </ import>
>> The import class first checks whether the file exists from url. And
>> right
>> there is the problem. The method of isExists URLResource class is
>> called,
>> and this in turn uses the connect method of URLResource. In this attempt
>> to open a file and a failure, he said brings the error log. I can
>> believe
>> that you can not just call the connect method in isExists and therefore
>> the solution must sign a modified function. This method then returns
>> true
>> or false.
>
>> So solution:
>> URLResource.java file line 229:
>> connect away and try to open the file. For failure to return a false and
>> a
>> true success.
>
> Another solution is to add a parameter to connect that specifies the log
> level to use if connect fails and pass in Project.MSG_VERBOSE from
> inside isExists().  This way you still get the error message when Ant is
> tun in with the -v switch in case you need to diagnose why the import
> fails.
>
> This is what I have done in trunk by now.
>

Ah, good solution. On the log level I've never thought of. The idea to
give the user the option of a possible errors in the log look up is very
good. So have no better solution.

>> question:
>> Where should I send the changed file?
>
> You'd attach it to the Bugzilla issue - if you feel your solution is
> better than mine, let's discuss that and then you can still create one.
>
>> Should I make a JUnittest this?
>
> or AntUnit.  Yes, we prefer patches that contain tests as well.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Issue 51829

Posted by Stefan Bodewig <bo...@apache.org>.
On 2011-11-17, Stephan Piesker wrote:

> Idea for solving the issue (51 829).
> Problem is that an error log is generated, although this is given by the
> user as optional. The following code:
> <import optional="true">
>     <url file="foo.x"/>
> </ import>
> The import class first checks whether the file exists from url. And right
> there is the problem. The method of isExists URLResource class is called,
> and this in turn uses the connect method of URLResource. In this attempt
> to open a file and a failure, he said brings the error log. I can believe
> that you can not just call the connect method in isExists and therefore
> the solution must sign a modified function. This method then returns true
> or false.

> So solution:
> URLResource.java file line 229:
> connect away and try to open the file. For failure to return a false and a
> true success.

Another solution is to add a parameter to connect that specifies the log
level to use if connect fails and pass in Project.MSG_VERBOSE from
inside isExists().  This way you still get the error message when Ant is
tun in with the -v switch in case you need to diagnose why the import
fails.

This is what I have done in trunk by now.

> question:
> Where should I send the changed file?

You'd attach it to the Bugzilla issue - if you feel your solution is
better than mine, let's discuss that and then you can still create one.

> Should I make a JUnittest this?

or AntUnit.  Yes, we prefer patches that contain tests as well.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org