title: What is the best way to force a try block to break in between?
body: <p>I have a <code>try</code>-<code>catch</code> block that I wish to <code>break</code> like a <code>switch</code> block but I couldn't find a recommended way of doing it. I'm fetching a lot of data in the <code>try</code>-<code>catch</code> block and wish to stop the fetching in between in case a certain condition is met. Just to get it working for now, I've deliberately forced the code to go into the <code>catch</code> block:</p>
  
  <pre><code>int i=0;
      try {
          //--do stuff----
          if(//-------is condition met?--------//)
              i = 1/0; // divide 1 by 0 -- a definite exception
      }
      catch (Exception e) {//---------do nothing---------//}
  </code></pre>
  
  <p>Is it safe to do this or should I go for another way?</p>
  
  <p>EDIT:I'm fetching some xml data(actually, a lot). Depending on the internet connection, I need to stop the parsing after sometime(time-out) rather than go through the entire stream. I go through loops but I also make some calculations later. It doesn't make any sense to calculate with incomplete data, so I would prefer to just skip the whole thing.</p>