You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-dev@incubator.apache.org by Stephane Bailliez <sb...@gmail.com> on 2007/01/04 23:34:24 UTC

Re: svn commit: r492785 - in /incubator/ivy/trunk: CHANGES.txt src/java/fr/jayasoft/ivy/repository/AbstractRepository.java

Hi there,

I'm not sure you've been fixing the right thing (even though you'll 
avoid the npe).

It looks like to me the root of the problem is in FileUtil.copy(). I 
suspect the IOException happened in the finally with the close() calls 
and as the end() call is performed before, this nulled the reference (as 
far as I can read the reference is nulled only after a end or error.)

So if you consider that an IOException in the close should make the 
transfer fail, then the end() of the transfer would be after the close().
Whether or not you put the end() call in the finally or not depends 
whether end you consider that end is actually success or not and then 
where it makes sense to cleanup the event reference (if any).

It does not seem extremely clear in the code and the semantic is not 
documented in the interface, but considering the reference was nulled in 
both end and error, I suspect end meant success. in that case I'll put 
the end() call after the finally. But in any case it cannot be end 
followed by error if end is meant as success.

I may be of course completely wrong as my head spins easily after a 
double callback and nested calls. :)

-- stephane


maartenc@apache.org wrote:
> Author: maartenc
> Date: Thu Jan  4 14:38:49 2007
> New Revision: 492785
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=492785
> Log:
> FIX: IOException during publish causes NullPointerException (IVY-371)
>
> Modified:
>     incubator/ivy/trunk/CHANGES.txt
>     incubator/ivy/trunk/src/java/fr/jayasoft/ivy/repository/AbstractRepository.java
>
> Modified: incubator/ivy/trunk/CHANGES.txt
> URL: http://svn.apache.org/viewvc/incubator/ivy/trunk/CHANGES.txt?view=diff&rev=492785&r1=492784&r2=492785
> ==============================================================================
> --- incubator/ivy/trunk/CHANGES.txt (original)
> +++ incubator/ivy/trunk/CHANGES.txt Thu Jan  4 14:38:49 2007
> @@ -10,6 +10,8 @@
>  - IMPROVE: Please typedef CacheResolver as "cache" for us (IVY-359)
>  - IMPROVE: ivy:retrieve should be able to create symlinks (IVY-353) (thanks to John Williams)
>  
> +- FIX: IOException during publish causes NullPointerException (IVY-371)
> +
>     version 1.4.1 - 2006-11-09
>  =====================================
>  - IMPROVE: ability to rebuild all dependent projects from a leaf (IVY-101)
>
> Modified: incubator/ivy/trunk/src/java/fr/jayasoft/ivy/repository/AbstractRepository.java
> URL: http://svn.apache.org/viewvc/incubator/ivy/trunk/src/java/fr/jayasoft/ivy/repository/AbstractRepository.java?view=diff&rev=492785&r1=492784&r2=492785
> ==============================================================================
> --- incubator/ivy/trunk/src/java/fr/jayasoft/ivy/repository/AbstractRepository.java (original)
> +++ incubator/ivy/trunk/src/java/fr/jayasoft/ivy/repository/AbstractRepository.java Thu Jan  4 14:38:49 2007
> @@ -65,7 +65,6 @@
>          	_evt.setTotalLengthSet(true);
>          }
>          fireTransferEvent(_evt);
> -        _evt = null;
>      }
>      
>      protected void fireTransferCompleted(long totalLength) {
> @@ -73,20 +72,17 @@
>          _evt.setTotalLength(totalLength);
>          _evt.setTotalLengthSet(true);
>          fireTransferEvent(_evt);
> -        _evt = null;
>      }
>      
>      protected void fireTransferError() {
>          _evt.setEventType(TransferEvent.TRANSFER_ERROR);
>          fireTransferEvent(_evt);
> -        _evt = null;
>      }
>      
>      protected void fireTransferError(Exception ex) {
>          _evt.setEventType(TransferEvent.TRANSFER_ERROR);
>          _evt.setException(ex);
>          fireTransferEvent(_evt);
> -        _evt = null;
>      }
>      
>      protected void fireTransferEvent(TransferEvent evt) {
>
>
>
>