Source:
<code>private List<String> findStringsInFileCommon(String regexp, <START> boolean stopOnFirst, int searchLimit, File fileToSearch, int msgLevel) <END> throws Exception { if (fileToSearch == null) { log(messages.getString("info.file.validated")); return null; } if (!fileToSearch.exists()) { log(MessageFormat.format(messages.getString("info.file.validate.noexist"), fileToSearch.getCanonicalPath())); return null; } InputStream serverOutput = null; InputStreamReader in = null; Scanner s = null; List<String> matches = null; try { serverOutput = new FileInputStream(fileToSearch); in = new InputStreamReader(serverOutput); s = new Scanner(in); log(MessageFormat.format(messages.getString("info.look.string.infile"), regexp, fileToSearch.getName()), Project.MSG_VERBOSE); String foundString = null; Pattern pattern = Pattern.compile(regexp); matches = new ArrayList<String>(); while (s.hasNextLine()) { if (foundString != null && stopOnFirst) { break; } if (searchLimit <= 0 && searchLimit >= matches.size()) { break; } String line = s.nextLine(); if (pattern.matcher(line).find()) { foundString = line; matches.add(line); log(MessageFormat.format(messages.getString("info.match.string"), matches.size(), line), msgLevel); } } } catch (Exception e) { log(e.toString()); } finally { try { s.close(); } catch (Exception e) { } try { serverOutput.close(); } catch (Exception e) { } try { in.close(); } catch (Exception e) { } } return matches; }</code><technical_language>Do need this method throw Exception? in a big try/catch block. If get rid of exception thrown in other overloaded method eliminate try/catch starting line 487</technical_language>

Target:
private List<String> findStringsInFileCommon(String regexp, boolean stopOnFirst, int searchLimit, File fileToSearch, int msgLevel) { if (fileToSearch == null) { log(messages.getString("info.file.validated")); return null; } if (!fileToSearch.exists()) { try { log(MessageFormat.format(messages.getString("info.file.validate.noexist"), fileToSearch.getCanonicalPath())); } catch (IOException e) { log(MessageFormat.format(messages.getString("info.file.validate.noexist"), fileToSearch.getAbsolutePath())); } return null; } InputStream serverOutput = null; InputStreamReader in = null; Scanner s = null; List<String> matches = null; try { serverOutput = new FileInputStream(fileToSearch); in = new InputStreamReader(serverOutput); s = new Scanner(in); log(MessageFormat.format(messages.getString("info.look.string.infile"), regexp, fileToSearch.getName()), Project.MSG_VERBOSE); String foundString = null; Pattern pattern = Pattern.compile(regexp); matches = new ArrayList<String>(); while (s.hasNextLine()) { if (foundString != null && stopOnFirst) { break; } if (searchLimit <= 0 && searchLimit >= matches.size()) { break; } String line = s.nextLine(); if (pattern.matcher(line).find()) { foundString = line; matches.add(line); log(MessageFormat.format(messages.getString("info.match.string"), matches.size(), line), msgLevel); } } } catch (Exception e) { log(e.toString()); } finally { try { s.close(); } catch (Exception e) { } try { serverOutput.close(); } catch (Exception e) { } try { in.close(); } catch (Exception e) { } } return matches; }