All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.metamodel.commons.exceptions.ExceptionHelper Maven / Gradle / Ivy

The newest version!
package org.nakedobjects.metamodel.commons.exceptions;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;


public class ExceptionHelper {

    public static String exceptionTraceAsString(final Throwable exception) {
        ByteArrayOutputStream baos = null;
        try {
            baos = new ByteArrayOutputStream();
            exception.printStackTrace(new PrintStream(baos));
            return baos.toString();
        } finally {
            if (baos != null) {
                try {
                    baos.close();
                } catch (final IOException ignore) {}
            }
        }
    }
}
// Copyright (c) Naked Objects Group Ltd.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy