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

View File

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