codacy: Avoid declaring a variable if it is unreferenced before a possible exit point.

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2019-04-10 08:37:05 +02:00
parent cd1469317d
commit 2c55f2ee49
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -160,8 +160,6 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
} }
private Cursor searchForUsersOrGroups(Uri uri) { private Cursor searchForUsersOrGroups(Uri uri) {
MatrixCursor response = null;
String lastPathSegment = uri.getLastPathSegment(); String lastPathSegment = uri.getLastPathSegment();
if (lastPathSegment == null) { if (lastPathSegment == null) {
@ -192,20 +190,15 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
showErrorMessage(result); showErrorMessage(result);
} }
MatrixCursor response = null;
// convert the responses from the OC server to the expected format // convert the responses from the OC server to the expected format
if (names.size() > 0) { if (names.size() > 0) {
response = new MatrixCursor(COLUMNS);
Iterator<JSONObject> namesIt = names.iterator();
JSONObject item;
String displayName;
int icon = 0;
Uri dataUri;
int count = 0;
if (getContext() == null) { if (getContext() == null) {
throw new IllegalArgumentException("Context may not be null!"); throw new IllegalArgumentException("Context may not be null!");
} }
response = new MatrixCursor(COLUMNS);
Uri userBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_USER).build(); Uri userBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_USER).build();
Uri groupBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_GROUP).build(); Uri groupBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_GROUP).build();
Uri roomBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_ROOM).build(); Uri roomBaseUri = new Uri.Builder().scheme(CONTENT).authority(DATA_ROOM).build();
@ -217,6 +210,12 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
.isTrue(); .isTrue();
try { try {
Iterator<JSONObject> namesIt = names.iterator();
JSONObject item;
String displayName;
int icon = 0;
Uri dataUri;
int count = 0;
while (namesIt.hasNext()) { while (namesIt.hasNext()) {
item = namesIt.next(); item = namesIt.next();
dataUri = null; dataUri = null;