private DatabaseException cleanupStack(DatabaseException e) { List<StackTraceElement> kept = new ArrayList<StackTraceElement>(); for (StackTraceElement elem : e.getStackTrace()) { if (elem.getClassName().contains("RandomEvent") || elem.getClassName().contains("DB$1")) { kept.add( new StackTraceElement( "enterprise.solution.Connector$1", "execute", "Connector.java", 28340)); kept.add(new StackTraceElement("enterprise.solution.Connection$1", "process", null, -1)); kept.add( new StackTraceElement( "enterprise.solution.driver.TLTPro", "evaluate", "TLTPro.java", 318)); kept.add( new StackTraceElement("enterprise.solution.driver.TLTProAgain", "execute", null, -1)); kept.add( new StackTraceElement( "enterprise.framework.ProcessorManagerServiceImpl", "execute", null, -1)); kept.add(new StackTraceElement("enterprise.solution.A", "sorry", null, -1)); continue; } kept.add(elem); } e.setStackTrace(kept.toArray(new StackTraceElement[kept.size()])); return e; }