View Javadoc
1   
2   
3   import java.io.BufferedReader;
4   import java.io.FileNotFoundException;
5   import java.io.FileReader;
6   import java.io.IOException;
7   import java.io.LineNumberReader;
8   
9   import edu.umd.cs.findbugs.annotations.ExpectWarning;
10  
11  public class UserMistakes {
12  	@ExpectWarning("RE,RV")
13  	public static void main(String[] args) throws IOException {
14  		String name="Mr. Ed";
15  		name=name.replaceAll(".", "s.");
16  		System.out.println(name);
17  
18  
19  		//FIXME:FindBugs only catches this error with name.indexOf(String)
20  		if (name.indexOf("s") > 0)
21  			System.out.println("Yay");
22  		else
23  			System.out.println("Boo");
24  
25  		String result;
26  
27  		try 
28  		{
29  			BufferedReader findFiles=new BufferedReader(new FileReader("/mainList.txt"));
30  			if (findFiles.readLine()!=null)
31  				result=findFiles.readLine();
32  			findFiles.close();
33  		} catch (FileNotFoundException e) {
34  			System.exit(7);
35  			e.printStackTrace();
36  		} catch (IOException e) {
37  			e.printStackTrace();
38  		}
39  
40  
41  
42  		LineNumberReader tmp=new LineNumberReader(new FileReader("/mainList.txt"));
43  		int count = 0;
44  		while (tmp.readLine()!=null) count++;
45            
46  		tmp.close();
47  }
48  
49  }