Author: cziegeler
Date: Tue Jan 24 09:10:17 2012
New Revision: 1235172
URL: http://svn.apache.org/viewvc?rev=1235172&view=rev
Log:
SLING-2381 : Update detection might delete copied artifact
Modified:
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
Modified:
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
URL:
http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java?rev=1235172&r1=1235171&r2=1235172&view=diff
==============================================================================
---
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
(original)
+++
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
Tue Jan 24 09:10:17 2012
@@ -395,16 +395,29 @@ public class OsgiInstallerImpl
// now update resources and removed resources and remove all
for this scheme!
final String prefix = scheme + ':';
// added resources
+
final Iterator<InternalResource> rsrcIter =
this.newResources.iterator();
while ( rsrcIter.hasNext() ) {
final InternalResource rsrc = rsrcIter.next();
if ( rsrc.getURL().startsWith(prefix) ) {
+ // check if we got the same resource
if ( rsrc.getPrivateCopyOfFile() != null ) {
- rsrc.getPrivateCopyOfFile().delete();
+ boolean found = false;
+ for(final InternalResource newRsrc :
registeredResources) {
+ if ( newRsrc.getURL().equals(rsrc.getURL()) &&
newRsrc.getPrivateCopyOfFile() == null ) {
+ found = true;
+
newRsrc.setPrivateCopyOfFile(rsrc.getPrivateCopyOfFile());
+ break;
+ }
+ }
+ if ( !found ) {
+ rsrc.getPrivateCopyOfFile().delete();
+ }
}
rsrcIter.remove();
}
}
+
// removed urls
final Iterator<String> urlIter = this.urlsToRemove.iterator();
while ( urlIter.hasNext() ) {