Fix some warnings

This commit is contained in:
xynngh 2020-05-14 19:04:50 +04:00
parent 2cc3a19684
commit 10e39a4435
2 changed files with 19 additions and 16 deletions

View File

@ -156,7 +156,7 @@ public class CommunityDatabase extends AbstractDatabase<CommunityDatabaseDataSli
String numberString = String.valueOf(number);
if (numberString.length() < 2) return null;
int sliceId = Integer.valueOf(numberString.substring(0, 2));
int sliceId = Integer.parseInt(numberString.substring(0, 2));
LOG.trace("getSecondaryDataSlice() sliceId={}", sliceId);
CommunityDatabaseDataSlice communityDatabaseDataSlice = secondarySliceCache.get(sliceId);
@ -308,7 +308,7 @@ public class CommunityDatabase extends AbstractDatabase<CommunityDatabaseDataSli
LOG.trace("updateSecondaryDbInternal() finished processing slice");
if (!tempFile.delete()) {
LOG.warn("updateSecondaryDbInternal() failed to delete tempFile ", tempFile);
LOG.warn("updateSecondaryDbInternal() failed to delete tempFile {}", tempFile);
}
LOG.debug("updateSecondaryDbInternal() updated performed successfully in {} ms",
@ -321,15 +321,18 @@ public class CommunityDatabase extends AbstractDatabase<CommunityDatabaseDataSli
responseString, System.currentTimeMillis() - startTimestamp);
responseString = responseString.replaceAll("\n", "");
if ("OAP".equals(responseString)) {
switch (responseString) {
case "OAP":
LOG.trace("updateSecondaryDbInternal() server reported outdated app");
// outdated app
return UpdateResult.OUTDATED_APP;
} else if ("NC".equals(responseString)) {
case "NC":
LOG.trace("updateSecondaryDbInternal() server reported no updates");
// "No checkAndUpdate available" - probably "up to date"
return UpdateResult.NO_UPDATES;
} else if ("OOD".equals(responseString)) {
case "OOD":
LOG.trace("updateSecondaryDbInternal() server suggests to reset secondary DB");
// remove secondary DB and retry
return UpdateResult.BAD_SECONDARY;

View File

@ -35,14 +35,14 @@ public class CommunityDatabaseDataSlice extends AbstractDatabaseDataSlice<Commun
for (int i = 0; i < numbers.length; i++) {
String numberString = String.valueOf(numbers[i]);
if (numberString.length() > 1) {
int sliceId = Integer.valueOf(numberString.substring(0, 2));
int sliceId = Integer.parseInt(numberString.substring(0, 2));
shortSliceIdToIndexMap.get(sliceId).add(i);
}
}
for (int i = 0; i < numbersToDelete.length; i++) {
String numberString = String.valueOf(numbersToDelete[i]);
if (numberString.length() > 1) {
int sliceId = Integer.valueOf(numberString.substring(0, 2));
int sliceId = Integer.parseInt(numberString.substring(0, 2));
shortSliceIdToIndexToDeleteMap.get(sliceId).add(i);
}
}