List of usage examples for java.io LineNumberReader LineNumberReader
public LineNumberReader(Reader in)
From source file:edu.stanford.muse.util.ThunderbirdUtils.java
/** returns a list of thunderbird accounts. each list is in turn a list of length exactly 4: account name, hostname, server type, user name *///w w w . j av a 2s . c o m public static List<List<String>> getThunderbirdAccounts() { try { List<List<String>> newResult = getThunderbirdAccountsNew(); if (newResult != null) return newResult; } catch (Exception e) { log.warn("unable to process thunderbird profile with new thunderbird parser"); Util.print_exception(e, log); } List<List<String>> result = new ArrayList<List<String>>(); try { String rootDir = ThunderbirdUtils.getThunderbirdProfileDir(); String prefs = rootDir + File.separator + "prefs.js"; File f = new File(prefs); if (!f.exists() || !f.canRead()) { EmailUtils.log.info("Thunderbird probably not installed: no prefs.js in directory: " + prefs); return result; } LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(prefs), "UTF-8")); // example fragment of input // user_pref("mail.server.server2.capability", 21520929); // user_pref("mail.server.server2.directory", "AAAAAAH0AAIAAQxNYWNpbnRvc2ggSEQAAAAAAAAAAAAAAAAAAADGqxmGSCsAAAAJi1ASeGVub24uc3RhbmZvcmQuZWR1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmLUcbnohEAAAAAAAAAAP////8AAAkgAAAAAAAAAAAAAAAAAAAACEltYXBNYWlsABAACAAAxqt79gAAABEACAAAxugEgQAAAAEAHAAJi1AACYsXAAmLFQAJiw8AB/mpAAf5qAAAkOcAAgBjTWFjaW50b3NoIEhEOlVzZXJzOmhhbmdhbDpMaWJyYXJ5OlRodW5kZXJiaXJkOlByb2ZpbGVzOjcyeHZzMXd3LmRlZmF1bHQ6SW1hcE1haWw6eGVub24uc3RhbmZvcmQuZWR1AAAOACYAEgB4AGUAbgBvAG4ALgBzAHQAYQBuAGYAbwByAGQALgBlAGQAdQAPABoADABNAGEAYwBpAG4AdABvAHMAaAAgAEgARAASAFZVc2Vycy9oYW5nYWwvTGlicmFyeS9UaHVuZGVyYmlyZC9Qcm9maWxlcy83Mnh2czF3dy5kZWZhdWx0L0ltYXBNYWlsL3hlbm9uLnN0YW5mb3JkLmVkdQATAAEvAAAVAAIADf//AAA="); // user_pref("mail.server.server2.directory-rel", "[ProfD]ImapMail/xenon.stanford.edu"); // user_pref("mail.server.server2.download_on_biff", true); // user_pref("mail.server.server2.hostname", "xenon.stanford.edu"); // user_pref("mail.server.server2.login_at_startup", true); // user_pref("mail.server.server2.max_cached_connections", 5); // user_pref("mail.server.server2.name", "Stanford CS"); // user_pref("mail.server.server2.namespace.other_users", "\"~\""); // user_pref("mail.server.server2.namespace.personal", "\"#mh/\",\"#mhinbox\",\"\""); // user_pref("mail.server.server2.namespace.public", "\"#public/\",\"#news.\",\"#ftp/\",\"#shared/\""); // user_pref("mail.server.server2.timeout", 29); // user_pref("mail.server.server2.type", "imap"); // user_pref("mail.server.server2.userName", "hangal"); // be careful not to match a ...hostname line or a ...namespace line with the .name pattern // // that's why we need an explicit dot before and a quote after the type of field in the pattern // note: there are 2 fields: hostname and realhostname - realhostname has precedence if it exists // see: http://forums.mozillazine.org/viewtopic.php?f=39&t=1697195 Pattern accountNamePat = Pattern.compile(".*\"mail.server.server.*\\.name\".*"); Pattern hostnamePat = Pattern.compile(".*\"mail.server.server.*\\.hostname\".*"); Pattern realHostnamePat = Pattern.compile(".*\"mail.server.server.*\\.realhostname\".*"); Pattern serverTypePat = Pattern.compile(".*\"mail.server.server.*\\.type\".*"); Pattern usernamePat = Pattern.compile(".*\"mail.server.server.*\\.userName\".*"); Pattern userRealNamePat = Pattern.compile(".*\"mail.identity.id.*\\.fullName\".*"); Pattern userEmailPat = Pattern.compile(".*\"mail.identity.id.*\\.useremail\".*"); Pattern directoryRelPat = Pattern.compile(".*\"mail.server.server.*\\.directory-rel\".*"); Pattern fccFolderPat = Pattern.compile(".*\"mail.identity.id.*\\.fcc_folder\".*"); Map<String, String> accountNameMap = new LinkedHashMap<String, String>(); Map<String, String> hostnameMap = new LinkedHashMap<String, String>(); Map<String, String> realHostnameMap = new LinkedHashMap<String, String>(); Map<String, String> serverTypeMap = new LinkedHashMap<String, String>(); Map<String, String> usernameMap = new LinkedHashMap<String, String>(); Map<String, String> userEmailMap = new LinkedHashMap<String, String>(); Map<String, String> userRealNameMap = new LinkedHashMap<String, String>(); Map<String, String> directoryRelMap = new LinkedHashMap<String, String>(); Map<String, String> fccFolderMap = new LinkedHashMap<String, String>(); while (true) { String line = lnr.readLine(); if (line == null) { lnr.close(); break; } if (accountNamePat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "server"); accountNameMap.put(pair.getFirst(), pair.getSecond()); } if (hostnamePat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "server"); hostnameMap.put(pair.getFirst(), pair.getSecond()); } if (realHostnamePat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "server"); realHostnameMap.put(pair.getFirst(), pair.getSecond()); } else if (serverTypePat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "server"); String serverType = pair.getSecond(); if ("imap".equals(serverType)) serverType = "imaps"; if ("pop".equals(serverType)) serverType = "pops"; serverTypeMap.put(pair.getFirst(), serverType); } else if (usernamePat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "server"); usernameMap.put(pair.getFirst(), pair.getSecond()); } else if (userEmailPat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "id"); userEmailMap.put(pair.getFirst(), pair.getSecond()); } else if (userRealNamePat.matcher(line).matches()) { Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "id"); userRealNameMap.put(pair.getFirst(), pair.getSecond()); } else if (directoryRelPat.matcher(line).matches()) { // for local folders the line is like user_pref("mail.server.server1.directory-rel", "[ProfD]../../../../../../tmp/tb"); // Convert [ProfD]../../../../../../tmp/tb to the correct path by replacing [ProfD] with the profile dir Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "server"); String directoryRel = pair.getSecond(); if (directoryRel != null) { if (directoryRel.startsWith("[ProfD]")) directoryRel = directoryRel.replace("[ProfD]", ThunderbirdUtils.getThunderbirdProfileDir() + File.separator); // we also have to correct the ../../ to \..\... for windows directoryRel = directoryRel.replaceAll("/", File.separator); directoryRelMap.put(pair.getFirst(), directoryRel); } } else if (fccFolderPat.matcher(line).matches()) { // the line looks like user_pref("mail.identity.id1.fcc_folder", "imap://hangal@xenon.stanford.edu/Sent"); Pair<String, String> pair = ThunderbirdUtils.parseLine(line, "id"); String fccFolderFull = pair.getSecond(); if (fccFolderFull != null) { // fccFolder imap://hangal@xenon.stanford.edu/Sent String fccFolder = fccFolderFull.replaceAll("[^/]*/+[^/]*/+(.*$)", "$1"); // skip the first 2 tokens, split by / if (!fccFolderFull.equals(fccFolder)) // only if not equal is it valid fccFolderMap.put(pair.getFirst(), fccFolder); } } } for (String key : serverTypeMap.keySet()) { String s = serverTypeMap.get(key).toLowerCase(); // we only know how to handle imap and pop and local folders // other things like smart folders, don't list. if (!s.startsWith("imap") && !s.startsWith("pop") && !"Local Folders".equals(accountNameMap.get(key))) continue; List<String> params = new ArrayList<String>(); params.add(accountNameMap.get(key)); String hostnameToUse = realHostnameMap.get(key); if (hostnameToUse == null) hostnameToUse = hostnameMap.get(key); params.add(hostnameToUse); params.add(serverTypeMap.get(key)); params.add(usernameMap.get(key)); params.add(userEmailMap.get(key)); params.add(userRealNameMap.get(key)); params.add(directoryRelMap.get(key)); params.add(fccFolderMap.get(key)); String str = "Tbird accountname=\"" + accountNameMap.get(key) + "\" " + "hostname=\"" + hostnameMap.get(key) + "\" " + "serverType=\"" + serverTypeMap.get(key) + "\" " + "username=\"" + usernameMap.get(key) + "\" " + "userEmail=\"" + userEmailMap.get(key) + "\" " + "userRealName=\"" + userRealNameMap.get(key) + "\" " + "directoryRel=\"" + directoryRelMap.get(key) + "\"" + "fccFolder=\"" + fccFolderMap.get(key) + "\""; EmailUtils.log.debug(str); // System.out.println(str); result.add(params); } lnr.close(); } catch (Exception e) { System.err.println("REAL WARNING: exception trying to read thunderbird prefs" + Util.stackTrace(e)); } return Collections.unmodifiableList(result); }
From source file:massbank.BatchSearchWorker.java
/** * Ytt@C???ieLXg`?j/* w ww . j ava2 s . com*/ * @param resultFile t@C * @param textFile YtpeLXgt@C */ private void createTextFile(File resultFile, File textFile) { NumberFormat nf = NumberFormat.getNumberInstance(); LineNumberReader in = null; PrintWriter out = null; try { in = new LineNumberReader(new FileReader(resultFile)); out = new PrintWriter(new BufferedWriter(new FileWriter(textFile))); // wb_?[?o String reqIonStr = "Both"; try { if (Integer.parseInt(this.ion) > 0) { reqIonStr = "Positive"; } else if (Integer.parseInt(this.ion) < 0) { reqIonStr = "Negative"; } } catch (NumberFormatException nfe) { nfe.printStackTrace(); } out.println("***** MassBank Batch Service Results *****"); out.println(); out.println("Request Date: " + this.time); out.println("# Instrument Type: " + this.inst); out.println("# MS Type: " + this.ms); out.println("# Ion Mode: " + reqIonStr); out.println(); out.println(); // ?o String line; long queryCnt = 0; boolean readName = false; boolean readHit = false; boolean readNum = false; boolean isFinalLine = false; while ((line = in.readLine()) != null) { line = line.trim(); isFinalLine = false; if (!readName) { queryCnt++; out.println("### Query " + nf.format(queryCnt) + " ###"); out.println("# Name: " + line); readName = true; } else if (!readHit) { int num = Integer.parseInt(line); if (num == -1) { out.println("[ERROR] Invalid query\n"); break; } out.println("# Hit: " + nf.format(num)); out.println(); readHit = true; } else if (!readNum) { out.println("Top " + line + " List"); out.println("Accession\tTitle\tFormula\tMass\tScore\tHit"); out.println(); readNum = true; } else { if (!line.equals("")) { String[] data = formatLine(line); StringBuilder sb = new StringBuilder(); sb.append(data[0]).append("\t").append(data[1]).append("\t").append(data[2]).append("\t") .append(data[3]).append("\t").append(data[4]).append("\t").append(data[5]); out.println(sb.toString()); } else { out.println(); out.println(); readName = false; readHit = false; readNum = false; isFinalLine = true; } } } if (!isFinalLine) { out.println(); out.println(); } out.println("***** END ********************************"); out.println(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (in != null) { in.close(); } } catch (IOException e) { } if (out != null) { out.flush(); out.close(); } } }
From source file:net.flamefeed.ftb.modpackupdater.FileOperator.java
/** * This method will download the hash-file from the server and * will extract data from it and populate the remoteHashes 2d array. * * @throws java.lang.IOException/*from w w w .ja va 2 s.c o m*/ */ private void parseHashfile() throws IOException { int numRemoteFiles; String[] currentLine; FileReader fr; BufferedReader br; LineNumberReader lnr; downloadFile(HASHFILE_NAME); /* * Compute the number of lines in the hash-file. This corresponds to the * number of files on the remote server, and therefore the length of the * hashFiles outer array. */ fr = new FileReader(pathMinecraft + "/" + HASHFILE_NAME); lnr = new LineNumberReader(fr); lnr.skip(Long.MAX_VALUE); numRemoteFiles = lnr.getLineNumber(); fr.close(); /* * Populate the remoteHashes[][] array with data from the hash file */ remoteHashes = new String[numRemoteFiles][2]; fr = new FileReader(pathMinecraft + "/" + HASHFILE_NAME); br = new BufferedReader(fr); /* * The hash-file format is as follows: * <MD5 hash><tab character><relative filename><newline character> * Splitting each line using a tab character "\t" separates the filename * from the MD5 hash. */ for (int i = 0; i < numRemoteFiles; i++) { currentLine = br.readLine().split("\t", 2); remoteHashes[i][MD5HASH] = currentLine[MD5HASH]; remoteHashes[i][FILENAME] = currentLine[FILENAME]; } fr.close(); }
From source file:org.fuin.owndeb.commons.DebUtils.java
/** * Returns the string as list.//from w w w.j a va2 s. c o m * * @param str * String to split into lines. * * @return List of lines. */ public static final List<String> asList(final String str) { try { final List<String> lines = new ArrayList<String>(); final LineNumberReader reader = new LineNumberReader(new StringReader(str)); String line; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; } catch (final IOException ex) { throw new RuntimeException("Error creating string list", ex); } }
From source file:org.mitre.opensextant.util.FileUtility.java
/** Deprecated: LineNumberReader is deprecated. * @param filepath /*from www. j a v a2 s . c o m*/ * @return * @throws FileNotFoundException * @throws IOException * @deprecated LineNumber reader is deprecated */ public static LineNumberReader getLineReader(String filepath) throws FileNotFoundException, IOException { return new LineNumberReader(new StringReader(FileUtility.readFile(filepath))); }
From source file:hobby.wei.c.phone.Network.java
public static String PING(String host, boolean format) { final int PACKAGES = 4; String info = null;/* w w w . j a va 2 s. co m*/ String print = null; Process process = null; LineNumberReader reader = null; try { final String CMD = "ping -c " + PACKAGES + " " + host; if (format) { info = "ping-c" + PACKAGES + "-" + host.replace('.', '_'); } else { print = CMD + "\n"; } process = Runtime.getRuntime().exec(CMD); reader = new LineNumberReader(new InputStreamReader(process.getInputStream())); String line = null; boolean start = false; int index = -1; while ((line = reader.readLine()) != null) { if (!format) { print += line + "\n"; } else { line = line.trim(); if (line.toLowerCase().startsWith("ping")) { line = line.substring(0, line.indexOf(')')); line = line.replace("(", ""); line = line.replace(' ', '-'); line = line.replace('.', '_'); start = true; } else if (start) { index = line.indexOf(':'); if (index > 0) { //?ttl=53 line = line.substring(index + 1).trim(); index = line.indexOf(' '); line = line.substring(index + 1, line.indexOf(' ', index + 3)).trim(); line = line.replace('=', '_'); start = false; } else { start = false; continue; } } else if (line.startsWith("" + PACKAGES)) { index = line.indexOf(','); line = line.substring(index + 1).trim(); line = line.substring(0, line.indexOf(' ')).trim(); line = line + "in" + PACKAGES + "received"; } else if (line.startsWith("rtt")) { line = line.replaceFirst(" ", "-"); line = line.replace(" ", ""); line = line.replace('/', '-'); line = line.replace('.', '_'); line = line.replace("=", "--"); } else { continue; } if (info == null) info = line; info += "--" + line; } } } catch (IOException e) { e.printStackTrace(); } finally { try { if (reader != null) reader.close(); if (process != null) process.destroy(); //?? } catch (IOException e) { //e.printStackTrace(); } } return format ? info : print; }
From source file:org.kalypso.dwd.DWDRasterHelper.java
public static DWDObservationRaster loadObservationRaster(final URL url, final int dwdKey) throws Exception { final double factor = getFactorForDwdKey(dwdKey); final double offset = getOffsetForDwdKey(dwdKey); final String unit = getUnitForDwdKey(dwdKey); LineNumberReader lineNumberReader = null; try {/*from w w w . j a v a 2 s .com*/ /* Create the reader. */ InputStream inputStream = IOUtilities.getInputStream(url); InputStreamReader inputStreamReader = new InputStreamReader(inputStream); lineNumberReader = new LineNumberReader(inputStreamReader); int lmVersion = 0; String line = null; DWDObservationRaster raster = null; long blockDate = -1; int cellpos = 0; boolean rightBlock = false; // Is only used by the dynamic header (lmVersion = 1) while ((line = lineNumberReader.readLine()) != null) { final Matcher dynamicHeaderMatcher = HEADER_DYNAMIC.matcher(line); if (dynamicHeaderMatcher.matches()) // lm1 { final Date startDate = DATEFORMAT_RASTER.parse(dynamicHeaderMatcher.group(1)); final Calendar startCal = Calendar.getInstance(); startCal.setTime(startDate); final int key = Integer.parseInt(dynamicHeaderMatcher.group(2)); final int hour = Integer.parseInt(dynamicHeaderMatcher.group(3)); startCal.add(Calendar.HOUR_OF_DAY, hour + 1); blockDate = startCal.getTimeInMillis(); if (key == dwdKey) { rightBlock = true; if (raster == null) // if not already loading raster = new DWDObservationRaster(key, unit); } else rightBlock = false; // wrong key, but reading the file must be continued, the key can appear again lmVersion = 1; cellpos = 0; continue; } final Matcher staticHeaderMatcher = HEADER_STATIC.matcher(line); if (staticHeaderMatcher.matches()) // lm2 ?? { // TODO: this is stil not the correct way to parse the date... // Google, how to do it correctly... blockDate = DATEFORMAT_RASTER.parse(staticHeaderMatcher.group(1)).getTime(); final int key = Integer.parseInt(staticHeaderMatcher.group(2)); if (key == dwdKey) raster = new DWDObservationRaster(key, unit); else if (raster != null) return raster; lmVersion = 2; cellpos = 0; continue; } if (raster == null) continue; /* If we are reading lmVersion = 1 and we have a wrong key, continue. */ if (lmVersion == 1 && rightBlock == false) continue; switch (lmVersion) { case 1: { final String[] values = readValues(line, 5); // Do not trim the line... for (final String value2 : values) { final double value = Double.parseDouble(value2); raster.setValueFor(new Date(blockDate), cellpos, (value + offset) * factor); cellpos++; } break; } case 2: { /* One line represents all 78 values for one position. */ final String[] values = readValues(line, 5); // Do not trim the line... final Calendar valueDate = Calendar.getInstance(); valueDate.setTimeInMillis(blockDate); for (final String valueStr : values) { valueDate.add(Calendar.HOUR_OF_DAY, 1); // starting with hour 1, so add first here! final double value = Double.parseDouble(valueStr); raster.setValueFor(valueDate.getTime(), cellpos, (value + offset) * factor); } cellpos++; break; } } } return raster; } finally { IOUtils.closeQuietly(lineNumberReader); } }
From source file:org.apache.hadoop.yarn.server.nodemanager.TestDockerContainerExecutorWithMocks.java
@Test //Test that a container launch correctly wrote the session script with the //commands we expected public void testContainerLaunch() throws IOException { String appSubmitter = "nobody"; String appSubmitterFolder = "nobodysFolder"; String appId = "APP_ID"; String containerId = "CONTAINER_ID"; String testImage = "\"sequenceiq/hadoop-docker:2.4.1\""; Container container = mock(Container.class, RETURNS_DEEP_STUBS); ContainerId cId = mock(ContainerId.class, RETURNS_DEEP_STUBS); ContainerLaunchContext context = mock(ContainerLaunchContext.class); HashMap<String, String> env = new HashMap<String, String>(); when(container.getContainerId()).thenReturn(cId); when(container.getLaunchContext()).thenReturn(context); when(cId.getApplicationAttemptId().getApplicationId().toString()).thenReturn(appId); when(cId.toString()).thenReturn(containerId); when(context.getEnvironment()).thenReturn(env); env.put(YarnConfiguration.NM_DOCKER_CONTAINER_EXECUTOR_IMAGE_NAME, testImage); Path scriptPath = new Path("file:///bin/echo"); Path tokensPath = new Path("file:///dev/null"); Path pidFile = new Path(workDir, "pid"); dockerContainerExecutor.activateContainer(cId, pidFile); int ret = dockerContainerExecutor.launchContainer(new ContainerStartContext.Builder() .setContainer(container).setNmPrivateContainerScriptPath(scriptPath) .setNmPrivateTokensPath(tokensPath).setUser(appSubmitter).setAppId(appId) .setContainerWorkDir(workDir).setLocalDirs(dirsHandler.getLocalDirs()) .setLogDirs(dirsHandler.getLogDirs()).setUserFolder(appSubmitterFolder).build()); assertEquals(0, ret);/*from w w w. j a va 2 s. c o m*/ //get the script Path sessionScriptPath = new Path(workDir, Shell.appendScriptExtension(DockerContainerExecutor.DOCKER_CONTAINER_EXECUTOR_SESSION_SCRIPT)); LineNumberReader lnr = new LineNumberReader(new FileReader(sessionScriptPath.toString())); boolean cmdFound = false; List<String> localDirs = dirsToMount(dirsHandler.getLocalDirs()); List<String> logDirs = dirsToMount(dirsHandler.getLogDirs()); List<String> workDirMount = dirsToMount(Collections.singletonList(workDir.toUri().getPath())); List<String> expectedCommands = new ArrayList<String>( Arrays.asList(DOCKER_LAUNCH_COMMAND, "run", "--rm", "--net=host", "--name", containerId)); expectedCommands.addAll(localDirs); expectedCommands.addAll(logDirs); expectedCommands.addAll(workDirMount); String shellScript = workDir + "/launch_container.sh"; expectedCommands .addAll(Arrays.asList(testImage.replaceAll("['\"]", ""), "bash", "\"" + shellScript + "\"")); String expectedPidString = "echo `/bin/true inspect --format {{.State.Pid}} " + containerId + "` > " + pidFile.toString() + ".tmp"; boolean pidSetterFound = false; while (lnr.ready()) { String line = lnr.readLine(); LOG.debug("line: " + line); if (line.startsWith(DOCKER_LAUNCH_COMMAND)) { List<String> command = new ArrayList<String>(); for (String s : line.split("\\s+")) { command.add(s.trim()); } assertEquals(expectedCommands, command); cmdFound = true; } else if (line.startsWith("echo")) { assertEquals(expectedPidString, line); pidSetterFound = true; } } assertTrue(cmdFound); assertTrue(pidSetterFound); }
From source file:com.fortmoon.utils.CSVDBLoader.java
public void resetReader() { try {//from ww w . j a v a 2 s.c om // lr.mark and lr.reset don't work for very large files (failed after 500000 lines) reader.close(); reader = new FileReader(file); lr = new LineNumberReader(reader); // reread the header row to skip. lr.readLine(); //lr.reset(); } catch (IOException e) { log.error("Exception resetting reader: " + e, e); } }
From source file:com.l2jfree.gameserver.handler.admincommands.AdminTeleport.java
private void delbookmark(String Name) { File file = new File(Config.DATAPACK_ROOT, "data/html/admin/tele/bookmark.txt"); LineNumberReader lnr = null;/* www . j a v a 2 s . co m*/ String bookmarks = ""; try { String line = null; lnr = new LineNumberReader(new FileReader(file)); while ((line = lnr.readLine()) != null) { StringTokenizer st = new StringTokenizer(line, ";"); String nm = st.nextToken(); if (!nm.equals(Name)) bookmarks += line + "\n"; } FileWriter save = new FileWriter(file); save.write(bookmarks); save.close(); } catch (FileNotFoundException e) { } catch (IOException e1) { e1.printStackTrace(); } finally { try { if (lnr != null) lnr.close(); } catch (Exception e2) { } } }