try {
ReplicationPackage replicationPackage = packageBuilder.readPackage(resourceResolver, stream);
if (importPackage(resourceResolver, replicationPackage)) {
return replicationPackage;
} else {
throw new ReplicationPackageImportException("could not import the package " + replicationPackage);
}
} catch (ReplicationPackageReadingException e) {
throw new ReplicationPackageImportException("cannot read a package from the given stream", e);
}
}