}
private void writeResponse(Request request, SearchResult<IssueDoc> result, JsonWriter json) {
- if (result.getFacets().contains(IssueIndex.DEBT_AGGREGATION_NAME)) {
- json.prop("debtTotal", result.getFacets().get(IssueIndex.DEBT_AGGREGATION_NAME).get(Facets.TOTAL));
+ Map<String, Long> debtFacet = result.getFacets().get(IssueIndex.DEBT_AGGREGATION_NAME);
+ if (debtFacet != null) {
+ json.prop("debtTotal", debtFacet.get(Facets.TOTAL));
}
List<String> issueKeys = newArrayList();
try {
cleanTempFolders(workingPath);
} catch (IOException e) {
- LOG.warn("failed to clean global working directory: " + e.getMessage());
+ LOG.error(String.format("failed to clean global working directory: %s", workingPath), e);
}
Path tempDir = workingPath.resolve(TMP_NAME_PREFIX + System.currentTimeMillis());
private static class CleanFilter implements DirectoryStream.Filter<Path> {
@Override
- public boolean accept(Path e) throws IOException {
- if (!Files.isDirectory(e)) {
+ public boolean accept(Path path) throws IOException {
+ if (!Files.isDirectory(path)) {
return false;
}
- if (!e.getFileName().toString().startsWith(TMP_NAME_PREFIX)) {
+ if (!path.getFileName().toString().startsWith(TMP_NAME_PREFIX)) {
return false;
}
BasicFileAttributes attrs;
try {
- attrs = Files.readAttributes(e, BasicFileAttributes.class);
+ attrs = Files.readAttributes(path, BasicFileAttributes.class);
} catch (IOException ioe) {
- LOG.warn("couldn't read file attributes for " + e + " : " + ioe.getMessage());
+ LOG.error(String.format("Couldn't read file attributes for %s : ", path), ioe);
return false;
}
}
Collection<File> bundles = FileUtils.listFiles(bundleFolder, new String[]{"properties"}, false);
- Map<String, String> failedAssertionMessages = new HashMap();
+ Map<String, String> failedAssertionMessages = new HashMap<>();
for (File bundle : bundles) {
String bundleName = bundle.getName();
if (bundleName.indexOf('_') > 0) {