Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public void checkForHTTPException(Throwable throwable) {
  2. String msg = throwable.getMessage();
  3. boolean result = msg.contains(ERROR_HTTP_RESPONSE_401_UNAUTHORIZED_WHEN_COMMUNICATING);
  4. if (result) {
  5. throw new VaadinUIException(throwable.getMessage());
  6. } else {
  7. Throwable level1 = throwable.getCause();
  8. msg = level1.getMessage();
  9. result = msg.contains(ERROR_HTTP_RESPONSE_401_UNAUTHORIZED_WHEN_COMMUNICATING);
  10. if (result) {
  11. throw new VaadinUIException(level1.getMessage());
  12. } else {
  13. Throwable level2 = throwable.getCause();
  14. msg = level2.getMessage();
  15. result = msg.contains(ERROR_HTTP_RESPONSE_401_UNAUTHORIZED_WHEN_COMMUNICATING);
  16. if (result) {
  17. throw new VaadinUIException(level2.getMessage());
  18. } else {
  19. System.out.println("doh");
  20. }
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement