Guest User

Untitled

a guest
Jan 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. try {
  2. //some code here for service call
  3. }catch(SocketTimeoutException e)
  4. {
  5. //not able to come here even though cause of the PrivilegedActionException is SocketTimeoutException
  6. }
  7. catch(Exception e)
  8. {
  9. //directly coming here OF COURSE
  10. }
  11.  
  12. java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed
  13. com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed
  14.  
  15. try{
  16.  
  17. }catch(PrivilegedActionException e){
  18. Throwable tmp = e;
  19. while(tmp != null){
  20. if(tmp instanceof SocketTimeoutException){
  21. SocketTimeoutException cause = (SocketTimeoutException) tmp;
  22. //Do what you need to do here.
  23. break;
  24. }
  25. tmp = tmp.getCause();
  26. }
  27. }
  28.  
  29. catch(Exception e){
  30. if(e instanceof PrivilegedActionException){
  31. //while loop here
  32. }
  33. }
Add Comment
Please, Sign In to add comment