Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318701

Summary: unable to move artifacts when repo already exists on fileshare
Product: [Technology] CBI Reporter: David Samuelsson <david.samuelsson.se>
Component: CBI p2 Repository AggregatorAssignee: Filip Hrbek <filip.hrbek>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: denisp, filip.hrbek, thomas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description David Samuelsson CLA 2010-07-02 07:56:16 EDT
using Eclipse Helios release.
b3 Aggregator Editor (Incubation)	0.1.0.r01087

When trying to aggregate the helios release, that has already been aggregated before (i.e. artifacts is already stored on a share) it fails when trying to move the old artifacts i.e:

Unable to move Y:\VE_Update_Site_libraries\lib\Hudson_aggregated\Helios\se.rsv.zz.org.eclipse.helios.mirror.b3aggr\final\artifacts.jar to Y:\VE_Update_Site_libraries\lib\Hudson_aggregated\Helios\se.rsv.zz.org.eclipse.helios.mirror.b3aggr\final\aggregate\artifacts.jar

it actually suceeds as the artifact is moved but returns this error above anyways. Trying to run the "build" again and it will fail with the next artifact:

Unable to move Y:\VE_Update_Site_libraries\lib\Hudson_aggregated\Helios\se.rsv.zz.org.eclipse.helios.mirror.b3aggr\final\plugins to Y:\VE_Update_Site_libraries\lib\Hudson_aggregated\Helios\se.rsv.zz.org.eclipse.helios.mirror.b3aggr\final\aggregate\plugins

etc..it goes on like this until it has moved all to the aggregate folder then it will succeed in the aggregation.

This problem does not occour if i clean then build first of course. Only seen this in UI, haven't tested in headless yet.
Comment 1 David Samuelsson CLA 2010-07-22 06:44:52 EDT
same problem manifested in headless.
Comment 2 Phil Denis CLA 2010-07-27 17:27:40 EDT
Looking at the source code of org.eclipse.b3.aggregator.engine.MirrorGenerator the problem is obvious.

On line 466 the first file is moved to the aggregate directory.  On line 467, an exception is thrown.

oldLocation.renameTo(newLocation);
throw ExceptionUtils.fromMessage("Unable to move %s to %s", oldLocation.getAbsolutePath(), newLocation.getAbsolutePath());

But it is not checking the return value of renameTo.  Instead, it should be like this:
if (!oldLocation.renameTo(newLocation)) {
    throw ExceptionUtils.fromMessage("Unable to move %s to %s", oldLocation.getAbsolutePath(), newLocation.getAbsolutePath());
}

There are 2 other places in this class that use the correct pattern.  Its just this one that is missing the test for the return condition.
Comment 3 Thomas Hallgren CLA 2011-07-09 04:19:05 EDT
Fixed sometime prior to revision 1499.
Comment 4 David Williams CLA 2016-09-16 15:58:08 EDT
[Bookkeeping change only. Moving bugs to the new "home" of aggregator, CBI.
No change to assignee for resolved and verified bugs.]