Advertisement
Guest User

Untitled

a guest
Jul 10th, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1.     public String getTest(int i, int current, int total)
  2.     {
  3.         String text = "";
  4.         try
  5.         {
  6.             if (i == 1)
  7.                 throw new IOException();
  8.             else if (i == 2)
  9.                 throw new SSLException("SSLEx");
  10.             else if (i == 3)
  11.                 throw new SocketException();
  12.             else
  13.                 text = "EVERYTHING GOOD";
  14.         }
  15.         catch (SSLException | SocketException re)
  16.         {
  17.             if (current < total)
  18.             {
  19.                 System.out.println("Recalling " + current);
  20.                 text = getTest(1, ++current, total);
  21.             }
  22.         }
  23.         catch (IOException ioe)
  24.         {
  25.             text = "HTTP ERROR";
  26.         }
  27.         catch (Exception e)
  28.         {
  29.             e.printStackTrace();
  30.         }
  31.  
  32.         return text;
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement