public static ExceptionReportType exceptionReport( ServiceException exception, boolean verboseExceptions, String version) { ExceptionType e = f.createExceptionType(); if (exception.getCode() != null) { e.setExceptionCode(exception.getCode()); } else { // set a default e.setExceptionCode("NoApplicableCode"); } e.setLocator(exception.getLocator()); // add the message StringBuffer sb = new StringBuffer(); OwsUtils.dumpExceptionMessages(exception, sb, true); e.getExceptionText().add(sb.toString()); e.getExceptionText().addAll(exception.getExceptionText()); if (verboseExceptions) { // add the entire stack trace // exception. e.getExceptionText().add("Details:"); ByteArrayOutputStream trace = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(trace)); e.getExceptionText().add(new String(trace.toByteArray())); } ExceptionReportType report = f.createExceptionReportType(); version = version != null ? version : "1.1.0"; report.setVersion(version); report.getException().add(e); return report; }
for (net.opengis.ows11.ExceptionType ex : exceptions) { @SuppressWarnings("unchecked") List<String> texts = ex.getExceptionText(); result.addExceptionDetails(ex.getExceptionCode(), ex.getLocator(), texts);
e.getExceptionText().add(sb.toString()); e.getExceptionText().addAll(exception.getExceptionText()); e.getExceptionText().add("Details:"); ByteArrayOutputStream trace = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(trace)); e.getExceptionText().add(new String(trace.toByteArray()));
for (net.opengis.ows11.ExceptionType ex : exceptions) { @SuppressWarnings("unchecked") List<String> texts = ex.getExceptionText(); result.addExceptionDetails(ex.getExceptionCode(), ex.getLocator(), texts);