Example usage for org.apache.maven.plugin.logging Log warn

List of usage examples for org.apache.maven.plugin.logging Log warn

Introduction

In this page you can find the example usage for org.apache.maven.plugin.logging Log warn.

Prototype

void warn(CharSequence content, Throwable error);

Source Link

Document

Send a message (and accompanying exception) to the user in the warn error level.
The error's stacktrace will be output when this error level is enabled.

Usage

From source file:vitkin.sfdc.mojo.wsdl.WsdlDownloadlMojo.java

License:Apache License

/**
 * Display the content of the HTTP response.<br/>
 * <b>CAUTION:</b> Calling this method will consume the response content
 * InputStream!//from   ww  w .  j  av a  2s  .  co m
 *
 * @param response The HTTP response of which to display the content.
 */
private void debugResponse(final HttpResponse response) {
    final Log logger = getLog();

    logger.debug("Displaying content:");

    BufferedReader br = null;

    try {
        br = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));

        for (String line = br.readLine(); line != null; line = br.readLine()) {
            logger.debug(line);
        }
    } catch (IOException ex) {
        logger.error("Failed displaying content!", ex);
    } finally {
        if (br != null) {
            try {
                br.close();
            } catch (IOException ex) {
                logger.warn(ex.getMessage(), ex);
            }
        }
    }
}

From source file:vitkin.sfdc.mojo.wsdl.WsdlDownloadlMojo.java

License:Apache License

/**
 * Save the cookie store for the given Salesforce environment and current
 * username.//  w  w w  .  jav  a2s . c  o m
 *
 * @param env         Salesforce environment. Either 'sandbox' or 'dev-prod'.
 * @param cookieStore The cookie store to save.
 */
private void saveCookies(final String env, final CookieStore cookieStore) {
    final Log logger = getLog();
    final File cookieStorePath = new File(cookiesDirectory, env);

    if (!cookieStorePath.exists()) {
        cookieStorePath.mkdirs();
    }

    final File cookieStoreFile = new File(cookieStorePath, username + COOKIES_SUFFIX);

    logger.info("Saving cookies to '" + cookieStoreFile + "'...");

    ObjectOutputStream oos = null;

    try {
        oos = xstream.createObjectOutputStream(new BufferedOutputStream(new FileOutputStream(cookieStoreFile)));

        oos.writeObject(cookieStore);
    } catch (IOException ex) {
        logger.warn("Failed saving cookies from current run!", ex);
    } finally {
        if (oos != null) {
            try {
                oos.close();
            } catch (IOException ex) {
                logger.warn(ex.getMessage(), ex);
            }
        }
    }
}