
Result:
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
throw new HttpException(404, "not found jeje");
}
package exceptions;
public class RuntimeExceptionTest {
public class TestException extends Exception {
}
public static void main(String[] args) {
RuntimeExceptionTest test = new RuntimeExceptionTest();
try {
test.throwWrappedTestExceptionAsRuntimeException();
} catch (Exception e) {
System.out.println("exception catched:\n");
e.printStackTrace();
}
}
private void throwTestException() throws TestException {
throw new TestException();
}
public void throwWrappedTestExceptionAsRuntimeException() {
try {
throwTestException();
} catch (TestException e) {
throw new RuntimeException(e);
}
}
}
Location location = tracker.getCurrentLocation();
for (Filter filter : filters) {
filter. selectFor(location);
if (logger. isInfoEnabled()) {
logger. info("Filter " + filter.getName() + ", " + filter.getDate()
+ " selected for " + location.getName()
+ ", is current: " + tracker.isCurrent(location));
}
}
Otros beneficios:
Location location = tracker.getCurrentLocation();
for (Filter filter : filters) {
filter. selectFor(location);
support.notifyFiltering(tracker, location, filter);
}