nus-yam/ex-repair huggingface dataset:
Buggy code:
public class HomeFragment extends TraktFragment implements onDashboardButtonClicked { private RelativeLayout rlWatchingNow ; private TextView tvEpisodeTitle ; private TextView tvEpisodeEpisode ; private ImageView ivScreen ; private TvShowEpisode episode ; private String tvdbId ; public static HomeFragment newInstance ( Bundle args ) { } public HomeFragment ( ) { } public HomeFragment ( FragmentListener listener ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public void onActivityCreated ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onResume ( ) { super . onResume ( ) ; new com . florianmski . tracktoid . trakt . tasks . get . CheckinTask ( tm , this , new com . florianmski . tracktoid . trakt . tasks . get . CheckinTask . CheckinListener ( ) { @ Override public void onCheckin ( com . jakewharton . trakt . entities . ActivityItemBase checkin ) { if ( ( ( checkin != null ) && ( ( checkin . type ) == ( com . jakewharton . trakt . enumerations . ActivityType . Episode ) ) ) && ( ( checkin . action ) == ( com . jakewharton . trakt . enumerations . ActivityAction . Checkin ) ) ) { tvdbId = checkin . show . tvdbId ; episode = checkin . episode ; rlWatchingNow . setVisibility ( View . VISIBLE ) ; tvEpisodeTitle . setText ( episode . title ) ; tvEpisodeEpisode . setText ( ( ( ( com . florianmski . tracktoid . Utils . addZero ( episode . number ) ) + "x" ) + ( com . florianmski . tracktoid . Utils . addZero ( episode . season ) ) ) ) ; com . florianmski . tracktoid . image . Image i = new com . florianmski . tracktoid . image . Image ( checkin . show . tvdbId , episode . images . screen , episode . season , episode . number ) ; final com . androidquery . AQuery aq = new com . androidquery . AQuery ( getActivity ( ) ) ; com . androidquery . callback . BitmapAjaxCallback cb = new com . androidquery . callback . BitmapAjaxCallback ( ) { @ Override public void callback ( String url , ImageView iv , android . graphics . Bitmap bm , com . androidquery . callback . AjaxStatus status ) { <START_BUG> aq . id ( ivScreen ) . image ( com . florianmski . tracktoid . Utils . shadowBitmap ( com . florianmski . tracktoid . Utils . borderBitmap ( bm , getActivity ( ) ) ) ) . animate ( android . R . anim . fade_in ) ; <END_BUG> } } . url ( i . getUrl ( ) ) . fileCache ( false ) . memCache ( true ) . ratio ( ( 9.0F // 16.0F ) ) ; aq . id ( ivScreen ) . image ( cb ) ; } else { rlWatchingNow . setVisibility ( View . INVISIBLE ) ; } } } ) . silent ( true ) . fire ( ) ; } @ Override public void onRestoreState ( Bundle savedInstanceState ) { } @ Override public void onSaveState ( Bundle toSave ) { } @ Override public void onClick ( int buttonId ) { } }

Fix:
aq . id ( ivScreen ) . image ( com . florianmski . tracktoid . Utils . borderBitmap ( bm , getActivity ( ) ) ) . animate ( android . R . anim . fade_in ) ;
Buggy code:
public class MenuActivity extends Activity { GlobalState global ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } public void onInboxClick ( View view ) { } public void onNewMessageClick ( View view ) { } public void onOutboxClick ( View view ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onBackPressed ( ) { } private void logout ( ) { AlertDialog . Builder builder = new AlertDialog . Builder ( this ) ; builder . setMessage ( "Do<seq2seq4repair_space>you<seq2seq4repair_space>want<seq2seq4repair_space>to<seq2seq4repair_space>log<seq2seq4repair_space>out?" ) ; builder . setTitle ( "Log<seq2seq4repair_space>out?" ) ; builder . setCancelable ( true ) ; builder . setPositiveButton ( "Yes" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int id ) { SharedPreferences prefs = getSharedPreferences ( "se.kth.anderssonljung.twittbook" , MODE_PRIVATE ) ; <START_BUG> prefs . edit ( ) . remove ( "userid" ) . apply ( ) ; <END_BUG> global . setUser ( null ) ; finish ( ) ; } } ) ; builder . setNegativeButton ( "No" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int id ) { dialog . cancel ( ) ; } } ) ; AlertDialog alert = builder . create ( ) ; alert . show ( ) ; } private class SyncInboxOutbox extends AsyncTask < Void , Void , ResultCode > { @ Override protected ResultCode doInBackground ( Void ... params ) { } @ Override protected void onPostExecute ( ResultCode result ) { } } }

Fix:
prefs . edit ( ) . remove ( "username" ) . apply ( ) ;
Buggy code:
public class Translator { private static Category cat = Category . getInstance ( Translator . class ) ; private static Properties images = null ; private static String propertiesFile = "images.properties" ; public static void init ( ) { <START_BUG> Locale . setDefault ( new Locale ( System . getProperty ( "user.language" , "en" ) , System . getProperty ( "user.country" , "CA" ) ) ) ; <END_BUG> org . workingfrog . i18n . util . Translator . setDefaultLocale ( new Locale ( "en" , "" ) ) ; org . workingfrog . i18n . util . Translator . loadBundles ( "org.argouml.i18n" ) ; Localizer . addResource ( "GefBase" , "org.tigris.gef.base.BaseResourceBundle" ) ; Localizer . addResource ( "GefPres" , "org.tigris.gef.presentation.PresentationResourceBundle" ) ; Localizer . addResource ( "CoreMenu" , "org.argouml.i18n.MenuResourceBundle" ) ; Localizer . addResource ( "CoreSettings" , "org.argouml.i18n.SettingsResourceBundle" ) ; Localizer . addResource ( "UMLMenu" , "org.argouml.i18n.UMLResourceBundle" ) ; Localizer . addResource ( "Cognitive" , "org.argouml.i18n.UMLCognitiveResourceBundle" ) ; Localizer . addResource ( "Tree" , "org.argouml.i18n.TreeResourceBundle" ) ; Localizer . addResource ( "Actions" , "org.argouml.i18n.ActionResourceBundle" ) ; org . workingfrog . i18n . util . Translator . check ( ALL ) ; } public static Locale [ ] getLocales ( ) { } public static void setLocale ( Locale locale ) { } private static Properties loadImageBindings ( String file ) { } public static String getImageBinding ( String name ) { } public static String localize ( String bundle , String key ) { } }

Fix:
Locale . setDefault ( new Locale ( System . getProperty ( "user.language" , "en" ) , System . getProperty ( "user.country" , "" ) ) ) ;
Buggy code:
public class VersionCommand extends BukkitCommand { @ Override public void run ( CommandSender sender , String [ ] args ) { List < String > output = getBoincCommunicator ( ) . getBoincVersion ( ) ; <START_BUG> sender . sendMessage ( ( ( String [ ] ) ( output . toArray ( ) ) ) ) ; <END_BUG> } }

Fix:
sender . sendMessage ( output . toArray ( new String [ 1 ] ) ) ;
Buggy code:
public class MyCategory extends Category { private static String FQCN = MyCategory . class . getName ( ) ; private static MyCategoryFactory myFactory = new MyCategoryFactory ( ) ; public static void main ( String [ ] args ) { if ( ( args . length ) == 0 ) { Category root = Category . getRoot ( ) ; Layout layout = new PatternLayout ( "%p<seq2seq4repair_space>[%t]<seq2seq4repair_space>%c<seq2seq4repair_space>-<seq2seq4repair_space>%m%n" ) ; root . addAppender ( new ConsoleAppender ( layout , ConsoleAppender . SYSTEM_OUT ) ) ; } else if ( ( args . length ) == 1 ) { if ( args [ 0 ] . endsWith ( "xml" ) ) { DOMConfigurator . configure ( args [ 0 ] ) ; } else { PropertyConfigurator . configure ( args [ 0 ] ) ; } } else { MyCategory . usage ( "Incorrect<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>parameters." ) ; } try { MyCategory c = ( ( MyCategory ) ( MyCategory . getInstance ( "some.cat" ) ) ) ; c . trace ( "Hello" ) ; <START_BUG> c . debug ( "World." ) ; <END_BUG> } catch ( ClassCastException e ) { LogLog . error ( "Did<seq2seq4repair_space>you<seq2seq4repair_space>forget<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>the<seq2seq4repair_space>factory<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>config<seq2seq4repair_space>file?" , e ) ; } } static void usage ( String errMsg ) { } public MyCategory ( String name ) { } public void debug ( String message ) { } public static Category getInstance ( String name ) { } public void trace ( String message ) { } }

Fix:
c . debug ( "Hello" ) ;
Buggy code:
public class Parameter extends ModelElementImpl { public static final Name RETURN_NAME = new Name ( "return" ) ; public Expression _defaultValue ; public ParameterDirectionKind _kind ; public BehavioralFeature _behavioralFeature ; public Classifier _type ; public Event _parameters ; public Vector _availability = new Vector ( ) ; public Signal _signal ; public Parameter ( ) { } public Parameter ( Name name ) { } public Parameter ( String nameStr ) { } public Parameter ( Classifier type , Name name ) { } public Parameter ( Classifier type , String nameStr ) { } public Expression getDefaultValue ( ) { } public void setDefaultValue ( Expression x ) { } public ParameterDirectionKind getKind ( ) { } public void setKind ( ParameterDirectionKind x ) { } public BehavioralFeature getBehavioralFeature ( ) { } public void setBehavioralFeature ( BehavioralFeature x ) { } public Classifier getType ( ) { } public void setType ( Classifier x ) { } public Event getParameters ( ) { } public void setParameters ( Event x ) { } public Vector getAvailability ( ) { <START_BUG> return ( ( Vector ) ( _availability . clone ( ) ) ) ; <END_BUG> } public void setAvailability ( Vector x ) { } public void addAvailability ( ObjectFlowState x ) { } public void removeAvailability ( ObjectFlowState x ) { } public Signal getSignal ( ) { } public void setM_Signal ( Signal x ) { } }

Fix:
return ( ( Vector ) ( _availability ) ) ;
Buggy code:
public class FragmentViewPager extends Fragment { private MainActivity mainActivity ; public static FragmentViewPager getInstance ( ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onViewCreated ( View view , Bundle savedInstanceState ) { } @ Override public void onDestroy ( ) { } @ Override public void onAttach ( Activity activity ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { <START_BUG> inflater . inflate ( ok_btn , menu ) ; <END_BUG> super . onCreateOptionsMenu ( menu , inflater ) ; } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
inflater . inflate ( empty , menu ) ;
Buggy code:
public class UniformRealDistribution extends AbstractRealDistribution { public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1.0E-9 ; private static final long serialVersionUID = 20120109L ; private final double lower ; private final double upper ; private final double solverAbsoluteAccuracy ; public UniformRealDistribution ( ) { } public UniformRealDistribution ( double lower , double upper ) throws NumberIsTooLargeException { } public UniformRealDistribution ( double lower , double upper , double inverseCumAccuracy ) throws NumberIsTooLargeException { } public UniformRealDistribution ( RandomGenerator rng , double lower , double upper , double inverseCumAccuracy ) throws NumberIsTooLargeException { } public double density ( double x ) { } public double cumulativeProbability ( double x ) { } @ Override protected double getSolverAbsoluteAccuracy ( ) { } public double getNumericalMean ( ) { } public double getNumericalVariance ( ) { } public double getSupportLowerBound ( ) { } public double getSupportUpperBound ( ) { } public boolean isSupportLowerBoundInclusive ( ) { } public boolean isSupportUpperBoundInclusive ( ) { <START_BUG> return false ; <END_BUG> } public boolean isSupportConnected ( ) { } @ Override public double sample ( ) { } }

Fix:
return true ;
Buggy code:
public abstract class SparseVector extends AbstractVector { public static SparseVector zero ( int length ) { } public static SparseVector random ( int length , double density , Random random ) { } public static SparseVector fromArray ( double [ ] array ) { } protected int cardinality ; public SparseVector ( int length , int cardinality ) { } public int cardinality ( ) { } public double density ( ) { } @ Override public double get ( int i ) { } public abstract double getOrElse ( int i , double defaultValue ) { } public boolean isZeroAt ( int i ) { } public abstract boolean nonZeroAt ( int i ) { } public double foldNonZero ( VectorAccumulator accumulator ) { } public void eachNonZero ( VectorProcedure procedure ) { } @ Override public Vector add ( double value ) { } @ Override public Vector multiply ( double value ) { <START_BUG> Vector result = copy ( ) ; <END_BUG> VectorIterator it = nonZeroIterator ( ) ; while ( it . hasNext ( ) ) { double x = it . next ( ) ; int i = it . index ( ) ; result . set ( i , ( x * value ) ) ; } return result ; } @ Override public double max ( ) { } @ Override public double min ( ) { } @ Override public double euclideanNorm ( ) { } @ Override public double manhattanNorm ( ) { } @ Override public double infinityNorm ( ) { } public abstract VectorIterator nonZeroIterator ( ) { } @ Override public < T extends Vector > T to ( VectorFactory < T > factory ) { } @ Override public int hashCode ( ) { } @ Override public < T > T apply ( VectorOperation < T > operation ) { } @ Override public < T > T apply ( VectorVectorOperation < T > operation , Vector that ) { } @ Override public < T > T apply ( VectorMatrixOperation < T > operation , Matrix that ) { } @ Override public Matrix toRowMatrix ( ) { } @ Override public Matrix toColumnMatrix ( ) { } @ Override public Matrix toDiagonalMatrix ( ) { } protected void ensureIndexIsInBounds ( int i ) { } }

Fix:
Vector result = blank ( ) ;
Buggy code:
public class DistFileSystemMain { private String prompt = "%s<seq2seq4repair_space>:<seq2seq4repair_space>" ; private BufferedReader inStream ; private UserManagement userManage = null ; private NodeSearchTable nst = null ; private String ipAddress = null ; private Thread thServ = null ; public DistFileSystemMain ( ) { } public void start_server ( ) { } public void connect_to_network ( ) { } public void run_interface ( ) { String input ; boolean exit = false ; while ( ! exit ) { try { System . out . printf ( this . prompt , this . userManage . get_ownUserName ( ) ) ; input = inStream . readLine ( ) ; if ( input . equals ( "view<seq2seq4repair_space>predecessor" ) ) { System . out . printf ( "Predecessor<seq2seq4repair_space>ID<seq2seq4repair_space>=<seq2seq4repair_space>%s\n" , this . nst . get_predecessorID ( ) ) ; System . out . printf ( "Predecessor<seq2seq4repair_space>IP<seq2seq4repair_space>=<seq2seq4repair_space>%s\n" , this . nst . get_predecessorIPAddress ( ) ) ; } else if ( input . equals ( "view<seq2seq4repair_space>node<seq2seq4repair_space>search<seq2seq4repair_space>table" ) ) { for ( int index = 0 ; index < ( this . nst . size ( ) ) ; index ++ ) { System . out . printf ( "Entry:<seq2seq4repair_space>%d\tID:<seq2seq4repair_space>%s\tIP:<seq2seq4repair_space>%s\n" , index , this . nst . get_IDAt ( index ) , this . nst . get_IPAt ( index ) ) ; } } else if ( input . equals ( "view<seq2seq4repair_space>own<seq2seq4repair_space>information" ) ) { System . out . printf ( "ID:<seq2seq4repair_space>%s\nIP:<seq2seq4repair_space>%s\n" , this . nst . get_ownID ( ) , this . nst . get_ownIPAddress ( ) ) ; } else if ( input . contains ( "sha1" ) ) { String [ ] vals = input . split ( "<seq2seq4repair_space>" ) ; for ( int index = 0 ; index < ( vals . length ) ; index ++ ) { System . out . printf ( "%s<seq2seq4repair_space>:\t%s\n" , vals [ index ] , Sha1Generator . generate_Sha1 ( vals [ index ] ) ) ; } } else <START_BUG> if ( input . contains ( "Test" ) ) { <END_BUG> DistFileSystemTest dfst = new DistFileSystemTest ( ) ; dfst . runTestCommand ( input ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } } public static void main ( String [ ] args ) { } }

Fix:
if ( input . contains ( "test" ) ) {
Buggy code:
public class ActivityDAO implements IDAO < Activity > { private static ActivityDAO instance ; public static synchronized ActivityDAO getInstance ( ) { } public Integer findByAll ( ActivityVo vo , EntityManager em ) { Integer id ; <START_BUG> Query q = em . createQuery ( ( "SELECT<seq2seq4repair_space>a.idActivity<seq2seq4repair_space>FROM<seq2seq4repair_space>Activity<seq2seq4repair_space>a<seq2seq4repair_space>" + ( "WHERE<seq2seq4repair_space>a.nameText<seq2seq4repair_space>LIKE<seq2seq4repair_space>:nameText<seq2seq4repair_space>" + "AND<seq2seq4repair_space>a.type<seq2seq4repair_space>LIKE<seq2seq4repair_space>:typeActivity<seq2seq4repair_space>AND<seq2seq4repair_space>a.urlText<seq2seq4repair_space>LIKE<seq2seq4repair_space>:url" ) ) ) . setParameter ( "nameText" , vo . getName ( ) ) . setParameter ( "typeActivity" , vo . getType ( ) ) . setParameter ( "url" , vo . getUrl ( ) ) ; <END_BUG> try { id = ( ( Integer ) ( q . getSingleResult ( ) ) ) ; } catch ( NonUniqueResultException e ) { id = ( ( Integer ) ( q . getResultList ( ) . get ( 0 ) ) ) ; } catch ( NoResultException e ) { id = null ; } return id ; } @ Override public void persist ( Activity entity , EntityManager em ) { } @ Override public Activity find ( Object id , EntityManager em ) { } @ Override public void update ( Activity entity , EntityManager em ) { } @ Override public void delete ( Object id , EntityManager em ) { } @ Override public List < Activity > getList ( EntityManager em ) { } }

Fix:
Query q = em . createQuery ( ( "SELECT<seq2seq4repair_space>a.idActivity<seq2seq4repair_space>FROM<seq2seq4repair_space>Activity<seq2seq4repair_space>a<seq2seq4repair_space>" + ( "WHERE<seq2seq4repair_space>a.nameText<seq2seq4repair_space>LIKE<seq2seq4repair_space>:nameText<seq2seq4repair_space>" + "AND<seq2seq4repair_space>a.type<seq2seq4repair_space>LIKE<seq2seq4repair_space>:typeActivity<seq2seq4repair_space>AND<seq2seq4repair_space>a.urlText<seq2seq4repair_space>LIKE<seq2seq4repair_space>:url" ) ) ) . setParameter ( "nameText" , vo . getName ( ) ) . setParameter ( "typeActivity" , vo . getType ( ) ) . setParameter ( "url" , vo . getUrl ( ) . replaceAll ( "\\\\" , "\\\\\\\\" ) ) ;
Buggy code:
@ AllArgsConstructor public abstract class BaseSimpleReact { protected abstract ExecutorService getExecutor ( ) { } protected abstract boolean isEager ( ) { } protected abstract RetryExecutor getRetrier ( ) { } protected abstract boolean isAsync ( ) { } public abstract < U > SimpleReactStream < U > construct ( Stream s , List < CompletableFuture > org ) { } public < U > SimpleReactStream < U > fromStream ( final Stream < CompletableFuture < U > > stream ) { } public < U > SimpleReactStream < U > fromStreamWithoutFutures ( final Stream < U > stream ) { } public < U > SimpleReactStream < U > fromPrimitiveStream ( final IntStream stream ) { } public < U > SimpleReactStream < U > fromPrimitiveStream ( final DoubleStream stream ) { } public < U > SimpleReactStream < U > fromPrimitiveStream ( final LongStream stream ) { } public < U > SimpleReactStream < U > of ( U ... array ) { } @ SuppressWarnings ( "unchecked" ) public < U > SimpleReactStream < U > react ( final List < Supplier < U > > actions ) { } private final Object iterationLock = "iterationLock" ; @ SuppressWarnings ( "unchecked" ) public < U > SimpleReactStream < U > react ( final Iterator < U > iterator , int maxTimes ) { } @ SuppressWarnings ( "unchecked" ) public < R > SimpleReactStream < R > reactToCollection ( final Collection < R > collection ) { <START_BUG> return react ( collection . iterator ( ) , collection . size ( ) ) ; <END_BUG> } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public < U > SimpleReactStream < U > react ( final Supplier < U > s , Generator t ) { } @ SuppressWarnings ( "rawtypes" ) public static ParallelGenerator times ( int times ) { } @ SuppressWarnings ( "rawtypes" ) public static ParallelGenerator timesInSequence ( int times ) { } public < U > SimpleReactStream < U > react ( final Function < U , U > f , ReactIterator < U > t ) { } public static < T > ReactIterator < T > iterate ( T seed ) { } public < U > SimpleReactStream < U > react ( final Supplier < U > ... actions ) { } @ SuppressWarnings ( "unchecked" ) @ VisibleForTesting protected < U > SimpleReactStream < U > reactI ( final Supplier < U > ... actions ) { } }

Fix:
return fromStreamWithoutFutures ( collection . stream ( ) ) ;
Buggy code:
@ RestController public class DashboardAPIs { @ Autowired private CommitService commitService ; @ RequestMapping ( value = "//admin//commits.json" , method = RequestMethod . GET ) public List < CommitEntity > getAllCommits ( ) throws ParseException { } @ RequestMapping ( value = "//admin//punchcards.json" , method = RequestMethod . GET ) public List < PunchCard > generatePunchCardsByUsername ( @ RequestParam ( "username" ) String name ) { } @ RequestMapping ( value = "//admin//punchCardsByRepo.json" , method = RequestMethod . GET ) public List < PunchCard > generatePunchCardsByRepo ( @ RequestParam ( "repo" ) String repo , @ RequestParam ( "ownername" ) String ownername , @ RequestParam ( "committer" ) String committer ) throws ParseException { } @ RequestMapping ( value = "//admin//commitsByRepo.json" , method = RequestMethod . GET ) public List < CommitEntity > getAllCommitsInRepo ( @ RequestParam ( "repo" ) String repo , @ RequestParam ( "ownername" ) String ownername ) throws ParseException { } <START_BUG> @ RequestMapping ( value = "//admin//commitsByRepo.json" , method = RequestMethod . GET ) <END_BUG> public List < CommitEntity > getAllCommitsInRepoByDate ( @ RequestParam ( "repo" ) String repo , @ RequestParam ( "ownername" ) String ownername , @ RequestParam ( "startdate" ) String startDate , @ RequestParam ( "enddate" ) String endDate ) throws ParseException { String commitUrl = ( ( ( "https:////api.github.com//repos//" + ownername ) + "//" ) + repo ) + "//commits" ; commitService . setCommitUrl ( commitUrl ) ; commitService . extractAllCommits ( ) ; return commitService . getAllCommitsByDate ( startDate , endDate ) ; } No newline ; at end ; of file ; }

Fix:
@ RequestMapping ( value = "//admin//commitsByRepoByDate.json" , method = RequestMethod . GET )
Buggy code:
public class LOBStoredProcedure { public static int CLOBCREATELOCATOR ( ) throws SQLException { } public static void CLOBRELEASELOCATOR ( int LOCATOR ) throws SQLException { } public static long CLOBGETPOSITIONFROMSTRING ( int LOCATOR , String searchLiteral , long fromPosition ) throws SQLException { } public static long CLOBGETPOSITIONFROMLOCATOR ( int LOCATOR , int searchLocator , long fromPosition ) throws SQLException { } public static long CLOBGETLENGTH ( int LOCATOR ) throws SQLException { } public static String CLOBGETSUBSTRING ( int LOCATOR , long pos , int len ) throws SQLException { } public static void CLOBSETSTRING ( int LOCATOR , long pos , int length , String str ) throws SQLException { } public static void CLOBTRUNCATE ( int LOCATOR , long length ) throws SQLException { } private static Clob getClobObjectCorrespondingtoLOCATOR ( int LOCATOR ) throws SQLException { } public static int BLOBCREATELOCATOR ( ) throws SQLException { } public static void BLOBRELEASELOCATOR ( int LOCATOR ) throws SQLException { } public static long BLOBGETPOSITIONFROMLOCATOR ( int LOCATOR , int searchLocator , long pos ) throws SQLException { } public static long BLOBGETPOSITIONFROMBYTES ( int LOCATOR , byte [ ] searchBytes , long pos ) throws SQLException { } public static long BLOBGETLENGTH ( int LOCATOR ) throws SQLException { } public static byte [ ] BLOBGETBYTES ( int LOCATOR , long pos , int len ) throws SQLException { } public static void BLOBSETBYTES ( int LOCATOR , long pos , int len , byte [ ] replaceBytes ) throws SQLException { } public static void BLOBTRUNCATE ( int LOCATOR , long length ) throws SQLException { } private static Blob getBlobObjectCorrespondingtoLOCATOR ( int LOCATOR ) throws SQLException { } private static EmbedConnection getEmbedConnection ( ) throws SQLException { InternalDriver id = InternalDriver . activeDriver ( ) ; if ( id != null ) { <START_BUG> EmbedConnection conn = ( ( EmbedConnection ) ( id . connect ( "jdbc:default:connection" , null ) ) ) ; <END_BUG> if ( conn != null ) return conn ; } throw Util . noCurrentConnection ( ) ; } private static SQLException newSQLException ( String messageId ) { } }

Fix:
EmbedConnection conn = ( ( EmbedConnection ) ( id . connect ( "jdbc:default:connection" , null , 0 ) ) ) ;
Buggy code:
public class App implements ParseExpr { ParseExpr first ; ParseExpr second ; public App ( ParseExpr first , ParseExpr second ) { } @ Override public String toString ( ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object o ) { } static Type substituteTyVar ( String name , Type t1 , Type t2 ) { } public static < T , E > T getKeyByValue ( Map < T , E > map , E value ) { } static boolean tvInArr ( TyVar tv , Arrow arr ) { } static void unifyTypes ( Type t1 , Type t2 , HashMap < ParseExpr , Type > env ) { } static boolean areTypesCompatible ( Type t1 , Type t2 ) { } @ Override public void inferType ( HashMap < ParseExpr , Type > map ) { if ( ( second ) instanceof Abs ) { HashMap < ParseExpr , Type > new_env = new HashMap ( map ) ; second . inferType ( new_env ) ; Type t = new_env . get ( second ) ; second = new Var ( ( "anonimous" + ( String . valueOf ( Count ) ) ) ) ; Var . Count += 1 ; map . put ( second , t ) ; } else { second . inferType ( map ) ; } if ( ( first ) instanceof Var ) { if ( ! ( map . containsKey ( first ) ) ) { TyVar tv = new TyVar ( ) ; map . put ( first , new Arrow ( map . get ( second ) , tv ) ) ; map . put ( this , tv ) ; } else { App . unifyTypes ( new Arrow ( map . get ( second ) , new TyVar ( ) ) , map . get ( first ) , map ) ; Arrow arrow = ( ( Arrow ) ( map . get ( first ) ) ) ; map . put ( this , arrow . to ) ; } } else if ( ( first ) instanceof App ) { first . inferType ( map ) ; App . unifyTypes ( map . get ( first ) , new Arrow ( map . get ( second ) , new TyVar ( ) ) , map ) ; Arrow arrow = ( ( Arrow ) ( map . get ( first ) ) ) ; map . put ( this , arrow . to ) ; } else if ( ( first ) instanceof Abs ) { HashMap < ParseExpr , Type > new_env = new HashMap ( map ) ; first . inferType ( new_env ) ; Type t = new_env . get ( first ) ; first = new Var ( ( "anonimous" + ( String . valueOf ( Count ) ) ) ) ; Var . Count += 1 ; map . put ( first , t ) ; Arrow arrow = ( ( Arrow ) ( map . get ( first ) ) ) ; App . unifyTypes ( arrow . from , map . get ( second ) , map ) ; <START_BUG> map . put ( this , arrow . to ) ; <END_BUG> } } }

Fix:
map . put ( this , ( ( Arrow ) ( map . get ( first ) ) ) . to ) ;
Buggy code:
public class CommitServiceTest extends BaseUnitTest { @ Autowired private CommitService commitService ; @ Autowired private RestTemplate rest ; @ Autowired private CommitRepository commitRepo ; @ Test public void testExtractAllCommits ( ) throws ParseException { MockRestServiceServer mockCommit = MockRestServiceServer . createServer ( rest ) ; mockCommit . expect ( requestTo ( commitService . getDefaultCommitUrl ( ) ) ) . andExpect ( method ( GET ) ) . andRespond ( withJson ( "commits.json" ) ) ; List < CommitEntity > entities = commitService . extractAllCommits ( ) ; assertEquals ( entities . size ( ) , 4 ) ; CommitEntity firstEntity = entities . get ( 0 ) ; DateTimeFormatter formatter = DateTimeFormat . forPattern ( "yyyy-MM-dd'T'HH:mm:ssZ" ) ; DateTime date = formatter . parseDateTime ( "2013-03-20T15:07:51Z" ) ; assertEquals ( firstEntity . getDate ( ) , date ) ; assertEquals ( firstEntity . getUser ( ) , "Sripathi<seq2seq4repair_space>Krishnan" ) ; assertEquals ( commitRepo . count ( ) , 4 ) ; List < PunchCard > punchCards = commitService . genratePunchCards ( "Sripathi<seq2seq4repair_space>Krishnan" ) ; assertEquals ( punchCards . size ( ) , 24 ) ; PunchCard firstCard = punchCards . get ( 0 ) ; assertEquals ( firstCard . getNoOfCommits ( ) , 0 ) ; <START_BUG> assertEquals ( commitService . getAllCommitsByDate ( "2015-01-13T00:00:00Z" , "2015-01-15T00:00:00Z" ) . size ( ) , 0 ) ; <END_BUG> } }

Fix:
assertEquals ( commitService . getAllCommitsByDate ( "2013-03-20T07:33:02Z" , "2015-01-15T00:00:00Z" ) . size ( ) , 4 ) ;
Buggy code:
public class FixBug { public static void main ( String [ ] args ) { System . out . print ( "Fix<seq2seq4repair_space>Bug" ) ; <START_BUG> System . out . print ( "Fix<seq2seq4repair_space>Bug2" ) ; <END_BUG> } }

Fix:
System . out . print ( "Fix<seq2seq4repair_space>Bug3" ) ;
Buggy code:
public abstract class AbstractAjaxTimerBehavior extends AbstractDefaultAjaxBehavior { private static final long serialVersionUID = 1L ; private Duration updateInterval ; private boolean stopped = false ; private boolean headRendered = false ; public AbstractAjaxTimerBehavior ( final Duration updateInterval ) { } public final void stop ( ) { } protected final void setUpdateInterval ( Duration updateInterval ) { } public final Duration getUpdateInterval ( ) { } @ Override public void renderHead ( IHeaderResponse response ) { } protected final String getJsTimeoutCall ( final Duration updateInterval ) { } @ Override protected CharSequence getCallbackScript ( ) { } @ Override protected CharSequence getPreconditionScript ( ) { } protected boolean onlyTargetActivePage ( ) { } @ Override protected final void respond ( final AjaxRequestTarget target ) { onTimer ( target ) ; <START_BUG> if ( ! ( stopped ) ) { <END_BUG> target . getHeaderResponse ( ) . renderOnLoadJavascript ( getJsTimeoutCall ( updateInterval ) ) ; } } protected abstract void onTimer ( final AjaxRequestTarget target ) { } public final boolean isStopped ( ) { } }

Fix:
if ( ( ! ( stopped ) ) && ( isEnabled ( getComponent ( ) ) ) ) {
Buggy code:
public interface IContextServiceListener { <START_BUG> void contextServiceChanged ( ContextServiceEvent contextServiceEvent ) ; <END_BUG> }

Fix:
void contextServiceChanged ( IContextServiceEvent contextServiceEvent ) ;
Buggy code:
public abstract class AbstractDependencyRespectingResourceAggregatingHeaderResponse < R extends ResourceReferenceCollection , K > extends AbstractResourceAggregatingHeaderResponse < R , K > { public AbstractDependencyRespectingResourceAggregatingHeaderResponse ( IHeaderResponse real ) { } @ Override protected void renderCollection ( Set < ResourceReferenceAndStringData > alreadyRendered , K key , R coll ) { for ( ResourceReferenceAndStringData data : coll ) { ResourceReference ref = data . getReference ( ) ; if ( ref instanceof AbstractResourceDependentResourceReference ) { AbstractResourceDependentResourceReference parent = ( ( AbstractResourceDependentResourceReference ) ( ref ) ) ; <START_BUG> R childColl = AbstractDependencyRespectingResourceAggregatingHeaderResponse . newResourceReferenceCollection ( ) ; <END_BUG> for ( AbstractResourceDependentResourceReference child : parent . getDependentResourceReferences ( ) ) { childColl . add ( AbstractDependencyRespectingResourceAggregatingHeaderResponse . toData ( child ) ) ; } renderCollection ( alreadyRendered , key , childColl ) ; } renderIfNotAlreadyRendered ( alreadyRendered , data ) ; } } private static ResourceReferenceAndStringData toData ( AbstractResourceDependentResourceReference child ) { } }

Fix:
R childColl = AbstractDependencyRespectingResourceAggregatingHeaderResponse . newResourceReferenceCollection ( key ) ;
Buggy code:
public abstract class DefaultStackPresentationSite implements IStackPresentationSite { private StackPresentation presentation ; private int state = IStackPresentationSite . STATE_RESTORED ; private int activeState = StackPresentation . AS_INACTIVE ; public DefaultStackPresentationSite ( ) { } public void setPresentation ( StackPresentation newPresentation ) { } public StackPresentation getPresentation ( ) { } public int getState ( ) { } public void setActive ( int activeState ) { } public int getActive ( ) { } public void selectPart ( IPresentablePart toSelect ) { } public void dispose ( ) { } public void setState ( int newState ) { } public void setPresentationState ( int newState ) { } public boolean isCloseable ( IPresentablePart part ) { <START_BUG> return true ; <END_BUG> } public void dragStart ( IPresentablePart beingDragged , Point initialPosition , boolean keyboard ) { } public void close ( IPresentablePart toClose ) { } public void dragStart ( Point initialPosition , boolean keyboard ) { } public boolean supportsState ( int state ) { } public abstract IPresentablePart getSelectedPart ( ) { } public void addSystemActions ( IMenuManager menuManager ) { } public abstract boolean isPartMoveable ( IPresentablePart toMove ) { } public abstract boolean isStackMoveable ( ) { } }

Fix:
return part . isCloseable ( ) ;
Buggy code:
public class Header { private int id ; private int flags ; private int [ ] counts ; private static Random random = new Random ( ) ; public static final int LENGTH = 12 ; private void init ( ) { } public Header ( int id ) { } public Header ( ) { } Header ( DNSInput in ) throws IOException { } public Header ( byte [ ] b ) throws IOException { } void toWire ( DNSOutput out ) { } public byte [ ] toWire ( ) { } private static boolean validFlag ( int bit ) { } private static void checkFlag ( int bit ) { } public void setFlag ( int bit ) { } public void unsetFlag ( int bit ) { } public boolean getFlag ( int bit ) { } boolean [ ] getFlags ( ) { } public int getID ( ) { } public void setID ( int id ) { } public void setRcode ( int value ) { } public int getRcode ( ) { } public void setOpcode ( int value ) { } public int getOpcode ( ) { } void setCount ( int field , int value ) { } void incCount ( int field ) { } void decCount ( int field ) { <START_BUG> if ( ( counts [ field ] ) == 255 ) <END_BUG> throw new IllegalStateException ( ( "DNS<seq2seq4repair_space>section<seq2seq4repair_space>count<seq2seq4repair_space>cannot<seq2seq4repair_space>" + "be<seq2seq4repair_space>decremented" ) ) ; ( counts [ field ] ) -- ; } public int getCount ( int field ) { } public String printFlags ( ) { } String toStringWithRcode ( int newrcode ) { } public String toString ( ) { } public Object clone ( ) { } }

Fix:
if ( ( counts [ field ] ) == 0 )
Buggy code:
public class Account implements Constants { private String userName ; public Account ( String userName , String password ) throws NoSuchAlgorithmException { } public Account ( String userName ) { } public void removeAccount ( ) { } public String getUserName ( ) { } public boolean passwordMatches ( String password ) throws NoSuchAlgorithmException { } public void resetPassword ( String newPassword ) throws NoSuchAlgorithmException { } public boolean isAdmin ( ) { } public void setAdmin ( boolean isAdmin ) { } public List < Account > getFriends ( ) { } public boolean isFriend ( Account account ) { } public boolean friendshipPending ( Account account ) { } public void addFriend ( Account account ) { } public void unfriend ( Account account ) { } public void sendMessage ( Message message ) { } public void readMessage ( Message message ) { } public void removeMessage ( Message message ) { Map < String , Object > row = new HashMap < String , Object > ( ) ; row . put ( SENDER , message . getSender ( ) ) ; row . put ( CONTENT , message . getContent ( ) ) ; row . put ( RECIPIENT , message . getRecipient ( ) ) ; row . put ( TYPE , message . getType ( ) ) ; row . put ( DATE , message . getDate ( ) ) ; row . put ( READ , message . isRead ( ) ) ; <START_BUG> Database . removeRow ( row ) ; <END_BUG> } public List < Message > getSentMessages ( ) { } public List < Message > getReceivedMessages ( ) { } public static List < Account > getAllUsers ( ) { } private String getHash ( String str ) throws NoSuchAlgorithmException { } private String hexToString ( byte [ ] bytes ) { } }

Fix:
Database . removeRows ( MESSAGES , row ) ;
Buggy code:
public class PropertyFileSnitch extends AbstractRackAwareSnitch { private volatile Properties hostProperties ; private static String RACK_PROPERTY_FILENAME = "cassandra-rack.properties" ; private static Logger logger_ = LoggerFactory . getLogger ( PropertyFileSnitch . class ) ; public PropertyFileSnitch ( ) throws ConfigurationException { } public String [ ] getEndpointInfo ( InetAddress endpoint ) { } public String getDatacenter ( InetAddress endpoint ) { } public String getRack ( InetAddress endpoint ) { } public void reloadConfiguration ( ) throws ConfigurationException { hostProperties = PropertyFileSnitch . resourceToProperties ( PropertyFileSnitch . RACK_PROPERTY_FILENAME ) ; <START_BUG> invalidateCachedSnitchValues ( ) ; <END_BUG> } public static Properties resourceToProperties ( String filename ) throws ConfigurationException { } }

Fix:
clearEndpointCache ( ) ;
Buggy code:
public abstract class ChildAndParentNode extends ChildNode { static final long serialVersionUID = 0 ; protected DocumentImpl ownerDocument ; protected ChildNode firstChild = null ; protected int changes = 0 ; protected transient int nodeListLength = - 1 ; protected transient ChildNode nodeListNode ; protected transient int nodeListIndex = - 1 ; protected ChildAndParentNode ( DocumentImpl ownerDocument ) { } public ChildAndParentNode ( ) { } public Node cloneNode ( boolean deep ) { } public Document getOwnerDocument ( ) { } DocumentImpl ownerDocument ( ) { } void setOwnerDocument ( DocumentImpl doc ) { } public boolean hasChildNodes ( ) { } public NodeList getChildNodes ( ) { } public Node getFirstChild ( ) { } public Node getLastChild ( ) { } final ChildNode lastChild ( ) { } final void lastChild ( ChildNode node ) { } public Node insertBefore ( Node newChild , Node refChild ) throws DOMException { } Node internalInsertBefore ( Node newChild , Node refChild , int mutationMask ) throws DOMException { } public Node removeChild ( Node oldChild ) throws DOMException { } Node internalRemoveChild ( Node oldChild , int mutationMask ) throws DOMException { } public Node replaceChild ( Node newChild , Node oldChild ) throws DOMException { } public int getLength ( ) { } public Node item ( int index ) { } public void normalize ( ) { } public void setReadOnly ( boolean readOnly , boolean deep ) { } protected void changed ( ) { } protected int changes ( ) { } protected void synchronizeChildren ( ) { } protected final void synchronizeChildren ( int nodeIndex ) { } private void writeObject ( ObjectOutputStream out ) throws IOException { <START_BUG> if ( syncChildren ( ) ) { <END_BUG> synchronizeChildren ( ) ; } out . defaultWriteObject ( ) ; } private void readObject ( ObjectInputStream ois ) throws IOException , ClassNotFoundException { } }

Fix:
if ( ( syncChildren ( ) ) == false ) {
Buggy code:
public class PageAlgorithms extends WizardPage implements Listener { public static final String PAGE_NAME = "EncryptPageAlgorithms" ; private Combo cEncryptionAlgorithm = null ; private Combo cKeyWrapAlgorithm = null ; private Text tID = null ; private Button bSigWiz = null ; private Button bContentOnly = null ; private boolean bsp ; private IFile file ; private String [ ] ids ; private Encryption encryption = null ; public PageAlgorithms ( final Encryption encryption , final IFile file ) { } public void createControl ( final Composite parent ) { } private void createPageContent ( final Composite parent ) { } private void addListeners ( ) { } private void updateStatus ( final String message , final int status ) { } private void dialogChanged ( ) { } public void handleEvent ( final Event e ) { } private void determineIds ( ) { try { <START_BUG> ids = Utils . getAllIds ( file ) ; <END_BUG> } catch ( Exception ex ) { ids = new String [ ] { } ; } } public boolean isPageComplete ( ) { } public boolean performFinish ( ) { } private boolean saveDataToModel ( ) { } public void onEnterPage ( ) { } private void loadSettings ( ) { } private void storeSettings ( ) { } }

Fix:
ids = Utils . getAllIds ( file . getContents ( ) ) ;
Buggy code:
public class JmlrAddr extends ControlSequence { public JmlrAddr ( ) { } public JmlrAddr ( String name ) { } public Object clone ( ) { <START_BUG> return new JmlrAddr ( getAddr ( ) ) ; <END_BUG> } public void process ( TeXParser parser , TeXObjectList stack ) throws IOException { } public void process ( TeXParser parser ) throws IOException { } }

Fix:
return new JmlrAddr ( getName ( ) ) ;
Buggy code:
@ Repository public class TeamDAOImpl implements TeamDAO { private static final Logger logger = LoggerFactory . getLogger ( TeamDAOImpl . class ) ; private SessionFactory sessionFactory ; private DAOHelper daoHelper = new DAOHelper ( ) ; public void setSessionFactory ( SessionFactory sessionFactory ) { } @ Override public void create ( Team team ) { } @ Override public Team getByID ( long id ) { } @ Override public void update ( Team team ) { } @ Override public void delete ( long id ) { } @ SuppressWarnings ( "unchecked" ) public List < Team > list ( Long companyID ) { } @ Override public void assignProjectTeam ( TeamAssignment assignment ) { } @ Override public void unassignProjectTeam ( long projectID , long teamID ) { } @ Override public void unassignAllProjectTeams ( long projectID ) { } @ Override public Team getWithAllCollectionsByID ( long id ) { } @ Override public void unassignAllMembers ( long teamID ) { } @ Override public void unassignAllTeamsFromProject ( long teamID ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Team > listWithTasks ( Long companyID ) { } @ Override public String getNameByID ( long teamID ) { } @ SuppressWarnings ( "unchecked" ) @ Override <START_BUG> @ Cacheable ( value = "searchTeamCache" , key = "#root.targetClass" ) <END_BUG> public List < Team > listFromCache ( Long companyID ) { Session session = this . sessionFactory . getCurrentSession ( ) ; List < Team > list = this . daoHelper . getSelectQueryFilterCompany ( session , Team . class . getName ( ) , companyID ) . list ( ) ; return list ; } }

Fix:
@ Cacheable ( value = "searchTeamCache" , key = "#root.methodName" )
Buggy code:
final class CollectionToArrayConverter implements ConditionalGenericConverter { private final ConversionService conversionService ; public CollectionToArrayConverter ( ConversionService conversionService ) { } public Set < ConvertiblePair > getConvertibleTypes ( ) { } public boolean matches ( TypeDescriptor sourceType , TypeDescriptor targetType ) { } public Object convert ( Object source , TypeDescriptor sourceType , TypeDescriptor targetType ) { if ( source == null ) { return null ; } Collection < ? > sourceCollection = ( ( Collection < ? > ) ( source ) ) ; Object array = Array . newInstance ( targetType . getElementType ( ) , sourceCollection . size ( ) ) ; int i = 0 ; for ( Object sourceElement : sourceCollection ) { <START_BUG> Object targetElement = this . conversionService . convert ( sourceElement , sourceType . getElementTypeDescriptor ( ) . applyIndexedObject ( sourceElement ) , targetType . getElementTypeDescriptor ( ) ) ; <END_BUG> Array . set ( array , ( i ++ ) , targetElement ) ; } return array ; } }

Fix:
Object targetElement = this . conversionService . convert ( sourceElement , sourceType . getElementTypeDescriptor ( ) , targetType . getElementTypeDescriptor ( ) ) ;
Buggy code:
public class Snippet188 { public static void main ( String [ ] args ) { Display display = new Display ( ) ; Shell shell = new Shell ( display ) ; shell . setLayout ( new GridLayout ( ) ) ; final ScrolledComposite sc = new ScrolledComposite ( shell , ( ( ( SWT . BORDER ) | ( SWT . H_SCROLL ) ) | ( SWT . V_SCROLL ) ) ) ; sc . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , true , true , 1 , 1 ) ) ; Composite c = new Composite ( sc , SWT . NONE ) ; c . setLayout ( new GridLayout ( 10 , true ) ) ; for ( int i = 0 ; i < 300 ; i ++ ) { Button b = new Button ( c , SWT . PUSH ) ; b . setText ( ( "Button<seq2seq4repair_space>" + i ) ) ; } sc . setContent ( c ) ; sc . setExpandHorizontal ( true ) ; sc . setExpandVertical ( true ) ; <START_BUG> sc . setMinSize ( c . computeSize ( DEFAULT , DEFAULT ) ) ; <END_BUG> sc . setShowFocusedControl ( true ) ; shell . setSize ( 300 , 500 ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; } display . dispose ( ) ; } }

Fix:
sc . setMinSize ( DEFAULT , DEFAULT ) ;
Buggy code:
public class IdfTf { private double inverseDocumentFrequency ; private double termFrequency ; private int totalDocumentCount = 8000 ; public IdfTf ( ) { } private IdfTf ( double inverseDocumentFrequency , double termFrequency ) { } public void setDocumentCount ( int count ) { } public void setTermCount ( int count ) { } public double getInverseDocumentFrequency ( ) { } public double getTermFrequency ( ) { } public double getIdfTf ( ) { <START_BUG> return ( inverseDocumentFrequency ) * ( termFrequency ) ; <END_BUG> } public static IdfTf sum ( IdfTf val1 , IdfTf val2 ) { } @ Override public String toString ( ) { } }

Fix:
return ( inverseDocumentFrequency ) + ( termFrequency ) ;
Buggy code:
public final class DomainServerMain { private DomainServerMain ( ) { } public static void main ( String [ ] args ) { } public static final class HostControllerCommunicationActivator implements Serializable , ServiceActivator { private static final long serialVersionUID = 6671220116719309952L ; private final String serverName ; private final InetSocketAddress managementSocket ; public HostControllerCommunicationActivator ( final String serverName , final InetSocketAddress managementSocket ) { } public void activate ( final ServiceActivatorContext serviceActivatorContext ) { final ServiceTarget serviceTarget = serviceActivatorContext . getServiceTarget ( ) ; final HostControllerConnectionService smConnection = new HostControllerConnectionService ( ) ; serviceTarget . addService ( SERVICE_NAME , smConnection ) . addInjection ( smConnection . getSmAddressInjector ( ) , managementSocket ) . setInitialMode ( ACTIVE ) . install ( ) ; final NewHostControllerServerClient client = new NewHostControllerServerClient ( serverName ) ; <START_BUG> serviceTarget . addService ( HostControllerClient . SERVICE_NAME , client ) . addDependency ( SERVICE_NAME , Connection . class , client . getSmConnectionInjector ( ) ) . addDependency ( JBOSS_SERVER_CONTROLLER , NewServerController . class , client . getServerControllerInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ; <END_BUG> } } }

Fix:
serviceTarget . addService ( HostControllerClient . SERVICE_NAME , client ) . addDependency ( SERVICE_NAME , Connection . class , client . getSmConnectionInjector ( ) ) . addDependency ( JBOSS_SERVER_CONTROLLER , ServerController . class , client . getServerControllerInjector ( ) ) . setInitialMode ( ACTIVE ) . install ( ) ;
Buggy code:
public class TestNGramPhraseQuery extends LuceneTestCase { private static IndexReader reader ; private static Directory directory ; @ BeforeClass public static void beforeClass ( ) throws Exception { TestNGramPhraseQuery . directory = newDirectory ( ) ; RandomIndexWriter writer = new RandomIndexWriter ( random ( ) , TestNGramPhraseQuery . directory ) ; <START_BUG> writer . close ( ) ; <END_BUG> TestNGramPhraseQuery . reader = DirectoryReader . open ( TestNGramPhraseQuery . directory ) ; } @ AfterClass public static void afterClass ( ) throws Exception { } public void testRewrite ( ) throws Exception { } }

Fix:
writer . shutdown ( ) ;