nus-yam/ex-repair huggingface dataset:
Buggy code:
public class EjbResourceInjectionAnnotationProcessor implements DeploymentUnitProcessor { private static final DotName EJB_ANNOTATION_NAME = DotName . createSimple ( EJB . class . getName ( ) ) ; private static final Logger logger = Logger . getLogger ( EjbResourceInjectionAnnotationProcessor . class ) ; public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } public void undeploy ( DeploymentUnit context ) { } private void processField ( final EEModuleDescription eeModuleDescription , final EjbResourceInjectionAnnotationProcessor . EJBResourceWrapper annotation , final FieldInfo fieldInfo ) { final String fieldName = fieldInfo . name ( ) ; final String injectionType = ( ( isEmpty ( annotation . beanInterface ( ) ) ) || ( annotation . beanInterface ( ) . equals ( Object . class . getName ( ) ) ) ) ? fieldInfo . type ( ) . name ( ) . toString ( ) : annotation . beanInterface ( ) ; <START_BUG> final InjectionTarget targetDescription = new org . jboss . as . ee . component . FieldInjectionTarget ( fieldName , fieldInfo . declaringClass ( ) . name ( ) . toString ( ) , injectionType ) ; <END_BUG> final String localContextName = ( isEmpty ( annotation . name ( ) ) ) ? ( ( fieldInfo . declaringClass ( ) . name ( ) . toString ( ) ) + "//" ) + ( fieldInfo . name ( ) ) : annotation . name ( ) ; process ( eeModuleDescription , targetDescription . getClassName ( ) , annotation . beanName ( ) , annotation . lookup ( ) , fieldInfo . declaringClass ( ) , targetDescription , localContextName ) ; } private void processMethod ( final EEModuleDescription eeModuleDescription , final EjbResourceInjectionAnnotationProcessor . EJBResourceWrapper annotation , final MethodInfo methodInfo ) { } private void processClass ( final EEModuleDescription eeModuleDescription , final EjbResourceInjectionAnnotationProcessor . EJBResourceWrapper annotation , final ClassInfo classInfo ) throws DeploymentUnitProcessingException { } private void process ( final EEModuleDescription eeModuleDescription , final String beanInterface , final String beanName , final String lookup , final ClassInfo classInfo , final InjectionTarget targetDescription , final String localContextName ) { } private boolean isEmpty ( final String string ) { } private class EJBResourceWrapper { private final String name ; private final String beanInterface ; private final String beanName ; private final String lookup ; private final String description ; private EJBResourceWrapper ( final AnnotationInstance annotation ) { } private String name ( ) { } private String beanInterface ( ) { } private String beanName ( ) { } private String lookup ( ) { } private String description ( ) { } private String stringValueOrNull ( final AnnotationInstance annotation , final String attribute ) { } private String classValueOrNull ( final AnnotationInstance annotation , final String attribute ) { } } }

Fix:
final InjectionTarget targetDescription = new org . jboss . as . ee . component . FieldInjectionTarget ( fieldInfo . declaringClass ( ) . name ( ) . toString ( ) , fieldName , injectionType ) ;
Buggy code:
public class SpringValidatorAdapter implements Validator , org . springframework . validation . Validator { private org . springframework . validation . Validator targetValidator ; public SpringValidatorAdapter ( Validator targetValidator ) { } SpringValidatorAdapter ( ) { } void setTargetValidator ( Validator targetValidator ) { } public boolean supports ( Class < ? > clazz ) { } public void validate ( Object target , Errors errors ) { } protected Object [ ] getArgumentsForConstraint ( String objectName , String field , ConstraintDescriptor < ? > descriptor ) { } public < T > Set < ConstraintViolation < T > > validate ( T object , Class < ? > ... groups ) { } public < T > Set < ConstraintViolation < T > > validateProperty ( T object , String propertyName , Class < ? > ... groups ) { } public < T > Set < ConstraintViolation < T > > validateValue ( Class < T > beanType , String propertyName , Object value , Class < ? > ... groups ) { <START_BUG> return this . targetValidator . validateValue ( beanType , propertyName , groups ) ; <END_BUG> } public BeanDescriptor getConstraintsForClass ( Class < ? > clazz ) { } public < T > T unwrap ( Class < T > type ) { } }

Fix:
return this . targetValidator . validateValue ( beanType , propertyName , value , groups ) ;
Buggy code:
class TabFolderTab extends Tab { TabFolder tabFolder1 ; Group tabFolderGroup ; Button topButton ; Button bottomButton ; static String [ ] TabItems1 = new String [ ] { ControlExample . getResourceString ( "TabItem1_0" ) , ControlExample . getResourceString ( "TabItem1_1" ) , ControlExample . getResourceString ( "TabItem1_2" ) } ; TabFolderTab ( ControlExample instance ) { } void createExampleGroup ( ) { super . createExampleGroup ( ) ; tabFolderGroup = new Group ( exampleGroup , SWT . NONE ) ; tabFolderGroup . setLayout ( new GridLayout ( ) ) ; <START_BUG> tabFolderGroup . setLayoutData ( new GridData ( ( ( ( GridData . GRAB_HORIZONTAL ) | ( GridData . HORIZONTAL_ALIGN_FILL ) ) | ( GridData . VERTICAL_ALIGN_FILL ) ) ) ) ; <END_BUG> tabFolderGroup . setText ( "TabFolder" ) ; } void createExampleWidgets ( ) { } void createStyleGroup ( ) { } Item [ ] getExampleWidgetItems ( ) { } Control [ ] getExampleWidgets ( ) { } String [ ] getMethodNames ( ) { } String setMethodName ( String methodRoot ) { } Object [ ] parameterForType ( String typeName , String value , Control control ) { } TabItem findItem ( String value , TabItem [ ] items ) { } String getTabText ( ) { } void setExampleWidgetState ( ) { } }

Fix:
tabFolderGroup . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , true , true ) ) ;
Buggy code:
public class ReferencePointcut extends Pointcut { public TypeX onType ; public TypePattern onTypeSymbolic ; public String name ; public TypePatternList arguments ; public ReferencePointcut ( TypePattern onTypeSymbolic , String name , TypePatternList arguments ) { } public ReferencePointcut ( TypeX onType , String name , TypePatternList arguments ) { } <START_BUG> public FuzzyBoolean fastMatch ( ResolvedTypeX type ) { <END_BUG> return FuzzyBoolean . MAYBE ; } public FuzzyBoolean match ( Shadow shadow ) { } public String toString ( ) { } public void write ( DataOutputStream s ) throws IOException { } public static Pointcut read ( DataInputStream s , ISourceContext context ) throws IOException { } public void resolveBindings ( IScope scope , Bindings bindings ) { } public void postRead ( ResolvedTypeX enclosingType ) { } public Test findResidue ( Shadow shadow , ExposedState state ) { } private boolean concretizing = false ; public Pointcut concretize1 ( ResolvedTypeX searchStart , IntMap bindings ) { } protected boolean shouldCopyLocationForConcretize ( ) { } public boolean equals ( Object other ) { } public int hashCode ( ) { } }

Fix:
public FuzzyBoolean fastMatch ( FastMatchInfo type ) {
Buggy code:
public class PageRequestTarget implements IPageRequestTarget { private final Page page ; public PageRequestTarget ( Page page ) { } public void respond ( RequestCycle requestCycle ) { if ( requestCycle . isRedirect ( ) ) { requestCycle . redirectTo ( page ) ; } else { <START_BUG> page . renderPage ( ) ; <END_BUG> } } public final Page getPage ( ) { } public void detach ( RequestCycle requestCycle ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } }

Fix:
page . render ( ) ;
Buggy code:
public class ProductGridBox extends JPanel { Icon emptyHeart ; Icon filledHeart ; Product product ; ShoppingCart shoppingCart ; IMatController controller ; private final SpinnerNumberModel numbersAllowed = new SpinnerNumberModel ( 1 , 1 , 100 , 1 ) ; public ProductGridBox ( ) { } public ProductGridBox ( Product product ) { } private void setLabels ( ) { } public void setImage ( ImageIcon productImage ) { } public String getName ( ) { } public void toggleFavourite ( boolean isFavourite ) { } <START_BUG> public JToggleButton getFavouriteButton ( ) { <END_BUG> return favouriteButton ; } public JButton getBuyButton ( ) { } public JButton getToListButton ( ) { } public JSpinner getAmountSpinner ( ) { } @ SuppressWarnings ( "unchecked" ) private void initComponents ( ) { } private void toListButtonActionPerformed ( ActionEvent evt ) { } private void buyButtonActionPerformed ( ActionEvent evt ) { } private void buyButtonMouseReleased ( MouseEvent evt ) { } private void favouriteButtonActionPerformed ( ActionEvent evt ) { } private JSpinner amountSpinner ; private JButton buyButton ; private JButton favouriteButton ; private JLabel imageLabel ; private JPanel imagePanel ; private JLabel kronorLabel ; private JLabel numberOfItemsLabel ; private JLabel priceLabel ; private JLabel priceNameLabel ; private JLabel productNameLabel ; private JButton toListButton ; private JLabel unitLabel ; }

Fix:
public JButton getFavouriteButton ( ) {
Buggy code:
@ Singleton public class TenantFilter implements Filter { public static final String TENANT = "killbill_tenant" ; private static final Logger log = LoggerFactory . getLogger ( TenantFilter . class ) ; @ Inject protected TenantUserApi tenantUserApi ; @ Inject protected DaoConfig daoConfig ; private ModularRealmAuthenticator modularRealmAuthenticator ; @ Override public void init ( final FilterConfig filterConfig ) throws ServletException { } @ Override public void doFilter ( final ServletRequest request , final ServletResponse response , final FilterChain chain ) throws IOException , ServletException { } @ Override public void destroy ( ) { } private boolean shouldSkipFilter ( final ServletRequest request ) { } private boolean isPermissionRequest ( final String path , final String httpMethod ) { <START_BUG> return ( SECURITY_PATH . startsWith ( path ) ) && ( "GET" . equals ( httpMethod ) ) ; <END_BUG> } private boolean isTenantCreationRequest ( final String path , final String httpMethod ) { } private boolean isMetricsRequest ( final String path , final String httpMethod ) { } private boolean isOptionsRequest ( final String httpMethod ) { } private boolean isStaticResourceRequest ( final String path , final String httpMethod ) { } private boolean isKbApiRequest ( final String path ) { } private boolean isPluginRequest ( final String path ) { } private boolean isStaticFileRequest ( final String path ) { } private void sendAuthError ( final ServletResponse response , final String errorMessage ) throws IOException { } }

Fix:
return ( ( path != null ) && ( path . startsWith ( SECURITY_PATH ) ) ) && ( "GET" . equals ( httpMethod ) ) ;
Buggy code:
public class CSVFormatBuilderTest { private CSVFormatBuilder builder ; @ Before public void setUp ( ) throws Exception { } @ Test public void testCommentStart ( ) { } @ Test public void testCopiedFormatIsEqualToOriginal ( ) { } @ Test public void testCopiedFormatWithChanges ( ) { } @ Test public void testDelimiter ( ) { } @ Test ( expected = IllegalStateException . class ) public void testDelimiterSameAsCommentStartThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testDelimiterSameAsEscapeThrowsException ( ) { } @ Test public void testEscape ( ) { } @ Test ( expected = IllegalStateException . class ) public void testEscapeSameAsCommentStartThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testEscapeSameAsCommentStartThrowsExceptionForWrapperType ( ) { } @ Test public void testHeaderReferenceCannotEscape ( ) { } @ Test public void testIgnoreEmptyLines ( ) { } @ Test public void testIgnoreSurroundingSpaces ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testNewFormatCRThrowsException ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testNewFormatLFThrowsException ( ) { } @ Test public void testQuoteChar ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuoteCharSameAsCommentStartThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuoteCharSameAsCommentStartThrowsExceptionForWrapperType ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuoteCharSameAsDelimiterThrowsException ( ) { } @ Test public void testQuotePolicy ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuotePolicyNoneWithoutEscapeThrowsException ( ) { } @ Test public void testRecoardSeparator ( ) { } @ Test public void testRFC4180 ( ) { assertEquals ( null , CSVFormat . RFC4180 . getCommentStart ( ) ) ; assertEquals ( ',' , CSVFormat . RFC4180 . getDelimiter ( ) ) ; assertEquals ( null , CSVFormat . RFC4180 . getEscape ( ) ) ; <START_BUG> assertEquals ( false , CSVFormat . RFC4180 . getIgnoreEmptyLines ( ) ) ; <END_BUG> assertEquals ( Character . valueOf ( '"' ) , CSVFormat . RFC4180 . getQuoteChar ( ) ) ; assertEquals ( null , CSVFormat . RFC4180 . getQuotePolicy ( ) ) ; assertEquals ( "\r\n" , CSVFormat . RFC4180 . getRecordSeparator ( ) ) ; } @ Test ( expected = IllegalArgumentException . class ) public void testWithCommentStartCRThrowsException ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithDelimiterLFThrowsException ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithEscapeCRThrowsExceptions ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithQuoteLFThrowsException ( ) { } }

Fix:
assertFalse ( CSVFormat . RFC4180 . getIgnoreEmptyLines ( ) ) ;
Buggy code:
public class GetAllPhotoMetadataService extends IntentService { public static final String ARG_RECEIVER = "receiverTag" ; public static final String ARG_ALBUM_ID = "albumId" ; public static final String ARG_PHOTOS_METADATA = "photos_metadata" ; private ArrayList < Photo > mAllPhotos = new ArrayList < > ( ) ; public GetAllPhotoMetadataService ( ) { } @ Override protected void onHandleIntent ( Intent intent ) { } private void executeRequestAndAddPhotosToList ( GraphRequest request ) { GraphResponse response = request . executeAndWait ( ) ; try { JSONArray photosListJson = response . getJSONObject ( ) . getJSONArray ( "data" ) ; for ( int i = 0 ; i < ( photosListJson . length ( ) ) ; i ++ ) { JSONObject thisPhoto = photosListJson . getJSONObject ( i ) ; String id = thisPhoto . getString ( "id" ) ; String name = null ; if ( thisPhoto . has ( "name" ) ) { name = thisPhoto . getString ( "name" ) ; } String uploadedBy = thisPhoto . getJSONObject ( "from" ) . getString ( "name" ) ; String uploadedById = thisPhoto . getJSONObject ( "from" ) . getString ( "id" ) ; String imageUrlStr = thisPhoto . getJSONArray ( "images" ) . getJSONObject ( 0 ) . getString ( "source" ) ; String postUrlStr = thisPhoto . getString ( "link" ) ; DateTime createdTime = new DateTime ( thisPhoto . getString ( "created_time" ) ) ; URL imageUrl = null ; try { imageUrl = new URL ( imageUrlStr ) ; } catch ( MalformedURLException e ) { e . printStackTrace ( ) ; } URL postUrl = null ; try { postUrl = new URL ( postUrlStr ) ; } catch ( MalformedURLException e ) { e . printStackTrace ( ) ; } <START_BUG> Photo photo = new Photo ( id , ( i + 1 ) , name , uploadedBy , uploadedById , imageUrl , postUrl , createdTime ) ; <END_BUG> String placeName = null ; if ( thisPhoto . has ( "place" ) ) { JSONObject placeJsonObj = thisPhoto . getJSONObject ( "place" ) ; if ( placeJsonObj . has ( "name" ) ) { placeName = placeJsonObj . getString ( "name" ) ; } } if ( placeName != null ) { photo . setPlaceName ( placeName ) ; } ArrayList < Tag > tags = new ArrayList < > ( ) ; if ( thisPhoto . has ( "tags" ) ) { JSONArray tagsArray = thisPhoto . getJSONObject ( "tags" ) . getJSONArray ( "data" ) ; for ( int j = 0 ; j < ( tagsArray . length ( ) ) ; j ++ ) { JSONObject thisTag = tagsArray . getJSONObject ( j ) ; String taggedUserId = thisTag . getString ( "id" ) ; String taggedUserName = thisTag . getString ( "name" ) ; DateTime tagCreated = new DateTime ( thisTag . getString ( "created_time" ) ) ; double tagX = thisTag . getDouble ( "x" ) ; double tagY = thisTag . getDouble ( "y" ) ; tags . add ( new Tag ( taggedUserId , taggedUserName , tagCreated , tagX , tagY ) ) ; } } photo . setTags ( tags ) ; mAllPhotos . add ( photo ) ; } } catch ( JSONException e ) { e . printStackTrace ( ) ; } GraphRequest nextPage = response . getRequestForPagedResults ( NEXT ) ; if ( nextPage != null ) { executeRequestAndAddPhotosToList ( nextPage ) ; } } }

Fix:
Photo photo = new Photo ( id , ( ( mAllPhotos . size ( ) ) + 1 ) , name , uploadedBy , uploadedById , imageUrl , postUrl , createdTime ) ;
Buggy code:
public final class BookDetails extends AuthenticatedWebPage { public BookDetails ( final PageParameters parameters ) throws StringValueConversionException { } public BookDetails ( final Book book ) { } public static BookmarkablePageLink link ( final String name , final Book book , final String noBookTitle ) { final BookmarkablePageLink link = new BookmarkablePageLink ( name , BookDetails . class ) ; if ( book != null ) { link . setParameter ( "id" , book . getId ( ) ) ; <START_BUG> link . add ( new Label ( "title" , book ) ) ; <END_BUG> } else { link . add ( new Label ( "title" , noBookTitle ) ) ; link . setEnabled ( false ) ; } return link ; } }

Fix:
link . add ( new Label ( "title" , new wicket . model . Model ( book ) ) ) ;
Buggy code:
public class NonCachingImage extends Image { private static final long serialVersionUID = 1L ; public NonCachingImage ( String id , IModel model ) { } public NonCachingImage ( String id , Resource imageResource ) { } public NonCachingImage ( String id , ResourceReference resourceReference , ValueMap resourceParameters ) { } public NonCachingImage ( String id , ResourceReference resourceReference ) { } public NonCachingImage ( String id , String string ) { } public NonCachingImage ( String id ) { } protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; String url = tag . getAttributes ( ) . getString ( "src" ) ; url = url + ( ( url . indexOf ( "?" ) ) >= 0 ? "&" : "?" ) ; <START_BUG> url = ( url + "wicket:antiCache=" ) + ( Math . random ( ) ) ; <END_BUG> tag . put ( "src" , url ) ; } }

Fix:
url = ( url + "wicket:antiCache=" ) + ( System . currentTimeMillis ( ) ) ;
Buggy code:
public class SubscriptionMethodReturnValueHandler implements HandlerMethodReturnValueHandler { private final MessageSendingOperations < String > messagingTemplate ; public SubscriptionMethodReturnValueHandler ( MessageSendingOperations < String > messagingTemplate ) { } @ Override public boolean supportsReturnType ( MethodParameter returnType ) { } @ Override public void handleReturnValue ( Object returnValue , MethodParameter returnType , Message < ? > message ) throws Exception { } private final class SubscriptionHeaderPostProcessor implements MessagePostProcessor { private final String sessionId ; private final String subscriptionId ; public SubscriptionHeaderPostProcessor ( String sessionId , String subscriptionId ) { } @ Override public Message < ? > postProcessMessage ( Message < ? > message ) { SimpMessageHeaderAccessor headers = SimpMessageHeaderAccessor . wrap ( message ) ; headers . setSessionId ( this . sessionId ) ; headers . setSubscriptionId ( this . subscriptionId ) ; headers . setMessageTypeIfNotSet ( MESSAGE ) ; <START_BUG> return MessageBuilder . withPayloadAndHeaders ( message . getPayload ( ) , headers ) . build ( ) ; <END_BUG> } } }

Fix:
return MessageBuilder . withPayload ( message . getPayload ( ) ) . setHeaders ( headers ) . build ( ) ;
Buggy code:
public class SecurityRealmService implements SecurityRealm , Service < SecurityRealmService > { public static final ServiceName BASE_SERVICE_NAME = JBOSS . append ( "server" , "controller" , "management" , "security_realm" ) ; private final InjectedValue < DomainCallbackHandler > callbackHandler = new InjectedValue < DomainCallbackHandler > ( ) ; private final InjectedValue < SSLIdentityService > sslIdentity = new InjectedValue < SSLIdentityService > ( ) ; private final InjectedValue < CallbackHandlerFactory > secretCallbackFactory = new InjectedValue < CallbackHandlerFactory > ( ) ; private final String name ; public SecurityRealmService ( String name ) { } public void start ( StartContext context ) throws StartException { } public void stop ( StopContext context ) { } public SecurityRealmService getValue ( ) throws IllegalArgumentException , IllegalStateException { } public String getName ( ) { } public InjectedValue < DomainCallbackHandler > getCallbackHandlerInjector ( ) { } public InjectedValue < SSLIdentityService > getSSLIdentityInjector ( ) { } public InjectedValue < CallbackHandlerFactory > getSecretCallbackFactory ( ) { } public DomainCallbackHandler getCallbackHandler ( ) { } public SSLContext getSSLContext ( ) { } public boolean hasTrustStore ( ) { } public CallbackHandlerFactory getSecretCallbackHandlerFactory ( ) { <START_BUG> return secretCallbackFactory . getValue ( ) ; <END_BUG> } }

Fix:
return secretCallbackFactory . getOptionalValue ( ) ;
Buggy code:
public class Course { JSONObject classRoot ; public Course ( JSONObject classRoot ) { } public String getCourseName ( ) throws JSONException { } public Course . Grade getGrade ( ) throws JSONException { <START_BUG> return new Course . Grade ( classRoot . getJSONObject ( "firstSemester" ) . getString ( "grade" ) ) ; <END_BUG> } public int getPeriod ( ) { } public boolean isFirstSemester ( ) { } public boolean isSecondSemester ( ) { } public List < Course . Assignment > getAssignments ( ) { } public class Grade { public String grade ; public String letterGrade ; public Grade ( String gradeString ) { } } public class Assignment { public final String name ; public final String date ; public final String percent ; public final String grade ; public final String maxPoints ; public Assignment ( String name , String date , String percent , String grade , String maxPoints ) { } } }

Fix:
return new Course . Grade ( classRoot . getJSONObject ( ( isFirstSemester ( ) ? "firstSemester" : "secondSemester" ) ) . getString ( "grade" ) ) ;
Buggy code:
public class PickItemUse extends JsonMessageHandler < ConnectionToGridiaClientHandler > { @ Override protected void handle ( ConnectionToGridiaClientHandler connection , JsonObject data ) throws IOException { ServingGridia server = connection . getServer ( ) ; Player player = connection . getPlayer ( ) ; int useIndex = data . get ( "useIndex" ) . getAsInt ( ) ; ItemWrapper tool = server . getItemFrom ( player , player . useSource , player . useSourceIndex ) ; ItemWrapper focus = server . getItemFrom ( player , player . useDest , player . useDestIndex ) ; List < ItemUse > uses = server . contentManager . getItemUses ( tool . getItemInstance ( ) . getItem ( ) , focus . getItemInstance ( ) . getItem ( ) ) ; ItemUse use = uses . get ( useIndex ) ; <START_BUG> server . executeItemUse ( connection , use , tool , focus , player . useDest ) ; <END_BUG> } }

Fix:
server . executeItemUse ( connection , use , tool , focus , player . useDestIndex ) ;
Buggy code:
public class HomeFragment extends Fragment { private View mStatusPanel ; private TextView mStatusText ; private ImageView mStatusImage ; private TabHost mTabs ; private MainActivity . QueryResultListener < Wallet > mWalletResultListener ; public static HomeFragment newInstance ( ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onViewCreated ( View view , Bundle savedInstanceState ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public void onPrepareOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } <START_BUG> protected void onWalletClick ( Wallet wallet ) { <END_BUG> Fragment fragment = WalletFragment . newInstance ( wallet ) ; FragmentManager fragmentManager = getFragmentManager ( ) ; fragmentManager . popBackStack ( HomeFragment . class . getSimpleName ( ) , 0 ) ; fragmentManager . beginTransaction ( ) . setCustomAnimations ( delayed_slide_in_up , fade_out , delayed_fade_in , slide_out_up ) . replace ( frame_content , fragment , fragment . getClass ( ) . getSimpleName ( ) ) . addToBackStack ( fragment . getClass ( ) . getSimpleName ( ) ) . commit ( ) ; } public class LoadWalletsTask extends AsyncTaskHandleException < Void , Void , List < Wallet > > { @ Override protected List < Wallet > doInBackgroundHandleException ( Void ... param ) throws PeerConnectionException { } @ Override protected void onSuccess ( final List < Wallet > wallets ) { } @ Override protected void onFailed ( Throwable t ) { } } }

Fix:
protected void onWalletClick ( final Wallet wallet ) {
Buggy code:
public class TestSegmentTermEnum extends LuceneTestCase { Directory dir = new RAMDirectory ( ) ; public void testTermEnum ( ) throws IOException { } public void testPrevTermAtEnd ( ) throws IOException { } private void verifyDocFreq ( ) throws IOException { <START_BUG> IndexReader reader = IndexReader . open ( dir ) ; <END_BUG> TermEnum termEnum = null ; termEnum = reader . terms ( ) ; termEnum . next ( ) ; assertEquals ( "aaa" , termEnum . term ( ) . text ( ) ) ; assertEquals ( 200 , termEnum . docFreq ( ) ) ; termEnum . next ( ) ; assertEquals ( "bbb" , termEnum . term ( ) . text ( ) ) ; assertEquals ( 100 , termEnum . docFreq ( ) ) ; termEnum . close ( ) ; termEnum = reader . terms ( new Term ( "content" , "aaa" ) ) ; assertEquals ( "aaa" , termEnum . term ( ) . text ( ) ) ; assertEquals ( 200 , termEnum . docFreq ( ) ) ; termEnum . next ( ) ; assertEquals ( "bbb" , termEnum . term ( ) . text ( ) ) ; assertEquals ( 100 , termEnum . docFreq ( ) ) ; termEnum . close ( ) ; } private void addDoc ( IndexWriter writer , String value ) throws IOException { } }

Fix:
IndexReader reader = IndexReader . open ( dir , true ) ;
Buggy code:
public class LocationService implements Service < LocationService > { private final String locationPath ; private final InjectedValue < HttpHandler > httpHandler = new InjectedValue ( ) ; private final InjectedValue < Host > host = new InjectedValue ( ) ; private final CopyOnWriteArrayList < InjectedValue < FilterService > > injectedFilters = new CopyOnWriteArrayList < > ( ) ; public LocationService ( String locationPath ) { } @ Override public void start ( StartContext context ) throws StartException { <START_BUG> ROOT_LOGGER . infof ( "registering<seq2seq4repair_space>handler<seq2seq4repair_space>%s<seq2seq4repair_space>under<seq2seq4repair_space>path<seq2seq4repair_space>'%s'" , httpHandler , locationPath ) ; <END_BUG> host . getValue ( ) . registerHandler ( locationPath , configureHandler ( ) ) ; } @ Override public void stop ( StopContext context ) { } @ Override public LocationService getValue ( ) throws IllegalArgumentException , IllegalStateException { } InjectedValue < Host > getHost ( ) { } InjectedValue < HttpHandler > getHttpHandler ( ) { } CopyOnWriteArrayList < InjectedValue < FilterService > > getInjectedFilters ( ) { } private HttpHandler configureHandler ( ) { } }

Fix:
ROOT_LOGGER . registeringHandler ( httpHandler . getValue ( ) , locationPath ) ;
Buggy code:
public class QuickSlotButton extends Button implements WndBag . Listener { private static final String TXT_SELECT_ITEM = "Select<seq2seq4repair_space>an<seq2seq4repair_space>item<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>quickslot" ; private static QuickSlotButton [ ] instance = new QuickSlotButton [ 4 ] ; private int slotNum ; private Item itemInSlot ; private ItemSlot slot ; private static Image crossB ; private static Image crossM ; private static boolean targeting = false ; private Item lastItem = null ; private static Char lastTarget = null ; public QuickSlotButton ( int slotNum ) { } @ Override public void destroy ( ) { super . destroy ( ) ; <START_BUG> QuickSlotButton . instance = null ; <END_BUG> lastItem = null ; QuickSlotButton . lastTarget = null ; } @ Override protected void createChildren ( ) { } @ Override protected void layout ( ) { } @ Override protected void onClick ( ) { } @ Override protected boolean onLongClick ( ) { } private static Item select ( int slotNum ) { } @ Override public void onSelect ( Item item ) { } public void item ( Item item ) { } public void enable ( boolean value ) { } private void enableSlot ( ) { } private void useTargeting ( ) { } public static void refresh ( ) { } public static void target ( Char target ) { } public static void cancel ( ) { } }

Fix:
QuickSlotButton . instance = new QuickSlotButton [ 4 ] ;
Buggy code:
public class MethodLocator extends PatternLocator { protected MethodPattern pattern ; protected boolean isDeclarationOfReferencedMethodsPattern ; public char [ ] [ ] [ ] allSuperDeclaringTypeNames ; public MethodLocator ( MethodPattern pattern ) { } public void initializePolymorphicSearch ( MatchLocator locator ) { } protected boolean isVirtualInvoke ( MethodBinding method , MessageSend messageSend ) { } public int match ( ASTNode node , MatchingNodeSet nodeSet ) { } public int match ( MethodDeclaration node , MatchingNodeSet nodeSet ) { } public int match ( MessageSend node , MatchingNodeSet nodeSet ) { if ( ! ( this . pattern . findReferences ) ) return PatternLocator . IMPOSSIBLE_MATCH ; if ( ! ( matchesName ( this . pattern . selector , node . selector ) ) ) return PatternLocator . IMPOSSIBLE_MATCH ; <START_BUG> if ( ( ( this . pattern . parameterSimpleNames ) != null ) && ( ! ( this . pattern . varargs ) ) ) { <END_BUG> int length = this . pattern . parameterSimpleNames . length ; ASTNode [ ] args = node . arguments ; int argsLength = ( args == null ) ? 0 : args . length ; if ( length != argsLength ) return PatternLocator . IMPOSSIBLE_MATCH ; } return nodeSet . addMatch ( node , ( ( ( InternalSearchPattern ) ( this . pattern ) ) . mustResolve ? PatternLocator . POSSIBLE_MATCH : PatternLocator . ACCURATE_MATCH ) ) ; } protected int matchContainer ( ) { } protected void matchLevelAndReportImportRef ( ImportReference importRef , Binding binding , MatchLocator locator ) throws CoreException { } protected int matchMethod ( MethodBinding method ) { } protected void matchReportReference ( ASTNode reference , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } void matchReportReference ( MessageSend messageSend , MatchLocator locator , MethodBinding methodBinding ) throws CoreException { } protected int referenceType ( ) { } protected void reportDeclaration ( MethodBinding methodBinding , MatchLocator locator , SimpleSet knownMethods ) throws CoreException { } public int resolveLevel ( ASTNode possibleMatchingNode ) { } public int resolveLevel ( Binding binding ) { } protected int resolveLevel ( MessageSend messageSend ) { } protected int resolveLevelAsSubtype ( char [ ] qualifiedPattern , ReferenceBinding type ) { } public String toString ( ) { } }

Fix:
if ( ( ( this . pattern . parameterSimpleNames ) != null ) && ( this . pattern . shouldCountParameter ( ) ) ) {
Buggy code:
public class MapMain_Relation implements SaveData { private Map current_map_reference_ ; public static final int MAX_NUMBER_OF_WORLDS = 1 ; private static int number_of_worlds_generated_ = 0 ; public MapMain_Relation ( int x , int y ) { } public void bindToNewMapOfSize ( int x , int y ) { <START_BUG> if ( ( MapMain_Relation . number_of_worlds_generated_ ) >= ( MapMain_Relation . MAX_NUMBER_OF_WORLDS ) ) { <END_BUG> current_map_reference_ = new Map ( x , y ) ; ++ ( MapMain_Relation . number_of_worlds_generated_ ) ; } else { System . err . println ( ( "Number<seq2seq4repair_space>of<seq2seq4repair_space>world<seq2seq4repair_space>allowed:<seq2seq4repair_space>" + ( MapMain_Relation . MAX_NUMBER_OF_WORLDS ) ) ) ; System . err . println ( ( "Number<seq2seq4repair_space>of<seq2seq4repair_space>worlds<seq2seq4repair_space>already<seq2seq4repair_space>in<seq2seq4repair_space>existence:<seq2seq4repair_space>" + ( MapMain_Relation . number_of_worlds_generated_ ) ) ) ; System . err . println ( ( ( "Please<seq2seq4repair_space>don't<seq2seq4repair_space>make<seq2seq4repair_space>more<seq2seq4repair_space>than<seq2seq4repair_space>" + ( MapMain_Relation . MAX_NUMBER_OF_WORLDS ) ) + "<seq2seq4repair_space>worlds." ) ) ; System . exit ( ( - 1 ) ) ; } } public MapMain_Relation ( ) { } public Map getMyMap ( ) { } public int addAvatar ( Avatar a , int x , int y ) { } public int addEntity ( Entity e , int x , int y ) { } public int removeAvatar ( Avatar a ) { } public int removeEntity ( Entity e ) { } public int addItem ( Item i , int x , int y ) { } public Item removeTopItem ( Item i , int x , int y ) { } public MapTile getTile ( int x , int y ) { } public void addViewToMap ( MapView view ) { } public int addTerrain ( Terrain t , int x , int y ) { } @ Override public String getSerTag ( ) { } public void relink ( Object [ ] refs ) { } @ Override public void serialize ( ObjectOutputStream oos , HashMap < SaveData , Boolean > savMap ) throws IOException { } }

Fix:
if ( ( MapMain_Relation . number_of_worlds_generated_ ) <= ( MapMain_Relation . MAX_NUMBER_OF_WORLDS ) ) {
Buggy code:
public class Snippet76 { public static void main ( String [ ] args ) { Display display = new Display ( ) ; final Shell shell = new Shell ( display ) ; final TabFolder tabFolder = new TabFolder ( shell , SWT . BORDER ) ; for ( int i = 0 ; i < 6 ; i ++ ) { <START_BUG> TabItem item = new TabItem ( tabFolder , SWT . NULL ) ; <END_BUG> item . setText ( ( "TabItem<seq2seq4repair_space>" + i ) ) ; Button button = new Button ( tabFolder , SWT . PUSH ) ; button . setText ( ( "Page<seq2seq4repair_space>" + i ) ) ; item . setControl ( button ) ; } tabFolder . setSize ( 400 , 200 ) ; shell . pack ( ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; } display . dispose ( ) ; } }

Fix:
TabItem item = new TabItem ( tabFolder , SWT . NONE ) ;
Buggy code:
public class Then { public Then assertThatObjectUnderTestIsNotModified ( ) { } public Then assertThatObjectUnderTestIsModifiedAs ( Object expectedObject ) { } public Then assertThatInputParametersAreNotModified ( ) { <START_BUG> Rjson rjson = Rjson . newInstance ( ) . and ( new NullifyDateTransformer ( ) ) . andIgnoreModifiers ( ) ; <END_BUG> for ( int i = 0 ; i < ( when . inputParams ( ) . size ( ) ) ; i ++ ) { Object object = when . inputParams ( ) . get ( i ) ; String afterExecutionJson = rjson . toJson ( object ) ; Assert . thatJsonEqualsLiterally ( afterExecutionJson , when . inputParamJsons ( ) . get ( i ) ) ; } return this ; } public Then assertThatThereAreNoSideEffects ( ) { } public Then assertThatReturnValueIsSameAs ( Object expectedObject ) { } public static Then thenAssertChanges ( When when ) { } private When when ; private Object returnObject ; public Object getReturnObject ( ) { } public void setReturnObject ( Object returnObject ) { } private Then ( ) { } No newline ; at end ; of file ; }

Fix:
Rjson rjson = Rjson . newInstance ( ) . and ( new NullifyDateTransformer ( ) ) . andRecordAllModifiers ( ) ;
Buggy code:
public class TestNorwegianLightStemFilter extends BaseTokenStreamTestCase { private Analyzer analyzer = new Analyzer ( ) { @ Override protected TokenStreamComponents createComponents ( String fieldName , Reader reader ) { } } ; public void testVocabulary ( ) throws IOException { } public void testRandomStrings ( ) throws Exception { Random random = random ( ) ; <START_BUG> checkRandomData ( random , analyzer , ( 10000 * ( RANDOM_MULTIPLIER ) ) ) ; <END_BUG> } public void testEmptyTerm ( ) throws IOException { } }

Fix:
checkRandomData ( random , analyzer , ( 1000 * ( RANDOM_MULTIPLIER ) ) ) ;
Buggy code:
public class DefaultLogger implements BuildLogger { public static final int LEFT_COLUMN_SIZE = 12 ; protected PrintStream out ; protected PrintStream err ; protected int msgOutputLevel = Project . MSG_ERR ; private long startTime = System . currentTimeMillis ( ) ; protected static final String lSep = StringUtils . LINE_SEP ; protected boolean emacsMode = false ; public DefaultLogger ( ) { } public void setMessageOutputLevel ( int level ) { } public void setOutputPrintStream ( PrintStream output ) { } public void setErrorPrintStream ( PrintStream err ) { } public void setEmacsMode ( boolean emacsMode ) { } public void buildStarted ( BuildEvent event ) { } public void buildFinished ( BuildEvent event ) { } public void targetStarted ( BuildEvent event ) { } public void targetFinished ( BuildEvent event ) { } public void taskStarted ( BuildEvent event ) { } public void taskFinished ( BuildEvent event ) { } public void messageLogged ( BuildEvent event ) { int priority = event . getPriority ( ) ; if ( priority <= ( msgOutputLevel ) ) { StringBuffer message = new StringBuffer ( ) ; if ( ( ( event . getTask ( ) ) != null ) && ( ! ( emacsMode ) ) ) { String name = event . getTask ( ) . getTaskName ( ) ; String label = ( "[" + name ) + "]<seq2seq4repair_space>" ; int size = ( DefaultLogger . LEFT_COLUMN_SIZE ) - ( label . length ( ) ) ; <START_BUG> StringBuffer tmp = new StringBuffer ( size ) ; <END_BUG> for ( int i = 0 ; i < size ; i ++ ) { tmp . append ( "<seq2seq4repair_space>" ) ; } tmp . append ( label ) ; label = tmp . toString ( ) ; StringTokenizer tok = new StringTokenizer ( event . getMessage ( ) , "\r\n" , false ) ; boolean first = true ; while ( tok . hasMoreTokens ( ) ) { if ( ! first ) { message . append ( LINE_SEP ) ; } first = false ; message . append ( label ) ; message . append ( tok . nextToken ( ) ) ; } } else { message . append ( event . getMessage ( ) ) ; } String msg = message . toString ( ) ; if ( priority != ( Project . MSG_ERR ) ) { printMessage ( msg , out , priority ) ; } else { printMessage ( msg , err , priority ) ; } log ( msg ) ; } } protected static String formatTime ( final long millis ) { } protected void printMessage ( final String message , final PrintStream stream , final int priority ) { } protected void log ( String message ) { } }

Fix:
StringBuffer tmp = new StringBuffer ( ) ;
Buggy code:
public class XMLDecoderTest extends TestCase { public XMLDecoderTest ( String arg0 ) { } public void testDecodeFile ( ) throws Exception { XMLDecoder xmlDecoder = new XMLDecoder ( ) ; <START_BUG> List events = xmlDecoder . decode ( new File ( "tests//witness//eventSet.1.xml" ) ) ; <END_BUG> assertTrue ( ( "Should<seq2seq4repair_space>have<seq2seq4repair_space>returned<seq2seq4repair_space>at<seq2seq4repair_space>least<seq2seq4repair_space>418<seq2seq4repair_space>events:<seq2seq4repair_space>" + ( events . size ( ) ) ) , ( ( events . size ( ) ) == 418 ) ) ; } }

Fix:
List events = xmlDecoder . decode ( new File ( "tests//witness//eventSet.1.xml" ) . toURL ( ) ) ;
Buggy code:
public class Procedure implements Cloneable { private String name ; private Map < String , IVariable > varList ; private Map < String , Construct > originals = new HashMap < String , Construct > ( ) ; private List < IVariable > varIndex = new ArrayList < IVariable > ( ) ; private GenericTreeNode < Construct > tree ; public Procedure ( String name , List < IVariable > varList , GenericTreeNode < Construct > tree , CFunction f ) { } public String getName ( ) { } @ Override public String toString ( ) { } public Construct cexecute ( List < GenericTreeNode < Construct > > args , Env env ) { } public Construct execute ( List < Construct > args , Env env ) { env . SetVarList ( new IVariableList ( ) ) ; CArray array = new CArray ( 0 , null ) ; for ( String key : originals . keySet ( ) ) { Construct c = originals . get ( key ) ; env . GetVarList ( ) . set ( new IVariable ( key , c , 0 , null ) ) ; array . push ( c ) ; } GenericTree < Construct > root = new GenericTree < Construct > ( ) ; root . setRoot ( tree ) ; <START_BUG> Script fakeScript = new Script ( null , null ) ; <END_BUG> for ( int i = 0 ; i < ( args . size ( ) ) ; i ++ ) { Construct c = args . get ( i ) ; array . set ( i , c ) ; if ( ( varIndex . size ( ) ) > i ) { String varname = varIndex . get ( i ) . getName ( ) ; env . GetVarList ( ) . set ( new IVariable ( varname , c , c . getLineNum ( ) , c . getFile ( ) ) ) ; } } env . GetVarList ( ) . set ( new IVariable ( "@arguments" , array , 0 , null ) ) ; try { fakeScript . eval ( tree , env ) ; } catch ( FunctionReturnException e ) { return e . getReturn ( ) ; } return new CVoid ( 0 , null ) ; } @ Override public Procedure clone ( ) throws CloneNotSupportedException { } }

Fix:
Script fakeScript = Script . GenerateScript ( tree , env . GetLabel ( ) ) ;
Buggy code:
class CSVLexer extends Lexer { public CSVLexer ( final CSVFormat format , final ExtendedBufferedReader in ) { } @ Override Token nextToken ( final Token token ) throws IOException { int lastChar = in . readAgain ( ) ; int c = in . read ( ) ; boolean eol = isEndOfLine ( c ) ; <START_BUG> if ( emptyLinesIgnored ) { <END_BUG> while ( eol && ( isStartOfLine ( lastChar ) ) ) { lastChar = c ; c = in . read ( ) ; eol = isEndOfLine ( c ) ; if ( isEndOfFile ( c ) ) { token . type = Type . EOF ; return token ; } } } if ( ( isEndOfFile ( lastChar ) ) || ( ( ! ( isDelimiter ( lastChar ) ) ) && ( isEndOfFile ( c ) ) ) ) { token . type = Type . EOF ; return token ; } if ( ( isStartOfLine ( lastChar ) ) && ( isCommentStart ( c ) ) ) { final String comment = in . readLine ( ) . trim ( ) ; token . content . append ( comment ) ; token . type = Type . COMMENT ; return token ; } while ( ( token . type ) == ( Type . INVALID ) ) { if ( ignoreSurroundingSpaces ) { while ( ( isWhitespace ( c ) ) && ( ! eol ) ) { c = in . read ( ) ; eol = isEndOfLine ( c ) ; } } if ( isDelimiter ( c ) ) { token . type = Type . TOKEN ; } else if ( eol ) { token . type = Type . EORECORD ; } else if ( isEncapsulator ( c ) ) { encapsulatedTokenLexer ( token ) ; } else if ( isEndOfFile ( c ) ) { token . type = Type . EOF ; token . isReady = true ; } else { simpleTokenLexer ( token , c ) ; } } return token ; } private Token simpleTokenLexer ( final Token tkn , int c ) throws IOException { } private Token encapsulatedTokenLexer ( final Token tkn ) throws IOException { } }

Fix:
if ( ignoreEmptyLines ) {
Buggy code:
public class Frequency implements Serializable { private static final long serialVersionUID = - 3845586908418844111L ; private final TreeMap < Comparable < ? > , Long > freqTable ; public Frequency ( ) { } @ SuppressWarnings ( "unchecked" ) public Frequency ( Comparator < ? > comparator ) { } @ Override public String toString ( ) { } public void addValue ( Comparable < ? > v ) throws MathIllegalArgumentException { } public void incrementValue ( Comparable < ? > v , long increment ) { } public void addValue ( int v ) throws MathIllegalArgumentException { } public void addValue ( long v ) throws MathIllegalArgumentException { } public void addValue ( char v ) throws MathIllegalArgumentException { } public void clear ( ) { } public Iterator < Comparable < ? > > valuesIterator ( ) { } public Iterator < Map . Entry < Comparable < ? > , Long > > entrySetIterator ( ) { } public long getSumFreq ( ) { } public long getCount ( Comparable < ? > v ) { } public long getCount ( int v ) { } public long getCount ( long v ) { } public long getCount ( char v ) { } public int getUniqueCount ( ) { } public double getPct ( Comparable < ? > v ) { } public double getPct ( int v ) { } public double getPct ( long v ) { } public double getPct ( char v ) { } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public long getCumFreq ( Comparable < ? > v ) { } public long getCumFreq ( int v ) { } public long getCumFreq ( long v ) { } public long getCumFreq ( char v ) { } public double getCumPct ( Comparable < ? > v ) { } public double getCumPct ( int v ) { } public double getCumPct ( long v ) { } public double getCumPct ( char v ) { } public List < Comparable < ? > > getMode ( ) { } public void merge ( final Frequency other ) throws NullArgumentException { MathUtils . checkNotNull ( other , NULL_NOT_ALLOWED ) ; final Iterator < Map . Entry < Comparable < ? > , Long > > iter = other . entrySetIterator ( ) ; while ( iter . hasNext ( ) ) { final Map . Entry < Comparable < ? > , Long > entry = iter . next ( ) ; <START_BUG> incrementValue ( entry . getKey ( ) , entry . getValue ( ) ) ; <END_BUG> } } public void merge ( final Collection < Frequency > others ) throws NullArgumentException { } private static class NaturalComparator < T extends Comparable < T > > implements Serializable , Comparator < Comparable < T > > { private static final long serialVersionUID = - 3852193713161395148L ; @ SuppressWarnings ( "unchecked" ) public int compare ( Comparable < T > o1 , Comparable < T > o2 ) { } } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } }

Fix:
incrementValue ( entry . getKey ( ) , entry . getValue ( ) . longValue ( ) ) ;
Buggy code:
@ Entity @ Table ( name = "acct_user" ) @ Cache ( usage = CacheConcurrencyStrategy . READ_WRITE ) public class User extends IdEntity { private String loginName ; private String password ; private String name ; private String email ; private List < Group > groupList = Lists . newArrayList ( ) ; <START_BUG> @ Column ( name = "LOGIN_NAME" , nullable = false , unique = true ) <END_BUG> public String getLoginName ( ) { return loginName ; } public void setLoginName ( String loginName ) { } public String getPassword ( ) { } public void setPassword ( String password ) { } public String getName ( ) { } public void setName ( String name ) { } public String getEmail ( ) { } public void setEmail ( String email ) { } @ ManyToMany @ JoinTable ( name = "acct_user_group" , joinColumns = { @ JoinColumn ( name = "user_id" ) } , inverseJoinColumns = { @ JoinColumn ( name = "group_id" ) } ) @ Fetch ( FetchMode . SUBSELECT ) @ OrderBy ( "id" ) @ Cache ( usage = CacheConcurrencyStrategy . READ_WRITE ) public List < Group > getGroupList ( ) { } public void setGroupList ( List < Group > groupList ) { } @ Transient public String getGroupNames ( ) { } @ Override public String toString ( ) { } No newline ; at end ; of file ; }

Fix:
@ Column ( nullable = false , unique = true )