Program: 145023
Project: 145023
Buggy source:
/** 
 * NOTE: Only applicable for Questions right now, not any other kind of IFormElement
 * @param questionIndex
 * @param form
 * @param initViewState
 * @return
 */
public ChatterboxWidget getWidget(FormIndex questionIndex,FormEntryModel model,int initViewState){
  IWidgetStyle collapsedStyle=null;
  IWidgetStyleEditable expandedStyle=null;
  FormEntryPrompt prompt=model.getQuestionPrompt(questionIndex);
  int controlType=prompt.getControlType();
  int dataType=prompt.getDataType();
  String appearanceAttr=prompt.getPromptAttributes();
  collapsedStyle=new CollapsedWidget();
  ((CollapsedWidget)collapsedStyle).setSeekable(this.readOnly);
switch (controlType) {
case Constants.CONTROL_INPUT:
case Constants.CONTROL_SECRET:
switch (dataType) {
case Constants.DATATYPE_INTEGER:
      expandedStyle=new NumericEntryWidget();
case Constants.DATATYPE_LONG:
    expandedStyle=new NumericEntryWidget(false,new LongData());
  if (controlType == Constants.CONTROL_SECRET) {
    ((NumericEntryWidget)expandedStyle).setConstraint(TextField.PASSWORD);
  }
break;
case Constants.DATATYPE_DECIMAL:
expandedStyle=new NumericEntryWidget(true,new DecimalData());
if (controlType == Constants.CONTROL_SECRET) {
((NumericEntryWidget)expandedStyle).setConstraint(TextField.PASSWORD);
}
break;
case Constants.DATATYPE_DATE_TIME:
expandedStyle=new DateEntryWidget(true);
break;
case Constants.DATATYPE_DATE:
expandedStyle=new SimpleDateEntryWidget();
expandedStyle=new DateEntryWidget();
break;
case Constants.DATATYPE_TIME:
expandedStyle=new TimeEntryWidget();
break;
case Constants.DATATYPE_GEOPOINT:
expandedStyle=new GeoPointWidget();
break;
}
break;
case Constants.CONTROL_SELECT_ONE:
int style;
if ("String_Node_Str".equals(appearanceAttr)) style=ChoiceGroup.POPUP;
 else style=ChoiceGroup.EXCLUSIVE;
expandedStyle=new SelectOneEntryWidget(style,optimizeEntry);
break;
case Constants.CONTROL_SELECT_MULTI:
expandedStyle=new SelectMultiEntryWidget(optimizeEntry);
break;
case Constants.CONTROL_TEXTAREA:
expandedStyle=new TextEntryWidget();
break;
case Constants.CONTROL_TRIGGER:
expandedStyle=new MessageWidget();
break;
case Constants.CONTROL_IMAGE_CHOOSE:
expandedStyle=new ImageChooserWidget();
break;
case Constants.CONTROL_AUDIO_CAPTURE:
expandedStyle=new AudioCaptureWidget();
break;
}
if (expandedStyle == null) {
expandedStyle=new TextEntryWidget();
if (controlType == Constants.CONTROL_SECRET) {
((TextEntryWidget)expandedStyle).setConstraint(TextField.PASSWORD);
}
String name=String.valueOf(controlType);
Object widget=widgetFactory.getNewInstance(name);
if (widget != null) {
expandedStyle=(IWidgetStyleEditable)widget;
}
}
if (collapsedStyle == null || expandedStyle == null) throw new IllegalStateException("String_Node_Str");
expandedStyle.registerMultimediaController(mediaController);
ChatterboxWidget widget=new ChatterboxWidget(cbox,prompt,initViewState,collapsedStyle,expandedStyle);
prompt.register(widget);
return widget;
}

Fixed version (ground truth):
/** 
 * NOTE: Only applicable for Questions right now, not any other kind of IFormElement
 * @param questionIndex
 * @param form
 * @param initViewState
 * @return
 */
public ChatterboxWidget getWidget(FormIndex questionIndex,FormEntryModel model,int initViewState){
  IWidgetStyle collapsedStyle=null;
  IWidgetStyleEditable expandedStyle=null;
  FormEntryPrompt prompt=model.getQuestionPrompt(questionIndex);
  int controlType=prompt.getControlType();
  int dataType=prompt.getDataType();
  String appearanceAttr=prompt.getPromptAttributes();
  collapsedStyle=new CollapsedWidget();
  ((CollapsedWidget)collapsedStyle).setSeekable(this.readOnly);
switch (controlType) {
case Constants.CONTROL_INPUT:
case Constants.CONTROL_SECRET:
switch (dataType) {
case Constants.DATATYPE_INTEGER:
      expandedStyle=new NumericEntryWidget();
    pw(controlType,(NumericEntryWidget)expandedStyle);
  break;
case Constants.DATATYPE_LONG:
expandedStyle=new NumericEntryWidget(false,new LongData());
pw(controlType,(NumericEntryWidget)expandedStyle);
break;
case Constants.DATATYPE_DECIMAL:
expandedStyle=new NumericEntryWidget(true,new DecimalData());
pw(controlType,(NumericEntryWidget)expandedStyle);
break;
case Constants.DATATYPE_DATE_TIME:
expandedStyle=new DateEntryWidget(true);
break;
case Constants.DATATYPE_DATE:
expandedStyle=new SimpleDateEntryWidget();
expandedStyle=new DateEntryWidget();
break;
case Constants.DATATYPE_TIME:
expandedStyle=new TimeEntryWidget();
break;
case Constants.DATATYPE_GEOPOINT:
expandedStyle=new GeoPointWidget();
break;
}
break;
case Constants.CONTROL_SELECT_ONE:
int style;
if ("String_Node_Str".equals(appearanceAttr)) style=ChoiceGroup.POPUP;
 else style=ChoiceGroup.EXCLUSIVE;
expandedStyle=new SelectOneEntryWidget(style,optimizeEntry);
break;
case Constants.CONTROL_SELECT_MULTI:
expandedStyle=new SelectMultiEntryWidget(optimizeEntry);
break;
case Constants.CONTROL_TEXTAREA:
expandedStyle=new TextEntryWidget();
break;
case Constants.CONTROL_TRIGGER:
expandedStyle=new MessageWidget();
break;
case Constants.CONTROL_IMAGE_CHOOSE:
expandedStyle=new ImageChooserWidget();
break;
case Constants.CONTROL_AUDIO_CAPTURE:
expandedStyle=new AudioCaptureWidget();
break;
}
if (expandedStyle == null) {
expandedStyle=new TextEntryWidget();
if (controlType == Constants.CONTROL_SECRET) {
((TextEntryWidget)expandedStyle).setConstraint(TextField.PASSWORD);
}
String name=String.valueOf(controlType);
Object widget=widgetFactory.getNewInstance(name);
if (widget != null) {
expandedStyle=(IWidgetStyleEditable)widget;
}
}
if (collapsedStyle == null || expandedStyle == null) throw new IllegalStateException("String_Node_Str");
expandedStyle.registerMultimediaController(mediaController);
ChatterboxWidget widget=new ChatterboxWidget(cbox,prompt,initViewState,collapsedStyle,expandedStyle);
prompt.register(widget);
return widget;
}