nus-yam/ex-repair huggingface dataset:
Program: 183630
Project: 183630
Buggy source:
private static float[] temporalSampler(int samplingType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  orientation*=180 / Math.PI;
  float adjustment=-orientation;
  if (samplingType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  Matrix m=new Matrix();
  m.setTranslate(-center[0],-center[1]);
  m.postRotate(adjustment);
  m.mapPoints(pts);
  return pts;
}

Fixed version (ground truth):
private static float[] temporalSampler(int orientationType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  float adjustment=-orientation;
  if (orientationType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  GestureUtilities.translate(pts,-center[0],-center[1]);
  GestureUtilities.rotate(pts,adjustment);
  return pts;
}
Program: 183632
Project: 183632
Buggy source:
private void readFormatV1(DataInputStream in) throws IOException {
  final Learner classifier=mClassifier;
  final HashMap<String,ArrayList<Gesture>> namedGestures=mNamedGestures;
  namedGestures.clear();
  final int entriesCount=in.readInt();
  for (int i=0; i < entriesCount; i++) {
    final String name=in.readUTF();
    final int gestureCount=in.readInt();
    final ArrayList<Gesture> gestures=new ArrayList<Gesture>(gestureCount);
    for (int j=0; j < gestureCount; j++) {
      final Gesture gesture=Gesture.deserialize(in);
      gestures.add(gesture);
      classifier.addInstance(Instance.createInstance(mSequenceType,gesture,name));
    }
    namedGestures.put(name,gestures);
  }
}

Fixed version (ground truth):
private void readFormatV1(DataInputStream in) throws IOException {
  final Learner classifier=mClassifier;
  final HashMap<String,ArrayList<Gesture>> namedGestures=mNamedGestures;
  namedGestures.clear();
  final int entriesCount=in.readInt();
  for (int i=0; i < entriesCount; i++) {
    final String name=in.readUTF();
    final int gestureCount=in.readInt();
    final ArrayList<Gesture> gestures=new ArrayList<Gesture>(gestureCount);
    for (int j=0; j < gestureCount; j++) {
      final Gesture gesture=Gesture.deserialize(in);
      gestures.add(gesture);
      classifier.addInstance(Instance.createInstance(mSequenceType,mOrientationStyle,gesture,name));
    }
    namedGestures.put(name,gestures);
  }
}
Program: 183633
Project: 183633
Buggy source:
/** 
 * Add a gesture for the entry
 * @param entryName entry name
 * @param gesture
 */
public void addGesture(String entryName,Gesture gesture){
  if (entryName == null || entryName.length() == 0) {
    return;
  }
  ArrayList<Gesture> gestures=mNamedGestures.get(entryName);
  if (gestures == null) {
    gestures=new ArrayList<Gesture>();
    mNamedGestures.put(entryName,gestures);
  }
  gestures.add(gesture);
  mClassifier.addInstance(Instance.createInstance(mSequenceType,gesture,entryName));
  mChanged=true;
}

Fixed version (ground truth):
/** 
 * Add a gesture for the entry
 * @param entryName entry name
 * @param gesture
 */
public void addGesture(String entryName,Gesture gesture){
  if (entryName == null || entryName.length() == 0) {
    return;
  }
  ArrayList<Gesture> gestures=mNamedGestures.get(entryName);
  if (gestures == null) {
    gestures=new ArrayList<Gesture>();
    mNamedGestures.put(entryName,gestures);
  }
  gestures.add(gesture);
  mClassifier.addInstance(Instance.createInstance(mSequenceType,mOrientationStyle,gesture,entryName));
  mChanged=true;
}
Program: 183634
Project: 183634
Buggy source:
/** 
 * Recognize a gesture
 * @param gesture the query
 * @return a list of predictions of possible entries for a given gesture
 */
public ArrayList<Prediction> recognize(Gesture gesture){
  Instance instance=Instance.createInstance(mSequenceType,gesture,null);
  return mClassifier.classify(mSequenceType,instance.vector);
}

Fixed version (ground truth):
/** 
 * Recognize a gesture
 * @param gesture the query
 * @return a list of predictions of possible entries for a given gesture
 */
public ArrayList<Prediction> recognize(Gesture gesture){
  Instance instance=Instance.createInstance(mSequenceType,mOrientationStyle,gesture,null);
  return mClassifier.classify(mSequenceType,instance.vector);
}
Program: 183635
Project: 183635
Buggy source:
/** 
 * Convert the stroke to a Path based on the number of points
 * @param width the width of the bounding box of the target path
 * @param height the height of the bounding box of the target path
 * @param numSample the number of points needed
 * @return the path
 */
public Path toPath(float width,float height,int numSample){
  final float[] pts=GestureUtilities.temporalSampling(this,numSample);
  final RectF rect=boundingBox;
  final Matrix matrix=new Matrix();
  matrix.setTranslate(-rect.left,-rect.top);
  matrix.postScale(width / rect.width(),height / rect.height());
  matrix.mapPoints(pts);
  float mX=0;
  float mY=0;
  Path path=null;
  final int count=pts.length;
  for (int i=0; i < count; i+=2) {
    float x=pts[i];
    float y=pts[i + 1];
    if (path == null) {
      path=new Path();
      path.moveTo(x,y);
      mX=x;
      mY=y;
    }
 else {
      float dx=Math.abs(x - mX);
      float dy=Math.abs(y - mY);
      if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
        path.quadTo(mX,mY,(x + mX) / 2,(y + mY) / 2);
        mX=x;
        mY=y;
      }
    }
  }
  return path;
}

Fixed version (ground truth):
/** 
 * Convert the stroke to a Path based on the number of points
 * @param width the width of the bounding box of the target path
 * @param height the height of the bounding box of the target path
 * @param numSample the number of points needed
 * @return the path
 */
public Path toPath(float width,float height,int numSample){
  final float[] pts=GestureUtilities.temporalSampling(this,numSample);
  final RectF rect=boundingBox;
  GestureUtilities.translate(pts,-rect.left,-rect.top);
  float sx=width / rect.width();
  float sy=height / rect.height();
  float scale=sx > sy ? sy : sx;
  GestureUtilities.scale(pts,scale,scale);
  float mX=0;
  float mY=0;
  Path path=null;
  final int count=pts.length;
  for (int i=0; i < count; i+=2) {
    float x=pts[i];
    float y=pts[i + 1];
    if (path == null) {
      path=new Path();
      path.moveTo(x,y);
      mX=x;
      mY=y;
    }
 else {
      float dx=Math.abs(x - mX);
      float dy=Math.abs(y - mY);
      if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
        path.quadTo(mX,mY,(x + mX) / 2,(y + mY) / 2);
        mX=x;
        mY=y;
      }
    }
  }
  return path;
}
Program: 183636
Project: 183636
Buggy source:
static OrientedBoundingBox computeOrientedBoundingBox(float[] points,float[] centroid){
  Matrix tr=new Matrix();
  tr.setTranslate(-centroid[0],-centroid[1]);
  tr.mapPoints(points);
  double[][] array=computeCoVariance(points);
  double[] targetVector=computeOrientation(array);
  float angle;
  if (targetVector[0] == 0 && targetVector[1] == 0) {
    angle=-90;
  }
 else {
    angle=(float)Math.atan2(targetVector[1],targetVector[0]);
    angle=(float)(180 * angle / Math.PI);
    Matrix trans=new Matrix();
    trans.setRotate(-angle);
    trans.mapPoints(points);
  }
  float minx=Float.MAX_VALUE;
  float miny=Float.MAX_VALUE;
  float maxx=Float.MIN_VALUE;
  float maxy=Float.MIN_VALUE;
  int count=points.length;
  for (int i=0; i < count; i++) {
    if (points[i] < minx) {
      minx=points[i];
    }
    if (points[i] > maxx) {
      maxx=points[i];
    }
    i++;
    if (points[i] < miny) {
      miny=points[i];
    }
    if (points[i] > maxy) {
      maxy=points[i];
    }
  }
  return new OrientedBoundingBox(angle,centroid[0],centroid[1],maxx - minx,maxy - miny);
}

Fixed version (ground truth):
static OrientedBoundingBox computeOrientedBoundingBox(float[] points,float[] centroid){
  translate(points,-centroid[0],-centroid[1]);
  double[][] array=computeCoVariance(points);
  double[] targetVector=computeOrientation(array);
  float angle;
  if (targetVector[0] == 0 && targetVector[1] == 0) {
    angle=(float)-Math.PI / 2;
  }
 else {
    angle=(float)Math.atan2(targetVector[1],targetVector[0]);
    rotate(points,-angle);
  }
  float minx=Float.MAX_VALUE;
  float miny=Float.MAX_VALUE;
  float maxx=Float.MIN_VALUE;
  float maxy=Float.MIN_VALUE;
  int count=points.length;
  for (int i=0; i < count; i++) {
    if (points[i] < minx) {
      minx=points[i];
    }
    if (points[i] > maxx) {
      maxx=points[i];
    }
    i++;
    if (points[i] < miny) {
      miny=points[i];
    }
    if (points[i] > maxy) {
      maxy=points[i];
    }
  }
  return new OrientedBoundingBox(angle,centroid[0],centroid[1],maxx - minx,maxy - miny);
}
Program: 183637
Project: 183637
Buggy source:
/** 
 * create a learning instance for a single stroke gesture
 * @param gesture
 * @param label
 * @return the instance
 */
static Instance createInstance(int samplingType,Gesture gesture,String label){
  float[] pts;
  Instance instance;
  if (samplingType == GestureLibrary.SEQUENCE_SENSITIVE) {
    pts=temporalSampler(samplingType,gesture);
    instance=new Instance(gesture.getID(),pts,label);
    instance.normalize();
  }
 else {
    pts=spatialSampler(gesture);
    instance=new Instance(gesture.getID(),pts,label);
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * create a learning instance for a single stroke gesture
 * @param gesture
 * @param label
 * @return the instance
 */
static Instance createInstance(int sequenceType,int orientationType,Gesture gesture,String label){
  float[] pts;
  Instance instance;
  if (sequenceType == GestureLibrary.SEQUENCE_SENSITIVE) {
    pts=temporalSampler(orientationType,gesture);
    instance=new Instance(gesture.getID(),pts,label);
    instance.normalize();
  }
 else {
    pts=spatialSampler(gesture);
    instance=new Instance(gesture.getID(),pts,label);
  }
  return instance;
}
Program: 183638
Project: 183638
Buggy source:
private static float[] temporalSampler(int samplingType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  orientation*=180 / Math.PI;
  float adjustment=-orientation;
  if (samplingType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  Matrix m=new Matrix();
  m.setTranslate(-center[0],-center[1]);
  m.postRotate(adjustment);
  m.mapPoints(pts);
  return pts;
}

Fixed version (ground truth):
private static float[] temporalSampler(int orientationType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  float adjustment=-orientation;
  if (orientationType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  GestureUtilities.translate(pts,-center[0],-center[1]);
  GestureUtilities.rotate(pts,adjustment);
  return pts;
}
Program: 183640
Project: 183640
Buggy source:
private void readFormatV1(DataInputStream in) throws IOException {
  final Learner classifier=mClassifier;
  final HashMap<String,ArrayList<Gesture>> namedGestures=mNamedGestures;
  namedGestures.clear();
  final int entriesCount=in.readInt();
  for (int i=0; i < entriesCount; i++) {
    final String name=in.readUTF();
    final int gestureCount=in.readInt();
    final ArrayList<Gesture> gestures=new ArrayList<Gesture>(gestureCount);
    for (int j=0; j < gestureCount; j++) {
      final Gesture gesture=Gesture.deserialize(in);
      gestures.add(gesture);
      classifier.addInstance(Instance.createInstance(mSequenceType,mOrientationStyle,gesture,name));
    }
    namedGestures.put(name,gestures);
  }
}

Fixed version (ground truth):
private void readFormatV1(DataInputStream in) throws IOException {
  final Learner classifier=mClassifier;
  final HashMap<String,ArrayList<Gesture>> namedGestures=mNamedGestures;
  namedGestures.clear();
  final int entriesCount=in.readInt();
  for (int i=0; i < entriesCount; i++) {
    final String name=in.readUTF();
    final int gestureCount=in.readInt();
    final ArrayList<Gesture> gestures=new ArrayList<Gesture>(gestureCount);
    for (int j=0; j < gestureCount; j++) {
      final Gesture gesture=Gesture.deserialize(in);
      gestures.add(gesture);
      classifier.addInstance(Instance.createInstance(mSequenceType,gesture,name));
    }
    namedGestures.put(name,gestures);
  }
}
Program: 183641
Project: 183641
Buggy source:
/** 
 * Add a gesture for the entry
 * @param entryName entry name
 * @param gesture
 */
public void addGesture(String entryName,Gesture gesture){
  if (entryName == null || entryName.length() == 0) {
    return;
  }
  ArrayList<Gesture> gestures=mNamedGestures.get(entryName);
  if (gestures == null) {
    gestures=new ArrayList<Gesture>();
    mNamedGestures.put(entryName,gestures);
  }
  gestures.add(gesture);
  mClassifier.addInstance(Instance.createInstance(mSequenceType,mOrientationStyle,gesture,entryName));
  mChanged=true;
}

Fixed version (ground truth):
/** 
 * Add a gesture for the entry
 * @param entryName entry name
 * @param gesture
 */
public void addGesture(String entryName,Gesture gesture){
  if (entryName == null || entryName.length() == 0) {
    return;
  }
  ArrayList<Gesture> gestures=mNamedGestures.get(entryName);
  if (gestures == null) {
    gestures=new ArrayList<Gesture>();
    mNamedGestures.put(entryName,gestures);
  }
  gestures.add(gesture);
  mClassifier.addInstance(Instance.createInstance(mSequenceType,gesture,entryName));
  mChanged=true;
}
Program: 183642
Project: 183642
Buggy source:
/** 
 * Recognize a gesture
 * @param gesture the query
 * @return a list of predictions of possible entries for a given gesture
 */
public ArrayList<Prediction> recognize(Gesture gesture){
  Instance instance=Instance.createInstance(mSequenceType,mOrientationStyle,gesture,null);
  return mClassifier.classify(mSequenceType,instance.vector);
}

Fixed version (ground truth):
/** 
 * Recognize a gesture
 * @param gesture the query
 * @return a list of predictions of possible entries for a given gesture
 */
public ArrayList<Prediction> recognize(Gesture gesture){
  Instance instance=Instance.createInstance(mSequenceType,gesture,null);
  return mClassifier.classify(mSequenceType,instance.vector);
}
Program: 183643
Project: 183643
Buggy source:
/** 
 * Convert the stroke to a Path based on the number of points
 * @param width the width of the bounding box of the target path
 * @param height the height of the bounding box of the target path
 * @param numSample the number of points needed
 * @return the path
 */
public Path toPath(float width,float height,int numSample){
  final float[] pts=GestureUtilities.temporalSampling(this,numSample);
  final RectF rect=boundingBox;
  GestureUtilities.translate(pts,-rect.left,-rect.top);
  float sx=width / rect.width();
  float sy=height / rect.height();
  float scale=sx > sy ? sy : sx;
  GestureUtilities.scale(pts,scale,scale);
  float mX=0;
  float mY=0;
  Path path=null;
  final int count=pts.length;
  for (int i=0; i < count; i+=2) {
    float x=pts[i];
    float y=pts[i + 1];
    if (path == null) {
      path=new Path();
      path.moveTo(x,y);
      mX=x;
      mY=y;
    }
 else {
      float dx=Math.abs(x - mX);
      float dy=Math.abs(y - mY);
      if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
        path.quadTo(mX,mY,(x + mX) / 2,(y + mY) / 2);
        mX=x;
        mY=y;
      }
    }
  }
  return path;
}

Fixed version (ground truth):
/** 
 * Convert the stroke to a Path based on the number of points
 * @param width the width of the bounding box of the target path
 * @param height the height of the bounding box of the target path
 * @param numSample the number of points needed
 * @return the path
 */
public Path toPath(float width,float height,int numSample){
  final float[] pts=GestureUtilities.temporalSampling(this,numSample);
  final RectF rect=boundingBox;
  final Matrix matrix=new Matrix();
  matrix.setTranslate(-rect.left,-rect.top);
  matrix.postScale(width / rect.width(),height / rect.height());
  matrix.mapPoints(pts);
  float mX=0;
  float mY=0;
  Path path=null;
  final int count=pts.length;
  for (int i=0; i < count; i+=2) {
    float x=pts[i];
    float y=pts[i + 1];
    if (path == null) {
      path=new Path();
      path.moveTo(x,y);
      mX=x;
      mY=y;
    }
 else {
      float dx=Math.abs(x - mX);
      float dy=Math.abs(y - mY);
      if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
        path.quadTo(mX,mY,(x + mX) / 2,(y + mY) / 2);
        mX=x;
        mY=y;
      }
    }
  }
  return path;
}
Program: 183644
Project: 183644
Buggy source:
static OrientedBoundingBox computeOrientedBoundingBox(float[] points,float[] centroid){
  translate(points,-centroid[0],-centroid[1]);
  double[][] array=computeCoVariance(points);
  double[] targetVector=computeOrientation(array);
  float angle;
  if (targetVector[0] == 0 && targetVector[1] == 0) {
    angle=(float)-Math.PI / 2;
  }
 else {
    angle=(float)Math.atan2(targetVector[1],targetVector[0]);
    rotate(points,-angle);
  }
  float minx=Float.MAX_VALUE;
  float miny=Float.MAX_VALUE;
  float maxx=Float.MIN_VALUE;
  float maxy=Float.MIN_VALUE;
  int count=points.length;
  for (int i=0; i < count; i++) {
    if (points[i] < minx) {
      minx=points[i];
    }
    if (points[i] > maxx) {
      maxx=points[i];
    }
    i++;
    if (points[i] < miny) {
      miny=points[i];
    }
    if (points[i] > maxy) {
      maxy=points[i];
    }
  }
  return new OrientedBoundingBox(angle,centroid[0],centroid[1],maxx - minx,maxy - miny);
}

Fixed version (ground truth):
static OrientedBoundingBox computeOrientedBoundingBox(float[] points,float[] centroid){
  Matrix tr=new Matrix();
  tr.setTranslate(-centroid[0],-centroid[1]);
  tr.mapPoints(points);
  double[][] array=computeCoVariance(points);
  double[] targetVector=computeOrientation(array);
  float angle;
  if (targetVector[0] == 0 && targetVector[1] == 0) {
    angle=-90;
  }
 else {
    angle=(float)Math.atan2(targetVector[1],targetVector[0]);
    angle=(float)(180 * angle / Math.PI);
    Matrix trans=new Matrix();
    trans.setRotate(-angle);
    trans.mapPoints(points);
  }
  float minx=Float.MAX_VALUE;
  float miny=Float.MAX_VALUE;
  float maxx=Float.MIN_VALUE;
  float maxy=Float.MIN_VALUE;
  int count=points.length;
  for (int i=0; i < count; i++) {
    if (points[i] < minx) {
      minx=points[i];
    }
    if (points[i] > maxx) {
      maxx=points[i];
    }
    i++;
    if (points[i] < miny) {
      miny=points[i];
    }
    if (points[i] > maxy) {
      maxy=points[i];
    }
  }
  return new OrientedBoundingBox(angle,centroid[0],centroid[1],maxx - minx,maxy - miny);
}
Program: 183645
Project: 183645
Buggy source:
/** 
 * create a learning instance for a single stroke gesture
 * @param gesture
 * @param label
 * @return the instance
 */
static Instance createInstance(int sequenceType,int orientationType,Gesture gesture,String label){
  float[] pts;
  Instance instance;
  if (sequenceType == GestureLibrary.SEQUENCE_SENSITIVE) {
    pts=temporalSampler(orientationType,gesture);
    instance=new Instance(gesture.getID(),pts,label);
    instance.normalize();
  }
 else {
    pts=spatialSampler(gesture);
    instance=new Instance(gesture.getID(),pts,label);
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * create a learning instance for a single stroke gesture
 * @param gesture
 * @param label
 * @return the instance
 */
static Instance createInstance(int samplingType,Gesture gesture,String label){
  float[] pts;
  Instance instance;
  if (samplingType == GestureLibrary.SEQUENCE_SENSITIVE) {
    pts=temporalSampler(samplingType,gesture);
    instance=new Instance(gesture.getID(),pts,label);
    instance.normalize();
  }
 else {
    pts=spatialSampler(gesture);
    instance=new Instance(gesture.getID(),pts,label);
  }
  return instance;
}
Program: 183646
Project: 183646
Buggy source:
private static float[] temporalSampler(int orientationType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  float adjustment=-orientation;
  if (orientationType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  GestureUtilities.translate(pts,-center[0],-center[1]);
  GestureUtilities.rotate(pts,adjustment);
  return pts;
}

Fixed version (ground truth):
private static float[] temporalSampler(int samplingType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  orientation*=180 / Math.PI;
  float adjustment=-orientation;
  if (samplingType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  Matrix m=new Matrix();
  m.setTranslate(-center[0],-center[1]);
  m.postRotate(adjustment);
  m.mapPoints(pts);
  return pts;
}
Program: 183648
Project: 183648
Buggy source:
private void readFormatV1(DataInputStream in) throws IOException {
  final Learner classifier=mClassifier;
  final HashMap<String,ArrayList<Gesture>> namedGestures=mNamedGestures;
  namedGestures.clear();
  final int entriesCount=in.readInt();
  for (int i=0; i < entriesCount; i++) {
    final String name=in.readUTF();
    final int gestureCount=in.readInt();
    final ArrayList<Gesture> gestures=new ArrayList<Gesture>(gestureCount);
    for (int j=0; j < gestureCount; j++) {
      final Gesture gesture=Gesture.deserialize(in);
      gestures.add(gesture);
      classifier.addInstance(Instance.createInstance(mSequenceType,gesture,name));
    }
    namedGestures.put(name,gestures);
  }
}

Fixed version (ground truth):
private void readFormatV1(DataInputStream in) throws IOException {
  final Learner classifier=mClassifier;
  final HashMap<String,ArrayList<Gesture>> namedGestures=mNamedGestures;
  namedGestures.clear();
  final int entriesCount=in.readInt();
  for (int i=0; i < entriesCount; i++) {
    final String name=in.readUTF();
    final int gestureCount=in.readInt();
    final ArrayList<Gesture> gestures=new ArrayList<Gesture>(gestureCount);
    for (int j=0; j < gestureCount; j++) {
      final Gesture gesture=Gesture.deserialize(in);
      gestures.add(gesture);
      classifier.addInstance(Instance.createInstance(mSequenceType,mOrientationStyle,gesture,name));
    }
    namedGestures.put(name,gestures);
  }
}
Program: 183649
Project: 183649
Buggy source:
/** 
 * Add a gesture for the entry
 * @param entryName entry name
 * @param gesture
 */
public void addGesture(String entryName,Gesture gesture){
  if (entryName == null || entryName.length() == 0) {
    return;
  }
  ArrayList<Gesture> gestures=mNamedGestures.get(entryName);
  if (gestures == null) {
    gestures=new ArrayList<Gesture>();
    mNamedGestures.put(entryName,gestures);
  }
  gestures.add(gesture);
  mClassifier.addInstance(Instance.createInstance(mSequenceType,gesture,entryName));
  mChanged=true;
}

Fixed version (ground truth):
/** 
 * Add a gesture for the entry
 * @param entryName entry name
 * @param gesture
 */
public void addGesture(String entryName,Gesture gesture){
  if (entryName == null || entryName.length() == 0) {
    return;
  }
  ArrayList<Gesture> gestures=mNamedGestures.get(entryName);
  if (gestures == null) {
    gestures=new ArrayList<Gesture>();
    mNamedGestures.put(entryName,gestures);
  }
  gestures.add(gesture);
  mClassifier.addInstance(Instance.createInstance(mSequenceType,mOrientationStyle,gesture,entryName));
  mChanged=true;
}
Program: 183650
Project: 183650
Buggy source:
/** 
 * Recognize a gesture
 * @param gesture the query
 * @return a list of predictions of possible entries for a given gesture
 */
public ArrayList<Prediction> recognize(Gesture gesture){
  Instance instance=Instance.createInstance(mSequenceType,gesture,null);
  return mClassifier.classify(mSequenceType,instance.vector);
}

Fixed version (ground truth):
/** 
 * Recognize a gesture
 * @param gesture the query
 * @return a list of predictions of possible entries for a given gesture
 */
public ArrayList<Prediction> recognize(Gesture gesture){
  Instance instance=Instance.createInstance(mSequenceType,mOrientationStyle,gesture,null);
  return mClassifier.classify(mSequenceType,instance.vector);
}
Program: 183651
Project: 183651
Buggy source:
/** 
 * Convert the stroke to a Path based on the number of points
 * @param width the width of the bounding box of the target path
 * @param height the height of the bounding box of the target path
 * @param numSample the number of points needed
 * @return the path
 */
public Path toPath(float width,float height,int numSample){
  final float[] pts=GestureUtilities.temporalSampling(this,numSample);
  final RectF rect=boundingBox;
  final Matrix matrix=new Matrix();
  matrix.setTranslate(-rect.left,-rect.top);
  matrix.postScale(width / rect.width(),height / rect.height());
  matrix.mapPoints(pts);
  float mX=0;
  float mY=0;
  Path path=null;
  final int count=pts.length;
  for (int i=0; i < count; i+=2) {
    float x=pts[i];
    float y=pts[i + 1];
    if (path == null) {
      path=new Path();
      path.moveTo(x,y);
      mX=x;
      mY=y;
    }
 else {
      float dx=Math.abs(x - mX);
      float dy=Math.abs(y - mY);
      if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
        path.quadTo(mX,mY,(x + mX) / 2,(y + mY) / 2);
        mX=x;
        mY=y;
      }
    }
  }
  return path;
}

Fixed version (ground truth):
/** 
 * Convert the stroke to a Path based on the number of points
 * @param width the width of the bounding box of the target path
 * @param height the height of the bounding box of the target path
 * @param numSample the number of points needed
 * @return the path
 */
public Path toPath(float width,float height,int numSample){
  final float[] pts=GestureUtilities.temporalSampling(this,numSample);
  final RectF rect=boundingBox;
  GestureUtilities.translate(pts,-rect.left,-rect.top);
  float sx=width / rect.width();
  float sy=height / rect.height();
  float scale=sx > sy ? sy : sx;
  GestureUtilities.scale(pts,scale,scale);
  float mX=0;
  float mY=0;
  Path path=null;
  final int count=pts.length;
  for (int i=0; i < count; i+=2) {
    float x=pts[i];
    float y=pts[i + 1];
    if (path == null) {
      path=new Path();
      path.moveTo(x,y);
      mX=x;
      mY=y;
    }
 else {
      float dx=Math.abs(x - mX);
      float dy=Math.abs(y - mY);
      if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
        path.quadTo(mX,mY,(x + mX) / 2,(y + mY) / 2);
        mX=x;
        mY=y;
      }
    }
  }
  return path;
}
Program: 183652
Project: 183652
Buggy source:
static OrientedBoundingBox computeOrientedBoundingBox(float[] points,float[] centroid){
  Matrix tr=new Matrix();
  tr.setTranslate(-centroid[0],-centroid[1]);
  tr.mapPoints(points);
  double[][] array=computeCoVariance(points);
  double[] targetVector=computeOrientation(array);
  float angle;
  if (targetVector[0] == 0 && targetVector[1] == 0) {
    angle=-90;
  }
 else {
    angle=(float)Math.atan2(targetVector[1],targetVector[0]);
    angle=(float)(180 * angle / Math.PI);
    Matrix trans=new Matrix();
    trans.setRotate(-angle);
    trans.mapPoints(points);
  }
  float minx=Float.MAX_VALUE;
  float miny=Float.MAX_VALUE;
  float maxx=Float.MIN_VALUE;
  float maxy=Float.MIN_VALUE;
  int count=points.length;
  for (int i=0; i < count; i++) {
    if (points[i] < minx) {
      minx=points[i];
    }
    if (points[i] > maxx) {
      maxx=points[i];
    }
    i++;
    if (points[i] < miny) {
      miny=points[i];
    }
    if (points[i] > maxy) {
      maxy=points[i];
    }
  }
  return new OrientedBoundingBox(angle,centroid[0],centroid[1],maxx - minx,maxy - miny);
}

Fixed version (ground truth):
static OrientedBoundingBox computeOrientedBoundingBox(float[] points,float[] centroid){
  translate(points,-centroid[0],-centroid[1]);
  double[][] array=computeCoVariance(points);
  double[] targetVector=computeOrientation(array);
  float angle;
  if (targetVector[0] == 0 && targetVector[1] == 0) {
    angle=(float)-Math.PI / 2;
  }
 else {
    angle=(float)Math.atan2(targetVector[1],targetVector[0]);
    rotate(points,-angle);
  }
  float minx=Float.MAX_VALUE;
  float miny=Float.MAX_VALUE;
  float maxx=Float.MIN_VALUE;
  float maxy=Float.MIN_VALUE;
  int count=points.length;
  for (int i=0; i < count; i++) {
    if (points[i] < minx) {
      minx=points[i];
    }
    if (points[i] > maxx) {
      maxx=points[i];
    }
    i++;
    if (points[i] < miny) {
      miny=points[i];
    }
    if (points[i] > maxy) {
      maxy=points[i];
    }
  }
  return new OrientedBoundingBox(angle,centroid[0],centroid[1],maxx - minx,maxy - miny);
}
Program: 183653
Project: 183653
Buggy source:
/** 
 * create a learning instance for a single stroke gesture
 * @param gesture
 * @param label
 * @return the instance
 */
static Instance createInstance(int samplingType,Gesture gesture,String label){
  float[] pts;
  Instance instance;
  if (samplingType == GestureLibrary.SEQUENCE_SENSITIVE) {
    pts=temporalSampler(samplingType,gesture);
    instance=new Instance(gesture.getID(),pts,label);
    instance.normalize();
  }
 else {
    pts=spatialSampler(gesture);
    instance=new Instance(gesture.getID(),pts,label);
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * create a learning instance for a single stroke gesture
 * @param gesture
 * @param label
 * @return the instance
 */
static Instance createInstance(int sequenceType,int orientationType,Gesture gesture,String label){
  float[] pts;
  Instance instance;
  if (sequenceType == GestureLibrary.SEQUENCE_SENSITIVE) {
    pts=temporalSampler(orientationType,gesture);
    instance=new Instance(gesture.getID(),pts,label);
    instance.normalize();
  }
 else {
    pts=spatialSampler(gesture);
    instance=new Instance(gesture.getID(),pts,label);
  }
  return instance;
}
Program: 183654
Project: 183654
Buggy source:
private static float[] temporalSampler(int samplingType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  orientation*=180 / Math.PI;
  float adjustment=-orientation;
  if (samplingType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  Matrix m=new Matrix();
  m.setTranslate(-center[0],-center[1]);
  m.postRotate(adjustment);
  m.mapPoints(pts);
  return pts;
}

Fixed version (ground truth):
private static float[] temporalSampler(int orientationType,Gesture gesture){
  float[] pts=GestureUtilities.temporalSampling(gesture.getStrokes().get(0),SEQUENCE_SAMPLE_SIZE);
  float[] center=GestureUtilities.computeCentroid(pts);
  float orientation=(float)Math.atan2(pts[1] - center[1],pts[0] - center[0]);
  float adjustment=-orientation;
  if (orientationType == GestureLibrary.ORIENTATION_SENSITIVE) {
    int count=ORIENTATIONS.length;
    for (int i=0; i < count; i++) {
      float delta=ORIENTATIONS[i] - orientation;
      if (Math.abs(delta) < Math.abs(adjustment)) {
        adjustment=delta;
      }
    }
  }
  GestureUtilities.translate(pts,-center[0],-center[1]);
  GestureUtilities.rotate(pts,adjustment);
  return pts;
}
Program: 183656
Project: 183656
Buggy source:
private void getPermissionsForPackage(String packageName,Set<PermissionInfo> permSet){
  PackageInfo pkgInfo;
  try {
    pkgInfo=mPm.getPackageInfo(packageName,PackageManager.GET_PERMISSIONS);
  }
 catch (  NameNotFoundException e) {
    Log.w(TAG,"String_Node_Str" + packageName);
    return;
  }
  if (pkgInfo == null) {
    return;
  }
  String strList[]=pkgInfo.requestedPermissions;
  if (strList == null) {
    return;
  }
  extractPerms(strList,permSet);
}

Fixed version (ground truth):
private void getPermissionsForPackage(String packageName,Set<PermissionInfo> permSet){
  PackageInfo pkgInfo;
  try {
    pkgInfo=mPm.getPackageInfo(packageName,PackageManager.GET_PERMISSIONS);
  }
 catch (  NameNotFoundException e) {
    Log.w(TAG,"String_Node_Str" + packageName);
    return;
  }
  if ((pkgInfo != null) && (pkgInfo.requestedPermissions != null)) {
    extractPerms(pkgInfo.requestedPermissions,permSet);
  }
}
Program: 183657
Project: 183657
Buggy source:
public AppSecurityPermissions(Context context,PackageParser.Package pkg){
  mContext=context;
  mPm=mContext.getPackageManager();
  mPermsList=new ArrayList<PermissionInfo>();
  Set<PermissionInfo> permSet=new HashSet<PermissionInfo>();
  if (pkg == null) {
    return;
  }
  if (pkg.mSharedUserId != null) {
    int sharedUid;
    try {
      sharedUid=mPm.getUidForSharedUser(pkg.mSharedUserId);
    }
 catch (    NameNotFoundException e) {
      Log.w(TAG,"String_Node_Str" + pkg.packageName);
      return;
    }
    getAllUsedPermissions(sharedUid,permSet);
  }
 else {
    ArrayList<String> strList=pkg.requestedPermissions;
    int size;
    if ((strList == null) || ((size=strList.size()) == 0)) {
      return;
    }
    extractPerms(strList.toArray(new String[size]),permSet);
  }
  for (  PermissionInfo tmpInfo : permSet) {
    mPermsList.add(tmpInfo);
  }
}

Fixed version (ground truth):
public AppSecurityPermissions(Context context,PackageParser.Package pkg){
  mContext=context;
  mPm=mContext.getPackageManager();
  mPermsList=new ArrayList<PermissionInfo>();
  Set<PermissionInfo> permSet=new HashSet<PermissionInfo>();
  if (pkg == null) {
    return;
  }
  if (pkg.requestedPermissions != null) {
    ArrayList<String> strList=pkg.requestedPermissions;
    int size=strList.size();
    if (size > 0) {
      extractPerms(strList.toArray(new String[size]),permSet);
    }
  }
  if (pkg.mSharedUserId != null) {
    int sharedUid;
    try {
      sharedUid=mPm.getUidForSharedUser(pkg.mSharedUserId);
      getAllUsedPermissions(sharedUid,permSet);
    }
 catch (    NameNotFoundException e) {
      Log.w(TAG,"String_Node_Str" + pkg.packageName);
    }
  }
  for (  PermissionInfo tmpInfo : permSet) {
    mPermsList.add(tmpInfo);
  }
}
Program: 183658
Project: 183658
Buggy source:
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  parcel.writeBundle(this);
}

Fixed version (ground truth):
/** 
 * Writes the Bundle contents to a Parcel, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to copy this bundle to.
 */
public void writeToParcel(Parcel parcel,int flags){
  if (mParcelledData != null) {
    int length=mParcelledData.dataSize();
    parcel.writeInt(length);
    parcel.writeInt(0x4C444E42);
    parcel.appendFrom(mParcelledData,0,length);
  }
 else {
    parcel.writeInt(-1);
    parcel.writeInt(0x4C444E42);
    int oldPos=parcel.dataPosition();
    parcel.writeMapInternal(mMap);
    int newPos=parcel.dataPosition();
    parcel.setDataPosition(oldPos - 8);
    int length=newPos - oldPos;
    parcel.writeInt(length);
    parcel.setDataPosition(newPos);
  }
}
Program: 183659
Project: 183659
Buggy source:
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    return;
  }
  mParcelledData.setDataPosition(0);
  Bundle b=mParcelledData.readBundleUnpacked(mClassLoader);
  mMap=b.mMap;
  mHasFds=mParcelledData.hasFileDescriptors();
  mFdsKnown=true;
  mParcelledData.recycle();
  mParcelledData=null;
}

Fixed version (ground truth):
/** 
 * If the underlying data are stored as a Parcel, unparcel them using the currently assigned class loader.
 */
synchronized void unparcel(){
  if (mParcelledData == null) {
    return;
  }
  int N=mParcelledData.readInt();
  if (N < 0) {
    return;
  }
  if (mMap == null) {
    mMap=new HashMap<String,Object>();
  }
  mParcelledData.readMapInternal(mMap,N,mClassLoader);
  mParcelledData.recycle();
  mParcelledData=null;
}
Program: 183660
Project: 183660
Buggy source:
/** 
 * Reads the Parcel contents into this Bundle, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to overwrite this bundle from.
 */
public void readFromParcel(Parcel parcel){
  mParcelledData=parcel;
  mHasFds=mParcelledData.hasFileDescriptors();
  mFdsKnown=true;
}

Fixed version (ground truth):
/** 
 * Reads the Parcel contents into this Bundle, typically in order for it to be passed through an IBinder connection.
 * @param parcel The parcel to overwrite this bundle from.
 */
public void readFromParcel(Parcel parcel){
  int length=parcel.readInt();
  if (length < 0) {
    throw new RuntimeException("String_Node_Str" + length);
  }
  readFromParcelInner(parcel,length);
}
Program: 183661
Project: 183661
Buggy source:
private void readMapInternal(Map outVal,int N,ClassLoader loader){
  while (N > 0) {
    Object key=readValue(loader);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readMapInternal(Map outVal,int N,ClassLoader loader){
  while (N > 0) {
    Object key=readValue(loader);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}
Program: 183662
Project: 183662
Buggy source:
/** 
 * Flatten a Bundle into the parcel at the current dataPosition(), growing dataCapacity() if needed.
 */
public final void writeBundle(Bundle val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  if (val.mParcelledData != null) {
    int length=val.mParcelledData.dataSize();
    appendFrom(val.mParcelledData,0,length);
  }
 else {
    writeInt(-1);
    int oldPos=dataPosition();
    writeInt(0x4C444E42);
    writeMapInternal(val.mMap);
    int newPos=dataPosition();
    setDataPosition(oldPos - 4);
    int length=newPos - oldPos;
    writeInt(length);
    setDataPosition(newPos);
  }
}

Fixed version (ground truth):
/** 
 * Flatten a Bundle into the parcel at the current dataPosition(), growing dataCapacity() if needed.
 */
public final void writeBundle(Bundle val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  val.writeToParcel(this,0);
}
Program: 183663
Project: 183663
Buggy source:
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int offset=dataPosition();
  int length=readInt();
  if (length < 0) {
    return null;
  }
  int magic=readInt();
  if (magic != 0x4C444E42) {
    String st=Log.getStackTraceString(new RuntimeException());
    Log.e("String_Node_Str","String_Node_Str");
    Log.e("String_Node_Str","String_Node_Str" + st);
  }
  setDataPosition(offset + length + 4);
  Parcel p=new Parcel(0);
  p.setDataPosition(0);
  p.appendFrom(this,offset,length + 4);
  p.setDataPosition(0);
  final Bundle bundle=new Bundle(p);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}

Fixed version (ground truth):
/** 
 * Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. Returns null if the previously written Bundle object was null.
 */
public final Bundle readBundle(ClassLoader loader){
  int length=readInt();
  if (length < 0) {
    return null;
  }
  final Bundle bundle=new Bundle(this,length);
  if (loader != null) {
    bundle.setClassLoader(loader);
  }
  return bundle;
}
Program: 183664
Project: 183664
Buggy source:
/** 
 * Flatten a Map into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
private void writeMapInternal(Map<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  Set<Map.Entry<String,Object>> entries=val.entrySet();
  writeInt(entries.size());
  for (  Map.Entry<String,Object> e : entries) {
    writeValue(e.getKey());
    writeValue(e.getValue());
  }
}

Fixed version (ground truth):
/** 
 * Flatten a Map into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeMapInternal(Map<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  Set<Map.Entry<String,Object>> entries=val.entrySet();
  writeInt(entries.size());
  for (  Map.Entry<String,Object> e : entries) {
    writeValue(e.getKey());
    writeValue(e.getValue());
  }
}
Program: 183666
Project: 183666
Buggy source:
void replaceTextfieldText(int oldStart,int oldEnd,String replace,int newStart,int newEnd){
  HashMap arg=new HashMap();
  arg.put("String_Node_Str",new WebViewCore.FocusData(mFocusData));
  arg.put("String_Node_Str",replace);
  arg.put("String_Node_Str",new Integer(newStart));
  arg.put("String_Node_Str",new Integer(newEnd));
  mTextGeneration++;
  mWebViewCore.sendMessage(EventHub.REPLACE_TEXT,oldStart,oldEnd,arg);
}

Fixed version (ground truth):
void replaceTextfieldText(int oldStart,int oldEnd,String replace,int newStart,int newEnd){
  HashMap arg=new HashMap();
  arg.put("String_Node_Str",new WebViewCore.FocusData(mFocusData));
  arg.put("String_Node_Str",replace);
  arg.put("String_Node_Str",Integer.valueOf(newStart));
  arg.put("String_Node_Str",Integer.valueOf(newEnd));
  mTextGeneration++;
  mWebViewCore.sendMessage(EventHub.REPLACE_TEXT,oldStart,oldEnd,arg);
}
Program: 183669
Project: 183669
Buggy source:
private void runStart(){
  Intent intent=makeIntent();
  if (intent != null) {
    System.out.println("String_Node_Str" + intent);
    try {
      intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK);
      int res=mAm.startActivity(null,intent,intent.getType(),null,0,null,null,0,false,mDebugOption);
switch (res) {
case IActivityManager.START_SUCCESS:
        break;
case IActivityManager.START_CLASS_NOT_FOUND:
      System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + intent.getComponent().toShortString() + "String_Node_Str");
  break;
case IActivityManager.START_DELIVERED_TO_TOP:
System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_INTENT_NOT_RESOLVED:
System.err.println("String_Node_Str" + "String_Node_Str" + intent.toString());
break;
case IActivityManager.START_RETURN_INTENT_TO_CALLER:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_TASK_TO_FRONT:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
default :
System.err.println("String_Node_Str" + "String_Node_Str" + res);
break;
}
}
 catch (RemoteException e) {
System.err.println("String_Node_Str");
System.err.println("String_Node_Str" + "String_Node_Str");
}
}
}

Fixed version (ground truth):
private void runStart(){
  Intent intent=makeIntent();
  if (intent != null) {
    System.out.println("String_Node_Str" + intent);
    try {
      intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      int res=mAm.startActivity(null,intent,intent.getType(),null,0,null,null,0,false,mDebugOption);
switch (res) {
case IActivityManager.START_SUCCESS:
        break;
case IActivityManager.START_SWITCHES_CANCELED:
      System.err.println("String_Node_Str" + "String_Node_Str");
    break;
case IActivityManager.START_DELIVERED_TO_TOP:
  System.err.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_RETURN_INTENT_TO_CALLER:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_TASK_TO_FRONT:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_INTENT_NOT_RESOLVED:
System.err.println("String_Node_Str" + "String_Node_Str" + intent.toString());
break;
case IActivityManager.START_CLASS_NOT_FOUND:
System.err.println("String_Node_Str");
System.err.println("String_Node_Str" + intent.getComponent().toShortString() + "String_Node_Str");
break;
case IActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
case IActivityManager.START_PERMISSION_DENIED:
System.err.println("String_Node_Str" + "String_Node_Str");
break;
default :
System.err.println("String_Node_Str" + "String_Node_Str" + res);
break;
}
}
 catch (RemoteException e) {
System.err.println("String_Node_Str");
System.err.println("String_Node_Str" + "String_Node_Str");
}
}
}