Java Exception to String exception_details(Exception e)

Here you can find the source of exception_details(Exception e)

Description

exceptiodetails

License

Open Source License

Parameter

Parameter Description
e a parameter

Declaration

public static String exception_details(Exception e) 

Method Source Code

//package com.java2s;
/*/*from   w  ww  .  java2 s  .c  o  m*/
 * This code is subject to the HIEOS License, Version 1.0
 *
 * Copyright(c) 2008-2009 Vangent, Inc.  All rights reserved.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    /**
     *
     * @param e
     * @return
     */
    public static String exception_details(Exception e) {
        /*
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(baos);
        e.printStackTrace(ps); */
        e.printStackTrace();
        return "Exception thrown: " + e.getClass().getName() + " : " + e.getMessage();
        //return "Exception thrown: " + e.getClass().getName() + "\n" + e.getMessage() + "\n" + new String(baos.toByteArray());
    }
}

Related

  1. exception2string(Throwable exception)
  2. exception2StringShort(Exception e)
  3. exception_details(Exception e, String message)
  4. exceptionFormat(E exception)
  5. exceptionStackToString(Throwable x)
  6. exceptionToString(final Exception e)