sqs policy attribute error when the prinicpal is a role arn
<p>I encountered an error when creating a policy for a sqs queue when specifying the principal as a role arn. </p>

<p>Here is the code I have</p>

<pre><code>public void addQueuePermission(String queueName) {
        try {
            String museBackendRoleArn = "arn:aws:iam::xxxxxxxx:role/yyyyyyyy";
            SQSActions[] eventQueueActions = {SQSActions.CreateQueue, SQSActions.ReceiveMessage, SQSActions.SendMessage};

            String queueURL = amazonSQS.getQueueUrl(queueName).getQueueUrl();
            List&lt;String&gt; sqsAttributes = new ArrayList&lt;&gt;();
            sqsAttributes.add("QueueArn");
            Map&lt;String, String&gt; att = amazonSQS.getQueueAttributes(queueURL, sqsAttributes).getAttributes();

            Map&lt;String, String&gt; options = new HashMap&lt;&gt;();
            options.put("Policy", createSQSPolicy(Statement.Effect.Allow, museBackendRoleArn, att.get("QueueArn"),
                    eventQueueActions).toJson());
            amazonSQS.setQueueAttributes(queueURL, options);
        } catch(AmazonServiceException ignore) {
            logger.error(ignore.getMessage());
        }
    }

 public static Policy createSQSPolicy(Statement.Effect effect, String principal, String resourceArn, SQSActions[] sqsActions, String sourceArn) {
        Statement statement = new Statement(effect)
                .withActions(sqsActions)
                .withPrincipals(new Principal(principal))
                .withResources(new Resource(resourceArn));
        return new Policy().withStatements(statement);
    }
</code></pre>

<p>The code returns a 400 error with the error message "Invalid value for the parameter Policy."</p>

<p>I tried the same policy through aws console and it works fine. I am using aws java sdk version 1.11.59</p>

<pre><code>&lt;dependency&gt;
        &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
        &lt;artifactId&gt;aws-java-sdk&lt;/artifactId&gt;
        &lt;version&gt;1.11.59&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>