
/* Just a silly example to demo FindBugs
 */

import java.io.*;

public class demoFindBugs{

  boolean b;
  int totalcount;
  char c;

  static String stopString = "STOP";

  public void m1 (String s) {
    if (s != null) { s.toUpperCase();
                     System.out.println(s);
    }
    int i = s.length();
    System.out.println(i);
  }

  public void m2 (String s) {
    int i = s.length();
    System.out.println(i);
  }

  public void m3(String s) throws IOException {
    if (s == stopString) { System.exit(-1); }
    FileOutputStream fos = new FileOutputStream("t.tmp");
    fos.write(s.getBytes());
  }
}

class AnotherDemoClass extends demoFindBugs{
  int totalCount;

  public boolean m4 (String s) {
    totalCount++;
    if (b=true) { 
        return false; 
    } else {
        return true; 
    }
  }

}
