public Email()

in src/main/java/org/apache/sling/cli/impl/mail/Email.java [49:71]


    public Email(String id) {
        this.id = id;
        try (CloseableHttpClient client = HttpClients.createDefault()) {
            URI uri = new URIBuilder("https://lists.apache.org/api/source.lua/" + URLEncoder.encode(id, StandardCharsets.UTF_8)).build();
            HttpGet get = new HttpGet(uri);
            try (CloseableHttpResponse response = client.execute(get)) {
                try (InputStream content = response.getEntity().getContent()) {
                    if (response.getStatusLine().getStatusCode() != 200) {
                        throw new IOException("Status line : " + response.getStatusLine());
                    }
                    MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()), content);
                    subject = message.getSubject();
                    Address[] who = message.getFrom();
                    if (who.length > 0) {
                        from = (InternetAddress) who[0];
                    }
                    body = getContent(message);
                }
            }
        } catch (URISyntaxException | IOException | MessagingException e) {
            throw new IllegalArgumentException(e);
        }
    }