/** * Increase the number of Exceptions by severity level. * * @param msgType message type:error warn info */ public static void increaseNumOfExceptionByType(final String msgType) { if (msgType == null) { increaseNumOfErrors(); return; } final String type = msgType.toUpperCase(); if (FATAL.equals(type)) { LogUtils.increaseNumOfFatals(); return; } if (ERROR.equals(type)) { increaseNumOfErrors(); return; } if (WARN.equals(type)) { increaseNumOfWarnings(); return; } if (INFO.equals(type)) { increaseNumOfInfo(); return; } // TODO increaseNumOfErrors(); }
public List<Map<String, Object>> getPackages() throws IOException { List<Map<String, Object>> packages = new ArrayList<Map<String, Object>>(); for (SPK spk : spks) { log("Include SPK: " + spk.file.getName()); // make sure file is cached locally if (spk.url != null) { log("Using " + spk.url); if (!spk.file.exists()) { spk.file.getParentFile().mkdirs(); } if (spk.url == null) { spk.url = spk.url; } Get get = new Get(); get.bindToOwner(this); get.setQuiet(true); get.setUseTimestamp(true); get.setSrc(spk.url); get.setDest(spk.file); get.execute(); } else { log("Using " + spk.file); } // import SPK INFO Map<String, Object> info = new LinkedHashMap<String, Object>(); TarFileSet tar = new TarFileSet(); tar.setProject(getProject()); tar.setSrc(spk.file); tar.setIncludes(INFO); for (Resource resource : tar) { if (INFO.equals(resource.getName())) { String text = FileUtils.readFully( new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8)); for (String line : text.split("\\R")) { String[] s = line.split("=", 2); if (s.length == 2) { if (s[1].startsWith("\"") && s[1].endsWith("\"")) { s[1] = s[1].substring(1, s[1].length() - 1); } importSpkInfo(info, s[0], s[1]); } } } } log(String.format("Imported %d fields from SPK: %s", info.size(), info.keySet())); // add thumbnails and snapshots if (spk.thumbnail.size() > 0) { info.put(THUMBNAIL, spk.thumbnail.toArray(new String[0])); } if (spk.snapshot.size() > 0) { info.put(SNAPSHOT, spk.snapshot.toArray(new String[0])); } // add user-defined fields info.putAll(spk.infoList); // automatically generate file size and checksum fields if (!info.containsKey(LINK)) { info.put(LINK, spk.url); } info.put(MD5, md5(spk.file)); info.put(SIZE, spk.file.length()); packages.add(info); } return packages; }