title: throw exception without breaking loop in java
body: <p>I need to handle custom exception in java inside loop so i am throwing new custom exception but it breaks the loop. How we can manage to throw loop without breaking loop. Here is my code</p>
  
  <pre><code>    for (int i = 0; i &lt; j; i++) {
          File currFile = arrayOfFile1[i];
          if (currFile.isFile()) {
              if (currFile.exists()) {
                  try {
                      String fileName = currFile.getName();
                      if (fileName.startsWith("~$")) {
                          continue;
                      } else {
                          if ((fileName.endsWith(".xlsx")) || (fileName.endsWith(".xls"))) {
                              if (fileName.endsWith("_arch.xlsx") || fileName.endsWith("_arch.xls")) {
                                  continue;
                              }
                              try {
                                  IDSOutputGenerator.generateOutput(currFile.getAbsolutePath(), "", outputType,
                                          false);
                              } catch (CheckErrorHandle e) {
                                  throw new CheckErrorHandle();
                              }
                          }
                          else if (fileName.endsWith(".xml")) {
                              try {
                                  IDSOutputGenerator.generateOutput(currFile.getAbsolutePath(), "", outputType,
                                          false);
                              } catch (CheckErrorHandle e) {
                                  throw new CheckErrorHandle();
                              }
  
                          } else {
                              throw new CheckErrorHandle(currFile.getAbsolutePath(), "File type not supported");
                          }
                      }
                  } catch (CheckErrorHandle e) {
                      throw new CheckErrorHandle();
                  } catch (Exception e) {
                      throw new CheckErrorHandle("", e.getMessage());
                  }
              } else {
                  throw new CheckErrorHandle(currFile.getAbsolutePath(), "File does not exist");
              }
          }
      }
  </code></pre>