Program: 107662
Project: 107662
Buggy source:
/** 
 * Creates a preview component for the specified device(video device) used to show video preview from that device.
 * @param device the video device
 * @param preferredWidth the width we prefer for the component
 * @param preferredHeight the height we prefer for the component
 * @return the preview component.
 */
public Object getVideoPreviewComponent(MediaDevice device,int preferredWidth,int preferredHeight){
  ResourceManagementService resources=LibJitsi.getResourceManagementService();
  String noPreviewText=(resources == null) ? "String_Node_Str" : resources.getI18NString("String_Node_Str");
  JLabel noPreview=new JLabel(noPreviewText);
  noPreview.setHorizontalAlignment(SwingConstants.CENTER);
  noPreview.setVerticalAlignment(SwingConstants.CENTER);
  final JComponent videoContainer=new VideoContainer(noPreview,false);
  if ((preferredWidth > 0) && (preferredHeight > 0)) {
    videoContainer.setPreferredSize(new Dimension(preferredWidth,preferredHeight));
  }
  try {
    CaptureDeviceInfo captureDeviceInfo;
    if ((device != null) && ((captureDeviceInfo=((MediaDeviceImpl)device).getCaptureDeviceInfo()) != null)) {
      DataSource dataSource=Manager.createDataSource(captureDeviceInfo.getLocator());
      if ((preferredWidth < 128) || (preferredHeight < 96)) {
        preferredWidth=128;
        preferredHeight=96;
      }
      VideoMediaStreamImpl.selectVideoSize(dataSource,preferredWidth,preferredHeight);
      dataSource.connect();
      Processor player=Manager.createProcessor(dataSource);
      final MediaLocator locator=dataSource.getLocator();
      player.addControllerListener(new ControllerListener(){
        public void controllerUpdate(        ControllerEvent event){
          controllerUpdateForPreview(event,videoContainer,locator);
        }
      }
);
      player.configure();
    }
  }
 catch (  Throwable t) {
    if (t instanceof ThreadDeath)     throw (ThreadDeath)t;
 else     logger.error("String_Node_Str",t);
  }
  return videoContainer;
}

Fixed version (ground truth):
/** 
 * Creates a preview component for the specified device(video device) used to show video preview from that device.
 * @param device the video device
 * @param preferredWidth the width we prefer for the component
 * @param preferredHeight the height we prefer for the component
 * @return the preview component.
 */
public Object getVideoPreviewComponent(MediaDevice device,int preferredWidth,int preferredHeight){
  ResourceManagementService resources=LibJitsi.getResourceManagementService();
  String noPreviewText=(resources == null) ? "String_Node_Str" : resources.getI18NString("String_Node_Str");
  JLabel noPreview=new JLabel(noPreviewText);
  noPreview.setHorizontalAlignment(SwingConstants.CENTER);
  noPreview.setVerticalAlignment(SwingConstants.CENTER);
  final JComponent videoContainer=new VideoContainer(noPreview,false);
  if ((preferredWidth > 0) && (preferredHeight > 0)) {
    videoContainer.setPreferredSize(new Dimension(preferredWidth,preferredHeight));
  }
  try {
    CaptureDeviceInfo captureDeviceInfo;
    if ((device != null) && ((captureDeviceInfo=((MediaDeviceImpl)device).getCaptureDeviceInfo()) != null)) {
      DataSource dataSource=Manager.createDataSource(captureDeviceInfo.getLocator());
      if ((preferredWidth < 128) || (preferredHeight < 96)) {
        preferredWidth=128;
        preferredHeight=96;
      }
      VideoMediaStreamImpl.selectVideoSize(dataSource,preferredWidth,preferredHeight);
      dataSource.connect();
      Processor player=Manager.createProcessor(dataSource);
      final VideoContainerHierarchyListener listener=new VideoContainerHierarchyListener(videoContainer,player);
      videoContainer.addHierarchyListener(listener);
      final MediaLocator locator=dataSource.getLocator();
      player.addControllerListener(new ControllerListener(){
        public void controllerUpdate(        ControllerEvent event){
          controllerUpdateForPreview(event,videoContainer,locator,listener);
        }
      }
);
      player.configure();
    }
  }
 catch (  Throwable t) {
    if (t instanceof ThreadDeath)     throw (ThreadDeath)t;
 else     logger.error("String_Node_Str",t);
  }
  return videoContainer;
}