in src/main/java/org/apache/sling/installer/core/impl/tasks/SystemBundleUpdateTask.java [49:94]
public void execute(final InstallationContext ctx) {
final Bundle systemBundle = this.getBundleContext().getBundle(Constants.SYSTEM_BUNDLE_LOCATION);
// sanity check
if ( systemBundle == null ) {
this.setFinishedState(ResourceState.IGNORED, null, "Cannot update system bundle!");
ctx.asyncTaskFailed(this);
return;
}
// restart system bundle
if ( this.getResource() == null ) {
ctx.log("Refreshing system bundle.");
this.getBundleRefresher().refreshBundles(ctx, Collections.singletonList(systemBundle), false);
} else {
InputStream is = null;
try {
is = getResource().getInputStream();
if (is == null) {
String message = MessageFormat.format("RegisteredResource provides null InputStream, cannot update system bundle: {0}", getResource());
getLogger().warn(message);
this.setFinishedState(ResourceState.IGNORED, null, message);
ctx.asyncTaskFailed(this);
} else {
try {
systemBundle.update(is);
} catch (final BundleException e) {
String message = MessageFormat.format("Updating system bundle failed due to {0} - unable to retry: {1}", e.getLocalizedMessage(), this);
getLogger().warn(message, e);
this.setFinishedState(ResourceState.IGNORED, null, message);
ctx.asyncTaskFailed(this);
}
}
} catch (final IOException e) {
String message = MessageFormat.format("Removing failing task due to due to {0} - unable to retry: {1}", e.getLocalizedMessage(), this);
this.getLogger().warn(message, e);
this.setFinishedState(ResourceState.IGNORED, null, message);
ctx.asyncTaskFailed(this);
} finally {
if ( is != null ) {
try {
is.close();
} catch (final IOException ignore) {}
}
}
}
}