Adding a release to the demo branch - #1
Conversation
| 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(','))); |
There was a problem hiding this comment.
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.
| urlConnection.connect(); | ||
|
|
||
| InputStream inputStream = urlConnection.getInputStream(); | ||
| FileOutputStream fileOutputStream = new FileOutputStream(directory); |
There was a problem hiding this comment.
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).
| db = this.getReadableDatabase(); | ||
|
|
||
| String query = "select email, pass from " + TABLE_NAME; | ||
| Cursor cursor = db.rawQuery(query, null); |
There was a problem hiding this comment.
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).
| List<Float> dim = new ArrayList<>(); | ||
| if (secondResponse != null) { | ||
|
|
||
| l = Float.parseFloat(firstResponse.substring(0, firstResponse.indexOf(','))); |
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| public String mapShipmentOnButtonClick() { | ||
| SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd"); |
There was a problem hiding this comment.
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.
No description provided.