Example usage for java.awt.datatransfer MimeTypeParseException printStackTrace

List of usage examples for java.awt.datatransfer MimeTypeParseException printStackTrace

Introduction

In this page you can find the example usage for java.awt.datatransfer MimeTypeParseException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:nz.net.kallisti.emusicj.download.HTTPDownloader.java

/**
 * Loads the downloader state from the provided element
 * // w  w w.j  a  v a  2  s.co  m
 * @param el
 *            the element to load from
 * @throws MalformedURLException
 *             if the URL in the XML is wrong or missing
 */
public void setDownloader(Element el) throws MalformedURLException {
    String tUrl = el.getAttribute("url");
    if (!"".equals(tUrl))
        url = new URL(tUrl);
    else
        throw new MalformedURLException("Missing URL");
    String tFname = el.getAttribute("outputfile");
    if (!"".equals(tFname))
        outputFile = new File(tFname);
    else
        throw new MalformedURLException("Missing output filename");
    createMonitor();
    setState(DLState.NOTSTARTED);
    String tOut = el.getAttribute("outputfile");
    if (!"".equals(tOut))
        outputFile = new File(tOut);
    String tMime = el.getAttribute("mimetype");
    if (!"".equals(tMime)) {
        try {
            String[] parts = tMime.split(",");
            mimeType = new IMimeType[parts.length];
            for (int i = 0; i < parts.length; i++)
                mimeType[i] = new MimeType(parts[i]);
        } catch (MimeTypeParseException e) {
            e.printStackTrace();
        }
    }
    String tExpiry = el.getAttribute("expiry");
    if (!"".equals(tExpiry)) {
        try {
            expiry = new Date(Long.parseLong(tExpiry));
        } catch (NumberFormatException e) {
            logger.warning("Invalid expiry value in state file (" + tExpiry + ") - ignoring");
        }
    }
    // This should come last to ensure everything is set up before we risk
    // executing start()
    String tState = el.getAttribute("state");
    if (!"".equals(tState)) {
        if (tState.equals("CONNECTING") || tState.equals("DOWNLOADING")) {
            setState(DLState.CONNECTING);
            start();
        } else if (tState.equals("STOPPED") || tState.equals("CANCELLED")) {
            // in v.0.14-svn, STOPPED became CANCELLED. This double-check is
            // for backwards compatability
            setState(DLState.CANCELLED);
        } else if (tState.equals("PAUSED")) {
            setState(DLState.PAUSED);
        } else if (tState.equals("FINISHED")) {
            setState(DLState.FINISHED);
        } else if (tState.equals("EXPIRED")) {
            setState(DLState.EXPIRED);
        }
    }
    hasExpired();
}