nus-yam/ex-repair huggingface dataset:
Buggy code:
class DisplayRenderer extends StyledTextRenderer { private StyledText parent ; private int topIndex = - 1 ; private TextLayout [ ] layouts ; DisplayRenderer ( Device device , Font regularFont , StyledText parent , int tabLength ) { } void dispose ( ) { } protected void disposeGC ( GC gc ) { } protected void drawLineBreakSelection ( String line , int lineOffset , int paintX , int paintY , GC gc ) { Point selection = parent . internalGetSelection ( ) ; int lineLength = line . length ( ) ; int selectionStart = Math . max ( 0 , ( ( selection . x ) - lineOffset ) ) ; int selectionEnd = ( selection . y ) - lineOffset ; int lineEndSpaceWidth = getLineEndSpaceWidth ( ) ; int lineHeight = getLineHeight ( ) ; if ( ( ( ( selectionEnd == selectionStart ) || ( selectionEnd < 0 ) ) || ( selectionStart > lineLength ) ) || ( selectionEnd <= lineLength ) ) { return ; } gc . setBackground ( parent . getSelectionBackground ( ) ) ; gc . setForeground ( parent . getSelectionForeground ( ) ) ; if ( ( ( parent . getStyle ( ) ) & ( SWT . FULL_SELECTION ) ) != 0 ) { Rectangle rect = getClientArea ( ) ; gc . fillRectangle ( paintX , paintY , ( ( rect . width ) - paintX ) , lineHeight ) ; } else { boolean isWrappedLine = false ; if ( parent . internalGetWordWrap ( ) ) { StyledTextContent content = getContent ( ) ; int lineEnd = lineOffset + lineLength ; int lineIndex = content . getLineAtOffset ( lineEnd ) ; if ( ( lineIndex < ( ( content . getLineCount ( ) ) - 1 ) ) && ( ( content . getOffsetAtLine ( ( lineIndex + 1 ) ) ) == lineEnd ) ) { isWrappedLine = true ; } } <START_BUG> if ( isWrappedLine == false ) { <END_BUG> gc . fillRectangle ( paintX , paintY , lineEndSpaceWidth , lineHeight ) ; } } } protected int [ ] getBidiSegments ( int lineOffset , String lineText ) { } protected Rectangle getClientArea ( ) { } protected StyledTextContent getContent ( ) { } protected GC getGC ( ) { } protected int getHorizontalPixel ( ) { } protected int getLeftMargin ( ) { } protected StyledTextEvent getLineBackgroundData ( int lineOffset , String line ) { } protected StyledTextEvent getLineStyleData ( int lineOffset , String line ) { } protected int getOrientation ( ) { } protected int getRightMargin ( ) { } protected Color getSelectionBackground ( ) { } protected Color getSelectionForeground ( ) { } protected Point getSelection ( ) { } protected boolean getWordWrap ( ) { } protected boolean isFullLineSelection ( ) { } TextLayout createTextLayout ( int lineOffset ) { } void disposeTextLayout ( TextLayout layout ) { } void updateTopIndex ( ) { } }

Fix:
if ( ! isWrappedLine ) {
Buggy code:
public class TestWeatherContract extends AndroidTestCase { private static final String TEST_WEATHER_LOCATION = "//North<seq2seq4repair_space>Pole" ; private static final long TEST_WEATHER_DATE = 1419033600L ; public void testBuildWeatherLocation ( ) { Uri locationUri = WeatherEntry . buildWeatherLocation ( TestWeatherContract . TEST_WEATHER_LOCATION ) ; assertNotNull ( ( "Error:<seq2seq4repair_space>Null<seq2seq4repair_space>Uri<seq2seq4repair_space>returned.<seq2seq4repair_space>You<seq2seq4repair_space>must<seq2seq4repair_space>fill-in<seq2seq4repair_space>buildWeatherLocation<seq2seq4repair_space>in<seq2seq4repair_space>" + "WeatherContract." ) , locationUri ) ; assertEquals ( "Error:<seq2seq4repair_space>Weather<seq2seq4repair_space>location<seq2seq4repair_space>not<seq2seq4repair_space>properly<seq2seq4repair_space>appended<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>end<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>Uri" , TestWeatherContract . TEST_WEATHER_LOCATION , locationUri . getLastPathSegment ( ) ) ; <START_BUG> assertEquals ( "Error:<seq2seq4repair_space>Weather<seq2seq4repair_space>location<seq2seq4repair_space>Uri<seq2seq4repair_space>doesn't<seq2seq4repair_space>match<seq2seq4repair_space>our<seq2seq4repair_space>expected<seq2seq4repair_space>result" , locationUri . toString ( ) , "content:////com.example.android.sunshine.app//weather//%2FNorth%20Pole" ) ; <END_BUG> } }

Fix:
assertEquals ( "Error:<seq2seq4repair_space>Weather<seq2seq4repair_space>location<seq2seq4repair_space>Uri<seq2seq4repair_space>doesn't<seq2seq4repair_space>match<seq2seq4repair_space>our<seq2seq4repair_space>expected<seq2seq4repair_space>result" , locationUri . toString ( ) , "content:////com.neueve.sunshine.app//weather//%2FNorth%20Pole" ) ;
Buggy code:
public class Main { public static void main ( String [ ] args ) { } private static boolean isNailgun ; public static boolean isNailgun ( ) { } public static void nailMain ( NGContext context ) { } private final Provider < KExceptionManager > kem ; private final Provider < FrontEnd > frontEnd ; private final SimpleScope requestScope ; @ Inject public Main ( Provider < KExceptionManager > kem , Provider < FrontEnd > frontEnd , @ Named ( "requestScope" ) SimpleScope requestScope ) { } public SimpleScope getRequestScope ( ) { } public int runApplication ( String tool , String [ ] args , File workingDir , Map < String , String > env ) { } public int runApplication ( ) { KExceptionManager kem = this . kem . get ( ) ; kem . installForUncaughtExceptions ( ) ; try { <START_BUG> int retval = frontend . get ( ) . main ( ) ; <END_BUG> return retval ; } catch ( ProvisionException e ) { for ( Message m : e . getErrorMessages ( ) ) { if ( ! ( ( m . getCause ( ) ) instanceof KEMException ) ) { throw e ; } else { KEMException ex = ( ( KEMException ) ( m . getCause ( ) ) ) ; ex . register ( kem ) ; } } kem . print ( ) ; return 1 ; } } public static void seedInjector ( SimpleScope scope , String tool , String [ ] args , File workingDir , Map < String , String > env ) { } public static Injector getInjector ( String tool ) { } private static void invalidJarArguments ( ) { } }

Fix:
int retval = frontEnd . get ( ) . main ( ) ;
Buggy code:
public class XPathExtractor extends AbstractTestElement implements Serializable , PostProcessor { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final String MATCH_NR = "matchNr" ; private static final String XPATH_QUERY = "XPathExtractor.xpathQuery" ; private static final String REFNAME = "XPathExtractor.refname" ; private static final String DEFAULT = "XPathExtractor.default" ; private static final String TOLERANT = "XPathExtractor.tolerant" ; private static final String NAMESPACE = "XPathExtractor.namespace" ; private static final String QUIET = "XPathExtractor.quiet" ; private static final String REPORT_ERRORS = "XPathExtractor.report_errors" ; private static final String SHOW_WARNINGS = "XPathExtractor.show_warnings" ; private String concat ( String s1 , String s2 ) { } public void process ( ) { } public Object clone ( ) { } public void setXPathQuery ( String val ) { } public String getXPathQuery ( ) { } public void setRefName ( String refName ) { } public String getRefName ( ) { } public void setDefaultValue ( String val ) { } public String getDefaultValue ( ) { } public void setTolerant ( boolean val ) { } public boolean isTolerant ( ) { } public void setNameSpace ( boolean val ) { } public boolean useNameSpace ( ) { } public void setReportErrors ( boolean val ) { } public boolean reportErrors ( ) { } public void setShowWarnings ( boolean val ) { } public boolean showWarnings ( ) { } public void setQuiet ( boolean val ) { } public boolean isQuiet ( ) { } private Document parseResponse ( SampleResult result ) throws IOException , UnsupportedEncodingException , ParserConfigurationException , TidyException , SAXException { String unicodeData = result . getResponseDataAsString ( ) ; byte [ ] utf8data = unicodeData . getBytes ( "UTF-8" ) ; ByteArrayInputStream in = new ByteArrayInputStream ( utf8data ) ; <START_BUG> return XPathUtil . makeDocument ( in , false , false , useNameSpace ( ) , isTolerant ( ) , isQuiet ( ) , showWarnings ( ) , reportErrors ( ) ) ; <END_BUG> } private void getValuesForXPath ( Document d , String query , JMeterVariables vars , String refName ) throws TransformerException { } }

Fix:
return XPathUtil . makeDocument ( in , false , false , useNameSpace ( ) , isTolerant ( ) , isQuiet ( ) , showWarnings ( ) , reportErrors ( ) , true ) ;
Buggy code:
public class ElementUtils { static Logger log = Logger . getLogger ( "org.jboss.as.messaging" ) ; enum StaxEvent { START_ELEMENT ( 1 ) , END_ELEMENT ( 2 ) , PROCESSING_INSTRUCTION ( 3 ) , CHARACTERS ( 4 ) , COMMENT ( 5 ) , SPACE ( 6 ) , START_DOCUMENT ( 7 ) , END_DOCUMENT ( 8 ) , ENTITY_REFERENCE ( 9 ) , ATTRIBUTE ( 10 ) , DTD ( 11 ) , CDATA ( 12 ) , NAMESPACE ( 13 ) , NOTATION_DECLARATION ( 14 ) , ENTITY_DECLARATION ( 15 ) ; private static ElementUtils . StaxEvent [ ] EVENTS = ElementUtils . StaxEvent . values ( ) ; private final int tag ; StaxEvent ( int tag ) { } static ElementUtils . StaxEvent tagToEvent ( int tag ) { } } static XMLStreamException unexpectedAttribute ( final XMLExtendedStreamReader reader , final int index ) { } static XMLStreamException unexpectedElement ( final XMLExtendedStreamReader reader ) { } static TransportConfiguration parseTransportConfiguration ( final XMLExtendedStreamReader reader , String name , Element parentElement ) throws XMLStreamException { Map < String , Object > params = new HashMap < String , Object > ( ) ; int tag = reader . getEventType ( ) ; String localName = null ; String clazz = null ; do { tag = reader . nextTag ( ) ; localName = reader . getLocalName ( ) ; Element element = Element . forName ( localName ) ; if ( ( localName . equals ( parentElement . getLocalName ( ) ) ) == true ) break ; switch ( element ) { case FACTORY_CLASS : <START_BUG> clazz = reader . getElementText ( ) ; <END_BUG> break ; case PARAM : int count = reader . getAttributeCount ( ) ; String key = null ; String value = null ; for ( int n = 0 ; n < count ; n ++ ) { String attrName = reader . getAttributeLocalName ( n ) ; Attribute attribute = Attribute . forName ( attrName ) ; switch ( attribute ) { case KEY : key = reader . getAttributeValue ( n ) ; break ; case VALUE : value = reader . getAttributeValue ( n ) ; break ; default : throw ElementUtils . unexpectedAttribute ( reader , n ) ; } } reader . discardRemainder ( ) ; params . put ( key , value ) ; break ; } } while ( reader . hasNext ( ) ) ; return new TransportConfiguration ( clazz , params , name ) ; } static void writeTransportConfiguration ( TransportConfiguration config , XMLExtendedStreamWriter streamWriter ) throws XMLStreamException { } static void writeSimpleElement ( final Element element , final String content , final XMLExtendedStreamWriter streamWriter ) throws XMLStreamException { } static void writeSimpleElement ( final Element element , final SimpleString content , final XMLExtendedStreamWriter streamWriter ) throws XMLStreamException { } static void writeRoles ( final Set < Role > roles , final XMLExtendedStreamWriter streamWriter ) throws XMLStreamException { } private static void storeRoleToType ( Attribute type , String role , Map < Attribute , String > rolesByType ) { } }

Fix:
clazz = reader . getElementText ( ) . trim ( ) ;
Buggy code:
public class ViewFactory implements IExtensionChangeHandler { private ReferenceCounter counter ; private HashMap mementoTable = new HashMap ( ) ; WorkbenchPage page ; IViewRegistry viewReg ; static final String ID_SEP = ":" ; static String getKey ( String id , String secondaryId ) { } static String getKey ( IViewReference viewRef ) { } static String extractPrimaryId ( String compoundId ) { } static String extractSecondaryId ( String compoundId ) { } static boolean hasWildcard ( String viewId ) { } public ViewFactory ( WorkbenchPage page , IViewRegistry reg ) { } public IViewReference createView ( final String id ) throws PartInitException { } public IViewReference createView ( String id , String secondaryId ) throws PartInitException { } public IViewReference [ ] getViewReferences ( ) { } public IViewReference getView ( String id ) { } public IViewReference getView ( String id , String secondaryId ) { } public IViewRegistry getViewRegistry ( ) { } public IViewReference [ ] getViews ( ) { } public WorkbenchPage getWorkbenchPage ( ) { } public int getReferenceCount ( IViewReference viewRef ) { } public void releaseView ( IViewReference viewRef ) { } public IStatus restoreState ( IMemento memento ) { IMemento [ ] mem = memento . getChildren ( TAG_VIEW ) ; for ( int i = 0 ; i < ( mem . length ) ; i ++ ) { restoreViewState ( mem [ i ] ) ; } <START_BUG> return new Status ( IStatus . OK , PlatformUI . PLUGIN_ID , 0 , "" , null ) ; <END_BUG> } public IStatus saveState ( IMemento memento ) { } public IMemento saveViewState ( IMemento memento , IViewReference ref , MultiStatus res ) { } public void restoreViewState ( IMemento memento ) { } IMemento getViewState ( String key ) { } public void removeExtension ( IExtension source , Object [ ] objects ) { } public void addExtension ( IExtensionTracker tracker , IExtension extension ) { } }

Fix:
return Status . OK_STATUS ;
Buggy code:
@ RunWith ( Arquillian . class ) public class JBossPDPInteroperabilityTestCase { private static Logger LOGGER = Logger . getLogger ( JBossPDPInteroperabilityTestCase . class ) ; @ Inject JBossPDPServiceBean pdpServiceBean ; @ Deployment public static JavaArchive deployment ( ) { } @ Test public void testInteropTestWithXMLRequests ( ) throws Exception { } @ Test public void testInteropTestWithObjects ( ) throws Exception { } @ Test public void testPoliciesLoadedFromDir ( ) throws Exception { } private JBossPDP createPDPForMed ( final File policyDir ) throws IOException { } private int getDecisionForStr ( PolicyDecisionPoint pdp , String requestStr ) throws Exception { final RequestContext request = RequestResponseContextFactory . createRequestCtx ( ) ; <START_BUG> request . readRequest ( IOUtils . toInputStream ( requestStr , null ) ) ; <END_BUG> return getDecision ( pdp , request ) ; } private int getDecision ( PolicyDecisionPoint pdp , String requestFileLoc ) throws Exception { } private static int getDecision ( PolicyDecisionPoint pdp , RequestContext request ) { } private RequestContext getRequestContext ( String reqTradeAppr , String reqCreditAppr , int buyPrice ) throws Exception { } private SubjectType createSubject ( String reqTradeAppr , String reqCreditAppr , int buyPrice ) { } private ResourceType createResource ( ) { } private ActionType createAction ( ) { } }

Fix:
request . readRequest ( IOUtils . toInputStream ( requestStr ) ) ;
Buggy code:
public class PlayerHasItem extends EntityConditionalStatement { private final boolean strict ; private final Collection < ModDamageItemStack > items ; public PlayerHasItem ( boolean inverted , EntityReference entityReference , boolean strict , Collection < ModDamageItemStack > items ) { } @ Override public boolean condition ( TargetEventInfo eventInfo ) { } public static void register ( ) { <START_BUG> ConditionalRoutine . registerConditionalStatement ( Pattern . compile ( "(!?)(\\w+)\\.has(allitems|item)\\.(\\w+)" , Pattern . CASE_INSENSITIVE ) , new PlayerHasItem . StatementBuilder ( ) ) ; <END_BUG> } protected static class StatementBuilder extends ConditionalStatement . StatementBuilder { @ Override public PlayerHasItem getNew ( Matcher matcher ) { } } }

Fix:
ConditionalRoutine . registerConditionalStatement ( Pattern . compile ( "(!?)(\\w+)\\.has(allitems|item)\\.(.*)" , Pattern . CASE_INSENSITIVE ) , new PlayerHasItem . StatementBuilder ( ) ) ;
Buggy code:
public class PositionTestPanel extends JPanel implements MouseListener , MouseMotionListener , MouseWheelListener { private final ConfigData config ; private final Analysis analysis ; private double probability = 0.5 ; private int x ; private int y ; public PositionTestPanel ( ConfigData config , Analysis analysis ) { } @ Override protected void paintComponent ( Graphics g ) { super . paintComponent ( g ) ; Graphics2D g2 = ( ( Graphics2D ) ( g ) ) ; g2 . drawString ( String . format ( "Probability:<seq2seq4repair_space>%.2f" , probability ) , 10 , 15 ) ; g2 . draw ( new Ellipse2D . Double ( ( ( x ) - 2 ) , ( ( y ) - 2 ) , 4 , 4 ) ) ; for ( Zone zone : config . getZones ( ) ) { Box scaled = zone . area . scale ( getWidth ( ) , getHeight ( ) ) ; Rectangle2D . Double rect = new Rectangle2D . Double ( ( ( int ) ( scaled . getLeft ( ) ) ) , ( ( int ) ( scaled . getTop ( ) ) ) , ( ( int ) ( scaled . getWidth ( ) ) ) , ( ( int ) ( scaled . getHeight ( ) ) ) ) ; g2 . setColor ( new Color ( 100 , 100 , 100 , 100 ) ) ; g2 . fill ( rect ) ; } List < PositionDataFrame > path = analysis . getPath ( ) ; Point lastPoint = null ; for ( PositionDataFrame data : path ) { Point location = data . getLocation ( ) ; int xNew = ( ( int ) ( ( location . x ) * ( getWidth ( ) ) ) ) ; int yNew = ( ( int ) ( ( location . y ) * ( getHeight ( ) ) ) ) ; if ( lastPoint != null ) { int xOld = ( ( int ) ( ( lastPoint . x ) * ( getWidth ( ) ) ) ) ; int yOld = ( ( int ) ( ( lastPoint . y ) * ( getHeight ( ) ) ) ) ; g2 . setColor ( Color . RED ) ; g2 . drawLine ( xOld , yOld , xNew , yNew ) ; } Ellipse2D . Double plotted = new Ellipse2D . Double ( ( xNew - 2 ) , ( yNew - 2 ) , 4 , 4 ) ; <START_BUG> if ( ! ( data . getZoneId ( ) . equals ( "N//A" ) ) ) <END_BUG> g2 . setColor ( Color . BLUE ) ; g2 . draw ( plotted ) ; g2 . fill ( plotted ) ; lastPoint = location ; } } @ Override public void mouseDragged ( MouseEvent e ) { } @ Override public void mouseMoved ( MouseEvent e ) { } @ Override public void mouseWheelMoved ( MouseWheelEvent e ) { } @ Override public void mouseClicked ( MouseEvent e ) { } public void mouseEntered ( MouseEvent e ) { } public void mouseExited ( MouseEvent e ) { } public void mousePressed ( MouseEvent e ) { } public void mouseReleased ( MouseEvent e ) { } private void onNewEvent ( ) { } }

Fix:
if ( ( data . getZone ( ) ) != null )
Buggy code:
public class Palette extends Panel { private static final String SELECTED_HEADER_ID = "selectedHeader" ; private static final String AVAILABLE_HEADER_ID = "availableHeader" ; private static final long serialVersionUID = 1L ; private IModel choicesModel ; private IChoiceRenderer choiceRenderer ; private int rows ; private Recorder recorderComponent ; private Component choicesComponent ; private Component selectionComponent ; private static final ResourceReference JAVASCRIPT = new ResourceReference ( Palette . class , "palette.js" ) ; private static final ResourceReference CSS = new ResourceReference ( Palette . class , "palette.css" ) ; private static final ResourceReference UP_IMAGE = new ResourceReference ( Palette . class , "up.gif" ) ; private static final ResourceReference DOWN_IMAGE = new ResourceReference ( Palette . class , "down.gif" ) ; private static final ResourceReference REMOVE_IMAGE = new ResourceReference ( Palette . class , "remove.gif" ) ; private static final ResourceReference ADD_IMAGE = new ResourceReference ( Palette . class , "add.gif" ) ; public Palette ( String id , IModel choicesModel , IChoiceRenderer choiceRenderer , int rows , boolean allowOrder ) { } public Palette ( String id , IModel model , IModel choicesModel , IChoiceRenderer choiceRenderer , int rows , boolean allowOrder ) { } protected ResourceReference getCSS ( ) { } protected StyleSheetReference getStyleSheet ( ) { } public final boolean isPaletteEnabled ( ) { } public Iterator getSelectedChoices ( ) { } public Iterator getUnselectedChoices ( ) { } private Recorder newRecorderComponent ( ) { } protected Component newAvailableHeader ( String componentId ) { } protected Component newSelectedHeader ( String componentId ) { } protected Component newDownComponent ( ) { } protected Component newUpComponent ( ) { } protected Component newRemoveComponent ( ) { } protected Component newAddComponent ( ) { } protected Component newSelectionComponent ( ) { } protected Component newChoicesComponent ( ) { } private Component getChoicesComponent ( ) { } private Component getSelectionComponent ( ) { } public final Recorder getRecorderComponent ( ) { } public Collection getChoices ( ) { <START_BUG> return ( ( Collection ) ( choicesModel . getObject ( this ) ) ) ; <END_BUG> } public Collection getModelCollection ( ) { } public IChoiceRenderer getChoiceRenderer ( ) { } public int getRows ( ) { } protected final void updateModel ( ) { } protected String buildJSCall ( String funcName ) { } public String getChoicesOnFocusJS ( ) { } public String getSelectionOnFocusJS ( ) { } public String getAddOnClickJS ( ) { } public String getRemoveOnClickJS ( ) { } public String getUpOnClickJS ( ) { } public String getDownOnClickJS ( ) { } protected void internalOnDetach ( ) { } private class PaletteButton extends WebMarkupContainer { private static final long serialVersionUID = 1L ; public PaletteButton ( String id ) { } protected void onComponentTag ( ComponentTag tag ) { } } }

Fix:
return ( ( Collection ) ( choicesModel . getObject ( ) ) ) ;
Buggy code:
abstract class AbstractChoice extends FormComponent { private IModel choices ; private IChoiceRenderer renderer ; public AbstractChoice ( final String id ) { } public AbstractChoice ( final String id , final List choices ) { } public AbstractChoice ( final String id , final List choices , final IChoiceRenderer renderer ) { } public AbstractChoice ( final String id , IModel model , final List choices ) { } public AbstractChoice ( final String id , IModel model , final List choices , final IChoiceRenderer renderer ) { } public AbstractChoice ( final String id , final IModel choices ) { } public AbstractChoice ( final String id , final IModel choices , final IChoiceRenderer renderer ) { } public AbstractChoice ( final String id , IModel model , final IModel choices ) { } public AbstractChoice ( final String id , IModel model , final IModel choices , final IChoiceRenderer renderer ) { } public List getChoices ( ) { } public final void setChoices ( List choices ) { } public final IChoiceRenderer getChoiceRenderer ( ) { } public final void setChoiceRenderer ( IChoiceRenderer renderer ) { } protected void detachModel ( ) { } protected String getDefaultChoice ( final Object selected ) { } protected abstract boolean isSelected ( final Object object , int index ) { } protected void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected void appendOptionHtml ( StringBuffer buffer , Object choice , int index ) { final String displayValue = renderer . getDisplayValue ( choice ) ; buffer . append ( "\n<option<seq2seq4repair_space>" ) ; if ( isSelected ( choice , index ) ) { buffer . append ( "selected=\"selected\"" ) ; } buffer . append ( "value=\"" ) ; buffer . append ( renderer . getIdValue ( choice , index ) ) ; buffer . append ( "\">" ) ; <START_BUG> String display = getLocalizer ( ) . getString ( ( ( ( getId ( ) ) + "." ) + displayValue ) , this , displayValue ) ; <END_BUG> String escaped = Strings . escapeMarkup ( display , false , true ) ; buffer . append ( escaped ) ; buffer . append ( "<//option>" ) ; } protected boolean supportsPersistence ( ) { } public abstract void updateModel ( ) { } }

Fix:
String display = getLocalizer ( ) . getString ( displayValue , this , displayValue ) ;
Buggy code:
public class InstanceOfExpression extends OperatorExpression { public Expression expression ; public TypeReference type ; public InstanceOfExpression ( Expression expression , TypeReference type , int operator ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public StringBuffer printExpressionNoParenthesis ( int indent , StringBuffer output ) { } public void reportIllegalCast ( Scope scope , TypeBinding castType , TypeBinding expressionType ) { } public TypeBinding resolveType ( BlockScope scope ) { constant = NotAConstant ; TypeBinding expressionType = expression . resolveType ( scope ) ; TypeBinding checkedType = type . resolveType ( scope ) ; if ( ( expressionType == null ) || ( checkedType == null ) ) return null ; <START_BUG> if ( ( ( checkedType . isTypeVariable ( ) ) || ( checkedType . isParameterizedType ( ) ) ) || ( checkedType . isGenericType ( ) ) ) { <END_BUG> scope . problemReporter ( ) . illegalInstanceOfGenericType ( checkedType , this ) ; } else { checkCastTypesCompatibility ( scope , checkedType , expressionType , null ) ; } return this . resolvedType = BooleanBinding ; } public void tagAsUnnecessaryCast ( Scope scope , TypeBinding castType ) { } public void traverse ( ASTVisitor visitor , BlockScope scope ) { } }

Fix:
if ( ( ( checkedType . isTypeVariable ( ) ) || ( checkedType . isBoundParameterizedType ( ) ) ) || ( checkedType . isGenericType ( ) ) ) {
Buggy code:
public class TimesFragment extends Fragment { private QuickTimesView mTimesView ; private ClientSession mSession ; @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { View view = inflater . inflate ( fragment_times , null ) ; mTimesView = ( ( QuickTimesView ) ( view . findViewById ( my_fenshi_view ) ) ) ; <START_BUG> mTimesView . setTimeSequence ( mSession . mMdSequence , mSession . getCurrentInstrument ( ) , mSession . getStrategyName ( ) ) ; <END_BUG> return view ; } @ Override public void onAttach ( Activity activity ) { } }

Fix:
mTimesView . setTimeSequence ( mSession . mMdSequence , mSession . getInstrument ( ) , mSession . getStrategyName ( ) ) ;
Buggy code:
public abstract class AbstractTypeDeclaration extends BodyDeclaration { SimpleName typeName = null ; ASTNode . NodeList bodyDeclarations ; abstract ChildListPropertyDescriptor internalBodyDeclarationsProperty ( ) { } public final ChildListPropertyDescriptor getBodyDeclarationsProperty ( ) { } abstract ChildPropertyDescriptor internalNameProperty ( ) { } public final ChildPropertyDescriptor getNameProperty ( ) { } static final ChildListPropertyDescriptor internalBodyDeclarationPropertyFactory ( Class nodeClass ) { } static final ChildPropertyDescriptor internalNamePropertyFactory ( Class nodeClass ) { <START_BUG> return new ChildPropertyDescriptor ( nodeClass , "name" , Name . class , ASTNode . MANDATORY , ASTNode . NO_CYCLE_RISK ) ; <END_BUG> } AbstractTypeDeclaration ( AST ast ) { } public SimpleName getName ( ) { } public void setName ( SimpleName typeName ) { } public List bodyDeclarations ( ) { } public boolean isPackageMemberTypeDeclaration ( ) { } public boolean isMemberTypeDeclaration ( ) { } public boolean isLocalTypeDeclaration ( ) { } public final ITypeBinding resolveBinding ( ) { } abstract ITypeBinding internalResolveBinding ( ) { } int memSize ( ) { } }

Fix:
return new ChildPropertyDescriptor ( nodeClass , "name" , SimpleName . class , ASTNode . MANDATORY , ASTNode . NO_CYCLE_RISK ) ;
Buggy code:
public class RegisterActivity extends Activity { private static final String REGEX = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{6,20})" ; private final int MIN_LEN = 6 ; private EditText password ; private EditText email ; private EditText rePassword ; private EditText userName ; private TextView userNameTxt ; private TextView passwordTxt ; private TextView rePasswordTxt ; private TextView wrongInputTxt ; private TextView emailTxt ; private Button signUp ; private String user ; private String firstPass ; private String secondPass ; private String emailStr ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } private class insertUserTask extends AsyncTask < apiConnectorDB , Long , Boolean > { private ArrayList < NameValuePair > userInfoArray ; private insertUserTask ( ArrayList < NameValuePair > userInfoArray ) { } @ Override protected Boolean doInBackground ( apiConnectorDB ... params ) { } @ Override protected void onPostExecute ( Boolean aBoolean ) { } } @ Override protected void onRestart ( ) { } @ Override protected void onStart ( ) { } @ Override protected void onResume ( ) { } @ Override protected void onPause ( ) { } @ Override protected void onDestroy ( ) { } @ Override protected void onStop ( ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } private void signInNotSuccessful ( ) { } private void signInSuccessful ( ) { } private void setViewOfFields ( ) { <START_BUG> signUp = ( ( Button ) ( findViewById ( singUp_btn_reg ) ) ) ; <END_BUG> email = ( ( EditText ) ( findViewById ( email_et ) ) ) ; password = ( ( EditText ) ( findViewById ( password_et_reg ) ) ) ; rePassword = ( ( EditText ) ( findViewById ( rePassword_et_reg ) ) ) ; userName = ( ( EditText ) ( findViewById ( userName_reg ) ) ) ; emailTxt = ( ( TextView ) ( findViewById ( email_reg ) ) ) ; userNameTxt = ( ( TextView ) ( findViewById ( userName_txt_reg ) ) ) ; passwordTxt = ( ( TextView ) ( findViewById ( password_reg ) ) ) ; rePasswordTxt = ( ( TextView ) ( findViewById ( rePassword_reg ) ) ) ; wrongInputTxt = ( ( TextView ) ( findViewById ( wrong_reg ) ) ) ; } private boolean validations ( String email , String password , String rePassword ) { } private boolean isValidEmail ( CharSequence target ) { } private boolean isValidPassword ( String password , String rePassword ) { } private void wrongPassInput ( ) { } }

Fix:
signUp = ( ( Button ) ( findViewById ( sginUp_btn_reg ) ) ) ;
Buggy code:
public abstract class AndPattern extends SearchPattern { public AndPattern ( int matchMode , boolean isCaseSensitive ) { } public void findIndexMatches ( IndexInput input , IIndexSearchRequestor requestor , int detailLevel , IProgressMonitor progressMonitor , IJavaSearchScope scope ) throws IOException { if ( ( progressMonitor != null ) && ( progressMonitor . isCanceled ( ) ) ) throw new OperationCanceledException ( ) ; long [ ] potentialRefs = null ; int maxRefs = - 1 ; this . resetQuery ( ) ; do { <START_BUG> IEntryResult [ ] entries = input . queryEntriesPrefixedBy ( indexEntryPrefix ( ) , isCaseSensitive ) ; <END_BUG> if ( entries == null ) break ; int numFiles = input . getNumFiles ( ) ; long [ ] references = null ; int referencesLength = - 1 ; for ( int i = 0 , max = entries . length ; i < max ; i ++ ) { if ( ( progressMonitor != null ) && ( progressMonitor . isCanceled ( ) ) ) throw new OperationCanceledException ( ) ; IEntryResult entry = entries [ i ] ; decodeIndexEntry ( entry ) ; if ( matchIndexEntry ( ) ) { int [ ] fileReferences = entry . getFileReferences ( ) ; for ( int j = 0 , refLength = fileReferences . length ; j < refLength ; j ++ ) { int fileReference = fileReferences [ j ] ; int vectorIndex = fileReference // 64 ; if ( references == null ) { referencesLength = ( numFiles // 64 ) + 1 ; references = new long [ referencesLength ] ; } long mask = 1L << ( fileReference % 64 ) ; references [ vectorIndex ] |= mask ; } } } if ( references == null ) { return ; } else { if ( potentialRefs == null ) { potentialRefs = references ; maxRefs = numFiles ; } else { for ( int i = 0 , length = references . length ; i < length ; i ++ ) { if ( i < ( potentialRefs . length ) ) { potentialRefs [ i ] &= references [ i ] ; } else { potentialRefs [ i ] = 0 ; } } } } } while ( this . hasNextQuery ( ) ) ; if ( potentialRefs != null ) { int [ ] refs = new int [ maxRefs ] ; int refsLength = 0 ; for ( int reference = 1 ; reference <= maxRefs ; reference ++ ) { int vectorIndex = reference // 64 ; if ( ( ( potentialRefs [ vectorIndex ] ) & ( 1L << ( reference % 64 ) ) ) != 0 ) { refs [ ( refsLength ++ ) ] = reference ; } } System . arraycopy ( refs , 0 , ( refs = new int [ refsLength ] ) , 0 , refsLength ) ; this . feedIndexRequestor ( requestor , detailLevel , refs , input , scope ) ; } } protected abstract boolean hasNextQuery ( ) { } protected abstract void resetQuery ( ) { } }

Fix:
IEntryResult [ ] entries = input . queryEntriesPrefixedBy ( indexEntryPrefix ( ) ) ;
Buggy code:
public class JMSQueueReadAttributeHandler extends AbstractRuntimeOnlyHandler { public static final JMSQueueReadAttributeHandler INSTANCE = new JMSQueueReadAttributeHandler ( ) ; private ParametersValidator validator = new ParametersValidator ( ) ; private JMSQueueReadAttributeHandler ( ) { } @ Override public void executeRuntimeStep ( OperationContext context , ModelNode operation ) throws OperationFailedException { validator . validate ( operation ) ; final String attributeName = operation . require ( NAME ) . asString ( ) ; JMSQueueControl control = getControl ( context , operation ) ; if ( control == null ) { ManagementUtil . rollbackOperationWithNoHandler ( context , operation ) ; return ; } if ( MESSAGE_COUNT . getName ( ) . equals ( attributeName ) ) { try { context . getResult ( ) . set ( control . getMessageCount ( ) ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } else if ( SCHEDULED_COUNT . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getScheduledCount ( ) ) ; } else if ( CONSUMER_COUNT . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getConsumerCount ( ) ) ; } else if ( DELIVERING_COUNT . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getDeliveringCount ( ) ) ; } else if ( MESSAGES_ADDED . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getMessagesAdded ( ) ) ; } else if ( QUEUE_ADDRESS . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getAddress ( ) ) ; } else if ( EXPIRY_ADDRESS . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getExpiryAddress ( ) ) ; } else if ( DEAD_LETTER_ADDRESS . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . getDeadLetterAddress ( ) ) ; } else if ( PAUSED . getName ( ) . equals ( attributeName ) ) { try { context . getResult ( ) . set ( control . isPaused ( ) ) ; } catch ( RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } else if ( TEMPORARY . getName ( ) . equals ( attributeName ) ) { context . getResult ( ) . set ( control . isTemporary ( ) ) ; } else { throw MessagingMessages . MESSAGES . unsupportedAttribute ( attributeName ) ; } <START_BUG> context . completeStep ( ) ; <END_BUG> } private JMSQueueControl getControl ( OperationContext context , ModelNode operation ) { } }

Fix:
context . stepCompleted ( ) ;
Buggy code:
public class Ausprobieren { public static void main ( String [ ] args ) throws IOException , ParserConfigurationException , SAXException { Retrieval jRetrieval = new Retrieval ( ) ; <START_BUG> String scenarioXML = jRetrieval . getHTMLwithAuth ( "http:////bp2014w1-dev:1205//" , "http:////bp2014w1-dev:1205//models//1747933626.pm" ) ; <END_BUG> InputSource is = new InputSource ( ) ; is . setCharacterStream ( new StringReader ( scenarioXML ) ) ; DocumentBuilder db = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; Document doc = db . parse ( is ) ; Scenario scen = new Scenario ( "http:////bp2014w1-dev:1205//" ) ; scen . initializeInstanceFromXML ( doc . getDocumentElement ( ) ) ; scen . save ( ) ; } }

Fix:
String scenarioXML = jRetrieval . getHTMLwithAuth ( "http:////bp2014w1-dev:1205//" , "http:////bp2014w1-dev:1205//models//232478344.pm" ) ;
Buggy code:
public final class RequestConditionHolder extends AbstractRequestCondition < RequestConditionHolder > { @ SuppressWarnings ( "rawtypes" ) private final RequestCondition condition ; public RequestConditionHolder ( RequestCondition < ? > requestCondition ) { } public RequestCondition < ? > getCondition ( ) { } @ Override protected Collection < ? > getContent ( ) { } @ Override protected String getToStringInfix ( ) { } @ SuppressWarnings ( "unchecked" ) public RequestConditionHolder combine ( RequestConditionHolder other ) { } private void assertIsCompatible ( RequestConditionHolder other ) { } public RequestConditionHolder getMatchingCondition ( HttpServletRequest request ) { if ( ( condition ) == null ) { return this ; } RequestCondition < ? > match = ( ( RequestCondition < ? > ) ( condition . getMatchingCondition ( request ) ) ) ; <START_BUG> return new RequestConditionHolder ( match ) ; <END_BUG> } @ SuppressWarnings ( "unchecked" ) public int compareTo ( RequestConditionHolder other , HttpServletRequest request ) { } }

Fix:
return match != null ? new RequestConditionHolder ( match ) : null ;
Buggy code:
@ RunWith ( MockitoJUnitRunner . class ) public class TestUserController { @ InjectMocks UserController userController ; @ Mock UserService userService ; @ Mock UserDao userDao ; @ Mock User user ; @ Mock HttpSession session ; @ Mock List < User > userList ; @ SuppressWarnings ( "static-access" ) @ Test public void testControllerConstant ( ) throws Exception { } @ Test public void testPrepareUserDataInputWithZeroValue ( ) throws Exception { } @ Test public void testPrepareUserDataInputWithNullValue ( ) throws Exception { } @ Test public void testPrepareUserDataInputWithUserId ( ) throws Exception { } @ Ignore @ Test public void testaddUserWithGivenID ( ) throws Exception { Mockito . when ( this . user . getName ( ) ) . thenReturn ( "Wolff" ) ; Mockito . when ( this . user . getPrename ( ) ) . thenReturn ( "Manne" ) ; Mockito . when ( this . user . getId ( ) ) . thenReturn ( 1L ) ; Mockito . when ( this . userService . getUserDao ( ) ) . thenReturn ( userDao ) ; final ModelAndView model = this . userController . addUser ( user ) ; <START_BUG> Mockito . verify ( this . userDao , Mockito . times ( 1 ) ) . merge ( user ) ; <END_BUG> assertEquals ( ControllerConstants . USER_LIST , model . getViewName ( ) ) ; } @ Test public void testaddNullUser ( ) throws Exception { } @ Test public void testadd0User ( ) throws Exception { } @ SuppressWarnings ( "unchecked" ) @ Test public void testListUser ( ) throws Exception { } }

Fix:
Mockito . verify ( this . userDao , Mockito . times ( 1 ) ) . update ( user ) ;
Buggy code:
public class EnemyDodgeAI extends EnemyAI { @ Override public Position getRelativePosition ( ) { Position current = new Position ( 0 , 0 ) ; double count = 1 ; for ( Projectile p : Game . projectiles ) { if ( ( p . orientation ) == ( enemy . orientation ) ) continue ; double projectileDir = pos . getDirTo ( p . pos ) ; if ( ( Math . abs ( ( projectileDir - ( p . getCurrentMovement ( ) . x ) ) ) ) < 90 ) { <START_BUG> current . scale ( ( 1 // count ) ) . subtract ( new Position ( projectileDir ) ) . scale ( ( 1 // ( count + 1 ) ) ) ; <END_BUG> count ++ ; } } return current ; } }

Fix:
current = current . subtract ( new Position ( projectileDir ) . scale ( 0.1 ) ) ;
Buggy code:
public class Brute { public static void main ( String [ ] args ) { StdDraw . setXscale ( 0 , 32768 ) ; StdDraw . setYscale ( 0 , 32768 ) ; In file = new In ( args [ 0 ] ) ; int numPoints = file . readInt ( ) ; Point [ ] points = new Point [ numPoints ] ; int i = 0 ; while ( ! ( file . isEmpty ( ) ) ) { int x = file . readInt ( ) ; int y = file . readInt ( ) ; points [ i ] = new Point ( x , y ) ; i ++ ; } for ( int p = 0 ; i < ( points . length ) ; i ++ ) { points [ p ] . draw ( ) ; for ( int j = 0 ; j < ( points . length ) ; j ++ ) { for ( int k = 0 ; k < ( points . length ) ; k ++ ) { for ( int z = 0 ; z < ( points . length ) ; z ++ ) { Point current = points [ p ] ; Point [ ] result = new Point [ 4 ] ; double slope1 = current . slopeTo ( points [ j ] ) ; double slope2 = current . slopeTo ( points [ k ] ) ; double slope3 = current . slopeTo ( points [ z ] ) ; if ( ( slope1 == slope2 ) && ( slope1 == slope3 ) ) { result [ 0 ] = current ; result [ 1 ] = points [ j ] ; result [ 2 ] = points [ k ] ; result [ 3 ] = points [ z ] ; Arrays . sort ( result ) ; result [ 0 ] . drawTo ( result [ 1 ] ) ; result [ 1 ] . drawTo ( result [ 2 ] ) ; result [ 2 ] . drawTo ( result [ 3 ] ) ; <START_BUG> System . out . println ( String . format ( "(%d,<seq2seq4repair_space>%d)<seq2seq4repair_space>-><seq2seq4repair_space>(%d,<seq2seq4repair_space>%d)<seq2seq4repair_space>-><seq2seq4repair_space>(%d,<seq2seq4repair_space>%d)<seq2seq4repair_space>-><seq2seq4repair_space>(%d,<seq2seq4repair_space>%d)" , result [ 0 ] . x , result [ 0 ] . y , result [ 1 ] . x , result [ 1 ] . y , result [ 2 ] . x , result [ 2 ] . y , result [ 3 ] . x , result [ 3 ] . y ) ) ; <END_BUG> } } } } } } }

Fix:
System . out . println ( String . format ( "%s<seq2seq4repair_space>-><seq2seq4repair_space>%s<seq2seq4repair_space>-><seq2seq4repair_space>%s<seq2seq4repair_space>-><seq2seq4repair_space>%s" , result [ 0 ] . toString ( ) , result [ 1 ] . toString ( ) , result [ 2 ] . toString ( ) , result [ 3 ] . toString ( ) ) ) ;
Buggy code:
public class CircleObstacle extends Obstacle { private final int FRAMES_PER_SECOND = 50 ; private float originalDiameter ; SnakeBoundary mySnake ; public Ellipse2D . Float circle = new Ellipse2D . Float ( ) ; public CircleObstacle ( int duration , float xloc , float yloc , float d , SnakeBoundary snake ) { } @ Override public boolean update ( ) throws GameOverException { } @ Override public boolean haveCollided ( ) { double snakeX = ( mySnake . getOrigin ( ) . getX ( ) ) + ( mySnake . getOuterRadius ( ) ) ; double snakeY = ( mySnake . getOrigin ( ) . getY ( ) ) + ( mySnake . getOuterRadius ( ) ) ; double d = circle . getWidth ( ) ; double circleX = circle . getCenterX ( ) ; double circleY = circle . getCenterY ( ) ; Dimension [ ] [ ] dimArray = mySnake . getDimArray ( ) ; <START_BUG> int counter = ( mySnake . getCounter ( ) ) - 1 ; <END_BUG> int INNER = 0 ; int OUTER = 1 ; double r1 = dimArray [ counter ] [ INNER ] . height ; double r2 = dimArray [ counter ] [ OUTER ] . height ; double distance = Math . sqrt ( ( ( Math . pow ( ( circleX - snakeX ) , 2 ) ) + ( Math . pow ( ( circleY - snakeY ) , 2 ) ) ) ) ; if ( ( distance >= r1 ) && ( distance <= r2 ) ) return true ; else if ( distance < r1 ) return ( distance + ( d // 2 ) ) >= r1 ; else return ( distance - ( d // 2 ) ) <= r2 ; } @ Override public void draw ( Graphics g ) { } }

Fix:
int counter = mySnake . getCounter ( ) ;
Buggy code:
public class Factory { private double [ ] [ ] resDemanded ; private double [ ] [ ] resStockpiled ; private int template ; private int distance ; private char size ; private char race ; private String name ; public Factory ( double [ ] [ ] res , int t , char s , String n ) { } public Factory ( int defaultType , char race , char size , int d ) { } public Factory ( ArrayList < double [ ] > io , int t , char s , String n ) { } private void CorrectRacialResources ( ) { } private void AdjustResources ( int multiplier , boolean divide ) { } public double [ ] [ ] Produce ( ) { } private void ConsumeResources ( double ratio ) { } public void AddToStockpile ( double [ ] prod ) { } private double SatisfactionRatio ( ) { } public double [ ] DemandRatio ( int id ) { } public String toString ( ) { String s ; StringBuilder sb = new StringBuilder ( ) ; s = ( "Factory<seq2seq4repair_space>type:<seq2seq4repair_space>" + ( MASTER_FACTORY_LIST . get ( this . template ) . getName ( ) ) ) + "\n" ; sb . append ( s ) ; s = ( "\tSize:<seq2seq4repair_space>" + ( this . size ) ) + "\n" ; sb . append ( s ) ; s = ( "\tRace:<seq2seq4repair_space>" + ( this . race ) ) + "\n" ; sb . append ( s ) ; sb . append ( "\tResources:\n" ) ; for ( int i = 0 ; i < ( this . resDemanded . length ) ; i ++ ) { <START_BUG> s = String . format ( "\t\t%s:<seq2seq4repair_space>%d\n" , MASTER_RESOURCE_LIST . get ( this . resDemanded [ i ] [ 0 ] ) , this . resDemanded [ i ] [ 1 ] ) ; <END_BUG> sb . append ( s ) ; } return sb . toString ( ) ; } public double [ ] [ ] getResources ( ) { } public int getTemplate ( ) { } public char getSize ( ) { } public char getRace ( ) { } public String getName ( ) { } public int getDistance ( ) { } }

Fix:
s = String . format ( "\t\t%s:<seq2seq4repair_space>%f\n" , MASTER_RESOURCE_LIST . get ( this . resDemanded [ i ] [ 0 ] ) , this . resDemanded [ i ] [ 1 ] ) ;
Buggy code:
public class Http { public static final int TIMEOUT = Utils . getConfigInteger ( "page.timeout" , ( 5 * 1000 ) ) ; private static final Logger logger = Logger . getLogger ( AbstractRipper . class ) ; private int retries ; private String url ; private Connection connection ; public Http ( String url ) { } public Http ( URL url ) { } public static Http url ( String url ) { } public static Http url ( URL url ) { } private void defaultSettings ( ) { } public Http timeout ( int timeout ) { } public Http ignoreContentType ( ) { } public Http referrer ( String ref ) { } public Http referrer ( URL ref ) { } public Http userAgent ( String ua ) { } public Http retries ( int tries ) { } public Http header ( String name , String value ) { } public Http cookies ( Map < String , String > cookies ) { } public Http data ( Map < String , String > data ) { } public Http data ( String name , String value ) { } public Http method ( Method method ) { } public Connection connection ( ) { } public Document get ( ) throws IOException { } public Document post ( ) throws IOException { } public JSONObject getJSON ( ) throws IOException { ignoreContentType ( ) ; <START_BUG> String jsonString = response ( ) . body ( ) . replace ( "&quot;" , "\"" ) ; <END_BUG> return new JSONObject ( jsonString ) ; } public Response response ( ) throws IOException { } }

Fix:
String jsonString = response ( ) . body ( ) ;
Buggy code:
public class PostWriter { protected static final String BOUNDARY = "---------------------------7d159c1302d0y0" ; protected static final byte [ ] CRLF = new byte [ ] { 13 , 10 } ; protected static int fudge = - 20 ; protected static String encoding = "iso-8859-1" ; public void sendPostData ( URLConnection connection , HTTPSampler sampler ) throws IOException { ( ( HttpURLConnection ) ( connection ) ) . setRequestMethod ( "POST" ) ; <START_BUG> String filename = sampler . getFilename ( ) ; <END_BUG> if ( ( filename != null ) && ( ( filename . trim ( ) . length ( ) ) > 0 ) ) { connection . setRequestProperty ( "Content-type" , ( "multipart//form-data;<seq2seq4repair_space>boundary=" + ( PostWriter . BOUNDARY ) ) ) ; connection . setDoOutput ( true ) ; connection . setDoInput ( true ) ; OutputStream out = connection . getOutputStream ( ) ; writeln ( out , ( "--" + ( PostWriter . BOUNDARY ) ) ) ; Iterator args = sampler . getArguments ( ) . iterator ( ) ; while ( args . hasNext ( ) ) { Argument arg = ( ( Argument ) ( args . next ( ) ) ) ; writeFormMultipartStyle ( out , arg . getName ( ) , ( ( String ) ( arg . getValue ( ) ) ) ) ; writeln ( out , ( "--" + ( PostWriter . BOUNDARY ) ) ) ; } writeFileToURL ( out , filename , sampler . getFileField ( ) , getFileStream ( filename ) , sampler . getMimetype ( ) ) ; writeln ( out , ( ( "--" + ( PostWriter . BOUNDARY ) ) + "--" ) ) ; out . flush ( ) ; out . close ( ) ; } else { String postData = sampler . getQueryString ( ) ; connection . setRequestProperty ( "Content-length" , ( "" + ( postData . length ( ) ) ) ) ; connection . setRequestProperty ( "Content-type" , "application//x-www-form-urlencoded" ) ; connection . setDoOutput ( true ) ; PrintWriter out = new PrintWriter ( connection . getOutputStream ( ) ) ; out . print ( postData ) ; out . close ( ) ; } } private InputStream getFileStream ( String filename ) throws IOException { } private String getContentLength ( MultipartUrlConfig config ) { } private void writeFileToURL ( OutputStream out , String filename , String fieldname , InputStream in , String mimetype ) throws IOException { } private void writeFormMultipartStyle ( OutputStream out , String name , String value ) throws IOException { } private String encode ( String value ) { } private void write ( OutputStream out , String value ) throws IOException , UnsupportedEncodingException { } private void writeln ( OutputStream out , String value ) throws IOException , UnsupportedEncodingException { } }

Fix:
String filename = sampler . getFileField ( ) ;