Program: 10443
Project: 10443
Buggy source:
@Override public void viewDidLoad(){
  super.viewDidLoad();
  locationManager=new CLLocationManager();
  if (!CLLocationManager.isHeadingAvailable()) {
    locationManager=null;
    UIAlertView noCompassAlert=new UIAlertView("String_Node_Str","String_Node_Str",null,"String_Node_Str");
    noCompassAlert.show();
  }
 else {
    locationManager.setHeadingFilter(CLLocationManager.HeadingFilterNone());
    locationManager.setDelegate(new CLLocationManagerDelegateAdapter(){
      /** 
 * This delegate method is invoked when the location manager has heading data. 
 */
      @Override public void didUpdateHeading(      CLLocationManager manager,      CLHeading newHeading){
        double x=newHeading.getX();
        double y=newHeading.getY();
        double z=newHeading.getZ();
        xLabel.setText(String.format("String_Node_Str",x));
        yLabel.setText(String.format("String_Node_Str",y));
        zLabel.setText(String.format("String_Node_Str",z));
        double magnitute=Math.sqrt(x * x + y * y + z * z);
        magnitudeLabel.setText(String.format("String_Node_Str",magnitute));
        graphView.updateHistory(x,y,z);
      }
      /** 
 * This delegate method is invoked when the location managed encounters an error condition. 
 */
      @Override public void didFail(      CLLocationManager manager,      NSError error){
        if (error.getErrorCode() == CLErrorCode.Denied) {
          manager.stopUpdatingHeading();
        }
 else         if (error.getErrorCode() == CLErrorCode.HeadingFailure) {
        }
      }
    }
);
    locationManager.startUpdatingHeading();
  }
}

Fixed version (ground truth):
@Override public void viewDidLoad(){
  super.viewDidLoad();
  locationManager=new CLLocationManager();
  if (!CLLocationManager.isHeadingAvailable()) {
    locationManager=null;
    UIAlertView noCompassAlert=new UIAlertView("String_Node_Str","String_Node_Str",null,"String_Node_Str");
    noCompassAlert.show();
  }
 else {
    locationManager.setHeadingFilter(CLLocationManager.getHeadingFilterNone());
    locationManager.setDelegate(new CLLocationManagerDelegateAdapter(){
      /** 
 * This delegate method is invoked when the location manager has heading data. 
 */
      @Override public void didUpdateHeading(      CLLocationManager manager,      CLHeading newHeading){
        double x=newHeading.getX();
        double y=newHeading.getY();
        double z=newHeading.getZ();
        xLabel.setText(String.format("String_Node_Str",x));
        yLabel.setText(String.format("String_Node_Str",y));
        zLabel.setText(String.format("String_Node_Str",z));
        double magnitute=Math.sqrt(x * x + y * y + z * z);
        magnitudeLabel.setText(String.format("String_Node_Str",magnitute));
        graphView.updateHistory(x,y,z);
      }
      /** 
 * This delegate method is invoked when the location managed encounters an error condition. 
 */
      @Override public void didFail(      CLLocationManager manager,      NSError error){
        if (error.getErrorCode() == CLErrorCode.Denied) {
          manager.stopUpdatingHeading();
        }
 else         if (error.getErrorCode() == CLErrorCode.HeadingFailure) {
        }
      }
    }
);
    locationManager.startUpdatingHeading();
  }
}