// Using try/catch to recover from a bad command-line parameter. private void parseCommands () { boolean fileFound = false; // Second pass: look for source file names. for (int i = 0; i < argv.length; i = i + 1) { if (argv[i] != null) { String src = argv[i]; int n = src.length(); if ((n > 2) && src.substring (n - 2, n) . equals (".q")) { fileFound = true; try { String dst = src.substring (0, n - 1) . concat ("lap"); FileInputStream fin = new FileInputStream (src); FileOutputStream fout = new FileOutputStream (dst); compileFile (fin, fout); } catch (FileNotFoundException e) { System.err.println (src + " not found."); } } else System.err.println ("Ignoring command-line argument: " + argv[i]); } } if (! fileFound) compileStandardInput (); }