@Test public void testMap() { assertEquals("Error", new DefaultExceptionMappingService().map(new NullPointerException()).getMessage()); assertEquals("Unknown application error.", new DefaultExceptionMappingService().map(new NullPointerException()).getDetail()); assertEquals("Unknown application error. R.", new DefaultExceptionMappingService().map(new NullPointerException("r")).getDetail()); }
@Override public BackgroundException map(final Throwable failure) { final StringBuilder buffer = new StringBuilder(); if(failure instanceof RuntimeException) { this.append(buffer, LocaleFactory.localizedString("Unknown application error")); } this.append(buffer, failure.getMessage()); for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) { this.append(buffer, cause.getMessage()); } } return this.wrap(failure, LocaleFactory.localizedString("Error", "Error"), buffer); }
DefaultExceptionMappingService extends AbstractExceptionMappingService<Throwable> { @Override public BackgroundException map(final Throwable failure) { final StringBuilder buffer = new StringBuilder(); if(failure instanceof RuntimeException) { this.append(buffer, LocaleFactory.localizedString("Unknown application error")); } this.append(buffer, failure.getMessage()); for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) { this.append(buffer, cause.getMessage()); } } return this.wrap(failure, LocaleFactory.localizedString("Error", "Error"), buffer); } }
DefaultExceptionMappingService extends AbstractExceptionMappingService<Throwable> { @Override public BackgroundException map(final Throwable failure) { final StringBuilder buffer = new StringBuilder(); if(failure instanceof RuntimeException) { this.append(buffer, LocaleFactory.localizedString("Unknown application error")); } this.append(buffer, failure.getMessage()); for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) { this.append(buffer, cause.getMessage()); } } return this.wrap(failure, LocaleFactory.localizedString("Error", "Error"), buffer); }  }
DefaultExceptionMappingService extends AbstractExceptionMappingService<Throwable> { @Override public BackgroundException map(final Throwable failure) { final StringBuilder buffer = new StringBuilder(); if(failure instanceof RuntimeException) { this.append(buffer, LocaleFactory.localizedString("Unknown application error")); } this.append(buffer, failure.getMessage()); for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) { this.append(buffer, cause.getMessage()); } } return this.wrap(failure, LocaleFactory.localizedString("Error", "Error"), buffer); }  @Override BackgroundException map(final Throwable failure); }
DefaultExceptionMappingService extends AbstractExceptionMappingService<Throwable> { @Override public BackgroundException map(final Throwable failure) { final StringBuilder buffer = new StringBuilder(); if(failure instanceof RuntimeException) { this.append(buffer, LocaleFactory.localizedString("Unknown application error")); } this.append(buffer, failure.getMessage()); for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(!StringUtils.contains(failure.getMessage(), cause.getMessage())) { this.append(buffer, cause.getMessage()); } } return this.wrap(failure, LocaleFactory.localizedString("Error", "Error"), buffer); }  @Override BackgroundException map(final Throwable failure);  }