Example usage for java.lang Exception toString

List of usage examples for java.lang Exception toString

Introduction

In this page you can find the example usage for java.lang Exception toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:HttpClient.EasySSLProtocolSocketFactory.java

private static SSLContext createEasySSLContext() {
    try {/*from  www  .  j av a 2 s. c om*/
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { (TrustManager) new EasyX509TrustManager(null) }, null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}

From source file:com.fatwire.dta.sscrawler.EasySSLProtocolSocketFactory.java

private static SSLContext createEasySSLContext() {
    try {/*  w ww. jav  a2  s .  com*/
        final SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null);
        return context;
    } catch (final Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}

From source file:Main.java

/**
 * Pass an exception to get back the stack trace
 * @param pException//  www.  j a v  a  2 s.c  om
 * @return stackTrace
 */
public static String getStackTrace(Exception pException) {
    if (pException != null) {
        final StringBuilder strBuilder = new StringBuilder("Cause of error: ");
        strBuilder.append(pException.getMessage());
        strBuilder.append("\n");
        strBuilder.append(pException.toString());
        strBuilder.append("\n");
        final StackTraceElement[] elementArray = pException.getStackTrace();
        for (final StackTraceElement element : elementArray) {
            strBuilder.append(element.toString());
            strBuilder.append("\n");
        }
        return strBuilder.toString();
    } else {
        return null;
    }
}

From source file:eu.planets_project.tb.gui.backing.UploadManager.java

/**
 * Triggers the page's file upload element, takes the selected data and 
 * transfers it into the Testbed's file repository. The reference to this file
 * is layed into the system's application map.
 * @return: Returns an instance of the FileUploadBean (e.g. for additional operations as .getEntryName, etc.)
 * if the operation was successful or null if an error occured
 */// w  w  w . j a va  2  s .c  o  m
public static FileUploadBean uploadFile(boolean keep) {
    FileUploadBean file_upload = getCurrentFileUploadBean();
    try {
        //trigger the upload command
        String result = file_upload.upload(keep);
        log.info("Got result: " + result);

        if (!result.equals("success-upload")) {
            return null;
        }
    } catch (Exception e) {
        //In this case an error occured ("error-upload"): just reload the page without adding any information
        log.error("error uploading file to Testbed's input folder: " + e.toString());
        e.printStackTrace();
        return null;
    }

    return file_upload;
}

From source file:jlib.xml.XMLUtil.java

public static Document LoadXML(Source file) {
    try {//from w w w.  ja v a 2 s  .  c o m
        DocumentBuilderFactory dbf = DocumentBuilderFactoryImpl.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.newDocument();
        Result res = new DOMResult(doc);
        TransformerFactory tr = TransformerFactory.newInstance();
        Transformer xformer = tr.newTransformer();
        xformer.transform(file, res);

        return doc;
    } catch (Exception e) {
        String csError = e.toString();
        Log.logImportant(csError);
        Log.logImportant("ERROR while loading XML " + file.toString());
    }
    return null;
}

From source file:jlib.xml.XMLUtil.java

public static Document loadXML(ByteArrayInputStream byteArrayInputStream) {
    try {/*w w  w.  jav a  2  s . c  o  m*/
        StreamSource streamSource = new StreamSource(byteArrayInputStream);
        DocumentBuilderFactory dbf = DocumentBuilderFactoryImpl.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document doc = db.newDocument();
        Result res = new DOMResult(doc);
        TransformerFactory tr = TransformerFactory.newInstance();
        Transformer xformer = tr.newTransformer();
        xformer.transform(streamSource, res);

        return doc;
    } catch (Exception e) {
        String csError = e.toString();
        Log.logImportant(csError);
        Log.logImportant(
                "ERROR while loading XML from byteArrayInputStream " + byteArrayInputStream.toString());
    }
    return null;
}

From source file:au.edu.monash.merc.capture.util.httpclient.ssl.EasyIgnoreSSLProtocolSocketFactory.java

private static SSLContext createEasySSLContext() {
    try {/*ww w. ja  v a 2 s.  c om*/
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { (TrustManager) new DefaultEasyX509TrustManager() },
                new SecureRandom());
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}

From source file:au.edu.monash.merc.capture.util.httpclient.ssl.EasySSLProtocolSocketFactory.java

private static SSLContext createEasySSLContext() {
    try {/*from  w w w.  j ava2 s  . c  o m*/
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { (TrustManager) new EasyX509TrustManager(null) },
                new SecureRandom());
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}

From source file:com.stimulus.archiva.domain.Settings.java

public static void saveProperties(final String name, String intro, Settings prop, String charset)
        throws ConfigurationException {
    File f = null;/*  w  w  w  . ja  va2 s .com*/
    try {
        // if the disk is full we dont want to end up in a situation where we delete
        // server.conf file
        f = File.createTempFile("server_conf", ".tmp");
        prop.store(intro, new FileOutputStream(f), charset);

    } catch (Exception e) {
        if (f != null)
            f.delete();
        throw new ConfigurationException("failed to save properties. cause:" + e.toString(), e, logger);
    }
    File newFile = new File(name);
    newFile.delete();
    //Mod start Seolhwa.kim 2017-04-13
    //f.renameTo(newFile);

    try {
        logger.debug("####################################### Call Files.move");
        Files.move(Paths.get(f.getAbsolutePath()), Paths.get(newFile.getAbsolutePath()),
                StandardCopyOption.REPLACE_EXISTING);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        logger.debug("####################################### Call Files.move fails");
        e.printStackTrace();
    }

    //Mod end Seolhwa.kim 2017-04-13
}

From source file:com.keybox.manage.db.ProfileDB.java

/**
 * returns profile based on id/*from w  ww  . j av  a 2  s  .c o m*/
 *
 * @param profileId profile id
 * @return profile
 */
public static Profile getProfile(Long profileId) {

    Profile profile = null;
    Connection con = null;
    try {
        con = DBUtils.getConn();
        profile = getProfile(con, profileId);
    } catch (Exception e) {
        log.error(e.toString(), e);
    } finally {
        DBUtils.closeConn(con);
    }

    return profile;
}