Skip to content

Pull request test 2. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 377 commits into
base: test-destination
Choose a base branch
from
Open

Pull request test 2. #2

wants to merge 377 commits into from

Conversation

xxz-dev
Copy link
Owner

@xxz-dev xxz-dev commented Jun 26, 2020

No description provided.


@Override
public String toString() {
return String.format("%s LIMIT %s,%s", partialAwqlQuery, startIndex, pageSize);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: startIndex, pageSize. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 158. Consider formatting this data with '%d' instead.

System.out.println("Report was not downloaded. " + response.getHttpStatus() + ": "
+ response.getHttpResponseMessage());
}
FileOutputStream fos = new FileOutputStream(new File(reportFile));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem
This line of code contains a resource that might not be closed properly. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the following resource: fos. The resource is referenced in statements at the following line: 218. The resource closure statement is at line: 219. There are other execution paths that do not contain closure statements, for example, when Streams.copy throws an exception. Either a) close fos in a try-finally block or b) close the resource by declaring fos in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

new RemoteCallReturn.Builder().withRequestInfo(requestInfo).withResponseInfo(responseInfo);
if (!isSuccess) {
remoteCallReturnBuilder.withException(
new ReportException(String.format("%s: %s", statusCode, statusMessage)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: statusCode (declared at line 91). This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 108. Consider formatting this data with '%d' instead.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 98. Consider formatting this data with '%d' instead.

AdGroup adGroup = new AdGroup();
adGroup.setCampaignId(campaignOperation.getOperand().getId());
adGroup.setId(tempIdGenerator.next());
adGroup.setName(String.format("Batch Ad Group %s.%s", namePrefix, i));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: i (declared at line 351). This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 355. Consider formatting this data with '%d' instead.

feeds.addAll(Arrays.asList(feedPage.getEntries()));
}
offset += PAGE_SIZE;
} while (offset < feedPage.getTotalNumEntries());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Similar code fragments were detected in the same file at the following lines: 323:330, 351:358, 570:577.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 98. Consider formatting this data with '%d' instead.

List<CampaignOperation> operations = new ArrayList<>();
for (int i = 0; i < NUMBER_OF_CAMPAIGNS_TO_ADD; i++) {
Campaign campaign = new Campaign();
campaign.setName(String.format("Batch Campaign %s.%s", namePrefix, i));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: i (declared at line 402). This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 404. Consider formatting this data with '%d' instead.

mediumSquareAdUnitIds.toArray(new String[] {}));

placementsToCreate.add(mediumSquareAdUnitPlacement);
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Similar code fragments were detected in the same file at the following lines: 95:106, 108:117, 119:128.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.

mediumSquareAdUnitIds.toArray(new String[] {}));

placementsToCreate.add(mediumSquareAdUnitPlacement);
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Similar code fragments were detected in the same file at the following lines: 95:106, 108:117, 119:128.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.

AdGroup adGroup = new AdGroup();
adGroup.setCampaignId(campaignOperation.getOperand().getId());
adGroup.setId(tempIdGenerator.next());
adGroup.setName(String.format("Batch Ad Group %s.%s", namePrefix, i));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: i (declared at line 351). This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 355. Consider formatting this data with '%d' instead.

DateTimeRange dateTimeRange = new DateTimeRange();
dateTimeRange.setMin(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date(System
.currentTimeMillis() - 1000L * 60 * 60 * 24)));
dateTimeRange.setMax(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date()));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

The SimpleDateFormat object was created without setting the time zone. Make sure that you want to use the default time zone or use letter z, Z or X in the pattern. Otherwise, if you do not call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 98. Consider formatting this data with '%d' instead.

mediumSquareAdUnitIds.toArray(new String[] {}));

placementsToCreate.add(mediumSquareAdUnitPlacement);
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Similar code fragments were detected in the same file at the following lines: 95:106, 108:117, 119:128.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.

List<CampaignOperation> operations = new ArrayList<>();
for (int i = 0; i < NUMBER_OF_CAMPAIGNS_TO_ADD; i++) {
Campaign campaign = new Campaign();
campaign.setName(String.format("Batch Campaign %s.%s", namePrefix, i));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: i (declared at line 402). This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 404. Consider formatting this data with '%d' instead.

mediumSquareAdUnitIds.toArray(new String[] {}));

placementsToCreate.add(mediumSquareAdUnitPlacement);
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Similar code fragments were detected in the same file at the following lines: 95:106, 108:117, 119:128.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.


// Create date time range for the past 24 hours.
DateTimeRange dateTimeRange = new DateTimeRange();
dateTimeRange.setMin(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date(System
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

The SimpleDateFormat object was created without setting the time zone. Make sure that you want to use the default time zone or use letter z, Z or X in the pattern. Otherwise, if you do not call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

DateTimeRange dateTimeRange = new DateTimeRange();
dateTimeRange.setMin(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date(System
.currentTimeMillis() - 1000L * 60 * 60 * 24)));
dateTimeRange.setMax(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date()));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

The SimpleDateFormat object was created without setting the time zone. Make sure that you want to use the default time zone or use letter z, Z or X in the pattern. Otherwise, if you do not call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

xmlEventReader.close();
xmlEventWriter.close();

InputStream truncatedInputStream =
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the following resource: truncatedInputStream. Currently, there are execution paths that do not contain closure statements, for example, when Supplier.get throws an exception. Either a) close truncatedInputStream in a try-finally block or b) close the resource by declaring truncatedInputStream in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 109. Consider formatting this data with '%d' instead.

mediumSquareAdUnitIds.toArray(new String[] {}));

placementsToCreate.add(mediumSquareAdUnitPlacement);
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Similar code fragments were detected in the same file at the following lines: 95:106, 108:117, 119:128.
Refactoring can help improve code maintainability. Consider reducing duplicate code by extracting it into a separate method. You can then replace duplicated code with calls to this new method.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 98. Consider formatting this data with '%d' instead.

if (this.dateRange == null) {
this.dateRange = new DateRange();
}
DateFormat dateFormat = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

The SimpleDateFormat object was created without setting the time zone. Make sure that you want to use the default time zone or use letter z, Z or X in the pattern. Otherwise, if you do not call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 109. Consider formatting this data with '%d' instead.


StringWriter stringWriter = new StringWriter();

XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(url.openStream());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the resource returned by the following method call: openStream. Currently, there are execution paths that do not contain closure statements, for example, when XMLInputFactory.createXMLEventReader throws an exception. Either a) close the object returned by openStream() in a try-finally block or b) close the resource by declaring the object returned by openStream() in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

xmlEventReader.close();
xmlEventWriter.close();

InputStream truncatedInputStream =
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the following resource: truncatedInputStream. Currently, there are execution paths that do not contain closure statements, for example, when Supplier.get throws an exception. Either a) close truncatedInputStream in a try-finally block or b) close the resource by declaring truncatedInputStream in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 109. Consider formatting this data with '%d' instead.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 98. Consider formatting this data with '%d' instead.

CreativeAsset asset = new CreativeAsset();
asset.setAssetByteArray(Media.getMediaDataFromUrl("https://goo.gl/3b9Wfh"));
// Filenames must be unique.
asset.setFileName(String.format("image%s.jpg", new Random().nextInt(Integer.MAX_VALUE)));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

This code uses '%s' to format int: 'nextInt' expression. This is a potential locale-sensitive handling issue. It might cause errors in the handling and processing of the statement at line: 109. Consider formatting this data with '%d' instead.


StringWriter stringWriter = new StringWriter();

XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(url.openStream());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

Problem
This line of code might contain a resource leak. Resource leaks can cause your system to slow down or crash.

Fix
Consider closing the resource returned by the following method call: openStream. Currently, there are execution paths that do not contain closure statements, for example, when XMLInputFactory.createXMLEventReader throws an exception. Either a) close the object returned by openStream() in a try-finally block or b) close the resource by declaring the object returned by openStream() in a try-with-resources block.

More info
View resource management guidelines at oracle.com (external link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants