Java tutorial
//package com.java2s; /* * %W% %E% * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { private static String formatStackTraceElement(StackTraceElement ste) { return compressClassName(ste.getClassName()) + "." + ste.getMethodName() + (ste.isNativeMethod() ? "(Native Method)" : (ste.getFileName() != null && ste.getLineNumber() >= 0 ? "(" + ste.getFileName() + ":" + ste.getLineNumber() + ")" : (ste.getFileName() != null ? "(" + ste.getFileName() + ")" : "(Unknown Source)"))); } private static String compressClassName(String name) { // Note that this must end in . in order to be renamed correctly. String prefix = "com.sun.corba.se."; if (name.startsWith(prefix)) { return "(ORB)." + name.substring(prefix.length()); } else return name; } }