#fixed code
                             public void run() {
		while (true) {
			try {
				String command = reader.readLine().trim().toLowerCase();
				if (command.equals("t")) {
					printStacktrace();
				} else if (command.equals("d")) {
					changeDisplayMode();
				} else if (command.equals("q")) {
					app.exit();
					return;
				} else if (command.equalsIgnoreCase("h") || command.equalsIgnoreCase("help")) {
					printHelp();
				} else if (command.equals("")) {
				} else {
					tty.println("Unkown command: " + command);
					printHelp();
				}

				tty.print(" Input command (h for help):");
			} catch (Exception e) {
				e.printStackTrace(tty);
			}
		}
	}
#vulnerable code 
                             public void run() {
		while (true) {
			try {
				String command = new BufferedReader(new InputStreamReader(System.in)).readLine().trim();
				if (command.equals("t")) {
					vjtop.setNeedForFurtherInput(true);
					System.err.print(" Input TID for stack:");
					String pidStr = new BufferedReader(new InputStreamReader(System.in)).readLine();
					try {
						long pid = Long.parseLong(pidStr);
						view.printStack(pid);
					} catch (NumberFormatException e) {
						System.err.println(" Wrong number format");
					}
					//block the flush to let user see the result
					Utils.sleep(10000);
					vjtop.setNeedForFurtherInput(false);
				} else if (command.equals("d")) {
					vjtop.setNeedForFurtherInput(true);
					System.err.print(
							" Input number of Display Mode(1.cpu, 2.syscpu 3.total cpu 4.total syscpu 5.memory 6.total memory): ");
					String mode = new BufferedReader(new InputStreamReader(System.in)).readLine();
					switch (mode) {
						case "1":
							view.setMode(DetailMode.cpu);
							break;
						case "2":
							view.setMode(DetailMode.syscpu);
							break;
						case "3":
							view.setMode(DetailMode.totalcpu);
							break;
						case "4":
							view.setMode(DetailMode.totalsyscpu);
							break;
						case "5":
							view.setMode(DetailMode.memory);
							break;
						case "6":
							view.setMode(DetailMode.totalmemory);
							break;
						default:
							System.err.println(" Wrong option for display mode");
							break;
					}
					System.err.println(" Display mode changed to " + view.getMode() + " for next flush");
					vjtop.setNeedForFurtherInput(false);
				} else if (command.equals("q")) {
					view.exit();
					mainThread.interrupt();
					System.err.println(" Quit.");
					return;
				} else if (command.equals("h")) {
					System.err.println(" t : print stack trace for the thread you choose");
					System.err.println(" d : change threads display mode and ordering");
					System.err.println(" q : quit");
					System.err.println(" h : print help");
				} else if (command.equals("")) {
				} else {
					System.err.println("Unkown command: " + command);
				}

				view.waitForCommand();
			} catch (Exception e) {

			}
		}
	} 
                            #location 22 
                            #vulnerability type RESOURCE_LEAK