Skip to content
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

fixed #1

Open
wants to merge 1 commit into
base: fix
Choose a base branch
from
Open

fixed #1

wants to merge 1 commit into from

Conversation

varunkashyapks
Copy link
Owner

No description provided.

}

public String mapShipmentOnButtonClick() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
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

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 don?t call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

urlConnection.connect();

InputStream inputStream = urlConnection.getInputStream();
FileOutputStream fileOutputStream = new FileOutputStream(directory);
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

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: fileOutputStream. The resource is referenced in statements at the following line: 35. The resource closure statement is at line: 37. There are other execution paths that do not contain closure statements, e.g., when exception is thrown by InputStream.read. Either a) close fileOutputStream in a try-finally block or b) close the resource by declaring fileOutputStream in a try-with-resources block.

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

l = Float.parseFloat(firstResponse.substring(0, firstResponse.indexOf(',')));
b = Float.parseFloat(firstResponse.substring(firstResponse.indexOf(',') + 1, firstResponse.length() - 1));

h = Float.parseFloat(secondResponse.substring(0, secondResponse.indexOf(',')));
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

If the indexOf() search on line 533 does not find the substring and returns -1, the call to substring() on line 533 will throw IndexOutOfBoundsException.

List<Float> dim = new ArrayList<>();
if (secondResponse != null) {

l = Float.parseFloat(firstResponse.substring(0, firstResponse.indexOf(',')));
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

If the indexOf() search on line 530 does not find the substring and returns -1, the call to substring() on line 530 will throw IndexOutOfBoundsException.

db = this.getReadableDatabase();

String query = "select email, pass from " + TABLE_NAME;
Cursor cursor = db.rawQuery(query, null);
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

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: cursor. Currently, there are execution paths that do not contain closure statements. Either a) close cursor in a try-finally block or b) close the resource by declaring cursor in a try-with-resources block.

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

}

public String mapShipmentOnButtonClick() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
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

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 don?t call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

}

public String mapShipmentOnButtonClick() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
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

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 don?t call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

}

public String mapShipmentOnButtonClick() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
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

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 don?t call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

}

public String mapShipmentOnButtonClick() {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
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

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 don’t call setTimeZone() on the created SimpleDateFormat object, you might get an unexpected date and time when using the object.

@varunkashyapks varunkashyapks self-assigned this Jan 16, 2020
@varunkashyapks varunkashyapks added the enhancement New feature or request label Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant