import java.io.*;

public class TwoStreams {
	public void twoStreamsWrong() throws IOException {
		BufferedReader r = null;
		Writer w = null;

		try {
			r = new BufferedReader(new InputStreamReader(new FileInputStream("hello")));
			String l = r.readLine();
			w = new OutputStreamWriter(new FileOutputStream("blah"));
			w.write(l);
		} finally {
			if (r != null) {
				r.close();
			}
			if (w != null) {
				try {
					w.close();
				} catch (IOException e) {
				}
			}
		}
	}

	public void twoStreamsRight() throws IOException {
		BufferedReader r = null;
		Writer w = null;

		try {
			r = new BufferedReader(new InputStreamReader(new FileInputStream("hello")));
			String l = r.readLine();
			w = new OutputStreamWriter(new FileOutputStream("blah"));
			w.write(l);
		} finally {
			if (w != null) {
				try {
					w.close();
				} catch (IOException e) {
				}
			}
			if (r != null) {
				r.close();
			}
		}
	}
}

@@ -38,16 +38,24 @@
 reams %7B%0A
+%09int x;%0A
 %09public 
@@ -486,16 +486,219 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09public void nullDereferenceCheck(TwoStreams o) throws IOException %7B%0A%09%09BufferedReader r = new BufferedReader(%0A%09%09%09new InputStreamReader(%0A%09%09%09new FileInputStream(%22hello%22)));%0A%09%09int i = o.x;%0A%09%09r.close();%0A%09%09%7D%0A
 %09public 

Check for potential null pointer exception