public Version(String value) throws ParserException { this.value = value; int dot = value.indexOf('.'); if (dot == -1) { throw new ParserException("Malformed version: missing '.'"); } try { major = Integer.parseInt(value.substring(0, dot)); } catch (NumberFormatException e) { throw new ParserException("Malformed major version: " + e.getMessage(), e); } int dash = value.indexOf('-'); String minorValue; if (dash == -1) { minorValue = value.substring(dot+1); pkg = null; } else { minorValue = value.substring(dot+1, dash); pkg = value.substring(dash+1); } try { this.minor = Integer.parseInt(minorValue); } catch (NumberFormatException e) { throw new ParserException("Malformed minor version: " + e.getMessage(), e); } }
List<String> items = Splitter.on('=').limit(2).trimResults().splitToList(line.getValue()); if (items.size() != 2) { throw new ParserException("missing '='"); break; default: throw new ParserException("unknown key"); throw new ParserException("Problem with '" + key + "' line: " + e.getMessage()); LOG.warn("{}:{} {}", path.getFileName(), line.getLineNumber(), e.getMessage());
public void setSHA1FP0(String value) throws ParserException { checkMutable(); StringBuilder onlyHex = new StringBuilder(); for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (VALID_HEX.matches(c)) { onlyHex.append(c); } else if (c != ':') { throw new ParserException("Invalid character '" + c + "'"); } } try { IGTFInfo.this.sha1fp0 = new BigInteger(onlyHex.toString(), 16); } catch (NumberFormatException e) { throw new ParserException("Invalid value: " + e.getMessage(), e); } }
private void checkValid() throws ParserException { require(version != null, "version", POLICY, TRUST_ANCHOR); require(!dns.isEmpty(), "subjectdn", POLICY, TRUST_ANCHOR); require(!policyRequires.isEmpty(), "requires", POLICY); require(alias != null, "alias", TRUST_ANCHOR); require(crlUrl != null, "crl_url", TRUST_ANCHOR); require(email != null, "email", TRUST_ANCHOR); require(status != null, "status", TRUST_ANCHOR); if (problems != null) { String description = problems.size() == 1 ? problems.get(0) : problems.toString(); throw new ParserException("bad info file: " + description); } }
public void setCRLUrl(String urlList) throws ParserException { checkMutable(); try { ImmutableList.Builder<URI> urls = ImmutableList.builder(); for (String url : Splitter.on(';').trimResults().split(urlList)) { urls.add(new URI(url)); } IGTFInfo.this.crlUrl = urls.build(); } catch (URISyntaxException e) { throw new ParserException(e); } }
public void setUrl(String url) throws ParserException { checkMutable(); try { IGTFInfo.this.url = new URI(url); } catch (URISyntaxException e) { throw new ParserException(e); } }
public void setEmail(String address) throws ParserException { checkMutable(); try { IGTFInfo.this.email = new URI("mailto:" + address); } catch (URISyntaxException e) { throw new ParserException(e); } }
public void setPolicyUrl(String url) throws ParserException { checkMutable(); try { IGTFInfo.this.policyUrl = new URI(url); } catch (URISyntaxException e) { throw new ParserException(e); } }
public void setCAUrl(String url) throws ParserException { checkMutable(); try { IGTFInfo.this.caUrl = new URI(url); } catch (URISyntaxException e) { throw new ParserException(e); } }
public static void checkValid(boolean isOK, String message) throws ParserException { if (!isOK) { throw new ParserException(message); } } }
public void setStatus(String status) throws ParserException { checkMutable(); IGTFInfo.this.status = TO_STATUS.get(status); if (IGTFInfo.this.status == null) { throw new ParserException("Unknown value '" + status + "'"); } }