OrderedPair<S3BucketPolicy, Integer> result = ServiceProvider.getInstance().getBucketPolicy(context.getBucketName());
S3BucketPolicy policy = result.getFirst();
if (null == policy) {
// -> do we have to load it from the database (any other value means there is no policy)?
if (-1 == result.getSecond().intValue()) {
BucketPolicyVO policyvo = s_bPolicy.getByName(context.getBucketName());
String policyInJson = null;
if (null != policyvo)
policyInJson = policyvo.getPolicy();
// -> place in cache that no policy exists in the database
if (null == policyInJson) {
ServiceProvider.getInstance().setBucketPolicy(context.getBucketName(), null);
return null;