/** * 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(); }
static { mValues.put(VERBOSE.toString().toLowerCase(), VERBOSE); mValues.put(DEBUG.toString().toLowerCase(), DEBUG); mValues.put(INFO.toString().toLowerCase(), INFO); mValues.put(WARNING.toString().toLowerCase(), WARNING); mValues.put(ERROR.toString().toLowerCase(), ERROR); mValuesList = Arrays.asList(values()); }
/** * Method to avoid creating duplicate instances when deserializing the object. * * @return the singleton instance of this <code>Level</code> value in this classloader * @throws ObjectStreamException If unable to deserialize */ protected Object readResolve() throws ObjectStreamException { if (this.intValue() == INFO.intValue()) { return INFO; } if (this.intValue() == STDERR.intValue()) { return STDERR; } throw new InvalidObjectException("Unknown instance :" + this); }
/** * The note class based on the API documentation (NOTE_CLASS_xxx). This includes deprecated and * virtual types. */ public static enum NoteClass { DOCUMENT(0x0001), DATA(DOCUMENT), INFO(0x0002), FORM(0x0004), VIEW(0x0008), ICON(0x0010), DESIGN(0x0020), ACL(0x0040), HELP_INDEX(0x0080), HELP(0x0100), FILTER(0x0200), FIELD(0x0400), REPLFORMULA(0x0800), PRIVATE(0x1000), DEFAULT(0x8000), NOTIFYDELETION(DEFAULT), ALL(0x7fff), ALLNONDATA(0x7ffe), NONE(0x000), SINGLE_INSTANCE( DESIGN.getValue() | ACL.getValue() | INFO.getValue() | ICON.getValue() | HELP_INDEX.getValue() | 0), HELPUSINGDOCUMENT(HELP_INDEX), HELPABOUTDOCUMENT(HELP), SHAREDFIELD(FORM); private final int value_; private final boolean alias_; private NoteClass(final int value) { value_ = value; alias_ = false; } private NoteClass(final NoteClass aliased) { value_ = aliased.getValue(); alias_ = true; } public int getValue() { return value_; } public boolean isAlias() { return alias_; } public boolean isDesign() { return this != DOCUMENT && this != DATA; } }
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; }