Java Array From toArray(final Throwable throwable)

Here you can find the source of toArray(final Throwable throwable)

Description

Returns an string array representation of the specified throwable.

License

BSD License

Parameter

Parameter Description
throwable throwable

Return

string array

Declaration

private static String[] toArray(final Throwable throwable) 

Method Source Code

//package com.java2s;
/**/*from   w ww. java  2  s.co  m*/
 * This class contains static methods, which are used throughout the project.
 * The methods are used for dumping error output, debugging information,
 * getting the application path, etc.
 *
 * @author BaseX Team 2005-17, BSD License
 * @author Christian Gruen
 */

public class Main {
    /**
     * Returns an string array representation of the specified throwable.
     * @param throwable throwable
     * @return string array
     */
    private static String[] toArray(final Throwable throwable) {
        final StackTraceElement[] st = throwable.getStackTrace();
        final int sl = st.length;
        final String[] obj = new String[sl + 1];
        obj[0] = throwable.toString();
        for (int s = 0; s < sl; s++)
            obj[s + 1] = "\tat " + st[s];
        return obj;
    }
}

Related

  1. toArray(final int ip)
  2. ToArray(final Object... toSmashIntoArray)
  3. toArray(final String[] strings)
  4. toArray(final T... array)
  5. toArray(final T... items)
  6. toArray(float[] floatArray)
  7. toArray(int arg1)
  8. toArray(int time)
  9. toArray(int value)