try {
log.debug("Uninstalling initial content from bundle {}", bundle.getSymbolicName());
if (uninstallPaths != null && uninstallPaths.length > 0) {
for (String path : uninstallPaths) {
final Session targetSession;
final int wsSepPos = path.indexOf(":/");
if (wsSepPos != -1) {
final String workspaceName = path.substring(0, wsSepPos);
path = path.substring(wsSepPos + 1);
if (workspaceName.equals(defaultSession.getWorkspace().getName())) {
targetSession = defaultSession;
} else if (createdSessions.containsKey(workspaceName)) {
targetSession = createdSessions.get(workspaceName);
} else {
targetSession = createSession(workspaceName);
createdSessions.put(workspaceName, targetSession);
}
} else {
targetSession = defaultSession;
}
if (targetSession.itemExists(path)) {
targetSession.getItem(path).remove();
}
}
// persist modifications now
defaultSession.save();