Insufficient use of name in Amazon SQS queue Low

Provide the full URL for the Amazon SQS queue instead of just the name of the queue.

Detector ID
java/amazon-sqs-name-url@v1.0
Category
Common Weakness Enumeration (CWE) external icon
-

Noncompliant example

1public abstract class AmazonSqsNameUrlNoncompliant implements Callable<Message> {
2
3    public void non_compliant() {
4        final String queueName = "queueName";
5        // Noncompliant: queue name passed to SQS instead of queue URL.
6        sqsMetricsClient.changeMessageVisibility(queueName, "ReceiptHandle", "VisibilityTimeout");
7    }
8}

Compliant example

1public abstract class AmazonSqsNameUrlCompliant implements Callable<Message> {
2
3    public void compliant() {
4        final String queueUrl = "queueUrl";
5        // Compliant: queue URL passed to SQS instead of queue name.
6        sqsMetricsClient.changeMessageVisibility(queueUrl, "ReceiptHandle", "VisibilityTimeout");
7    }
8}