nus-yam/ex-repair huggingface dataset:
Buggy code:
public class ConnectionDefinitionAdd extends AbstractAddStepHandler { public static final ConnectionDefinitionAdd INSTANCE = new ConnectionDefinitionAdd ( ) ; @ Override protected void populateModel ( ModelNode operation , ModelNode modelNode ) throws OperationFailedException { } @ Override protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode recoveryEnvModel , ServiceVerificationHandler verificationHandler , List < ServiceController < ? > > serviceControllers ) throws OperationFailedException { final ModelNode address = operation . require ( OP_ADDR ) ; PathAddress path = PathAddress . pathAddress ( address ) ; final String archiveName = path . getElement ( ( ( path . size ( ) ) - 2 ) ) . getValue ( ) ; final String poolName = PathAddress . pathAddress ( address ) . getLastElement ( ) . getValue ( ) ; try { ServiceName serviceName = ServiceName . of ( RA_SERVICE , archiveName , poolName ) ; ServiceName raServiceName = ServiceName . of ( RA_SERVICE , archiveName ) ; final ModifiableResourceAdapter ravalue = ( ( ModifiableResourceAdapter ) ( context . getServiceRegistry ( false ) . getService ( raServiceName ) . getValue ( ) ) ) ; boolean isXa = ( ravalue . getTransactionSupport ( ) ) == ( TransactionSupportEnum . XATransaction ) ; <START_BUG> final ModifiableConnDef connectionDefinitionValue = RaOperationUtil . buildConnectionDefinitionObject ( context , operation , poolName , isXa ) ; <END_BUG> final ServiceTarget serviceTarget = context . getServiceTarget ( ) ; final ConnectionDefinitionService service = new ConnectionDefinitionService ( connectionDefinitionValue ) ; ServiceController < ? > controller = serviceTarget . addService ( serviceName , service ) . setInitialMode ( ACTIVE ) . addDependency ( raServiceName , ModifiableResourceAdapter . class , service . getRaInjector ( ) ) . addListener ( verificationHandler ) . install ( ) ; serviceControllers . add ( controller ) ; } catch ( ValidateException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( MESSAGES . failedToCreate ( "ConnectionDefinition" , operation , e . getLocalizedMessage ( ) ) ) ) ; } } }

Fix:
final ModifiableConnDef connectionDefinitionValue = RaOperationUtil . buildConnectionDefinitionObject ( context , recoveryEnvModel , poolName , isXa ) ;
Buggy code:
public class PerTypeWithin extends PerClause { private TypePattern typePattern ; private static final Set kindSet = new HashSet ( Shadow . ALL_SHADOW_KINDS ) ; public TypePattern getTypePattern ( ) { } public PerTypeWithin ( TypePattern p ) { } public Object accept ( PatternNodeVisitor visitor , Object data ) { } public Set couldMatchKinds ( ) { } public Pointcut parameterizeWith ( Map typeVariableMap ) { } public FuzzyBoolean fastMatch ( FastMatchInfo info ) { } protected FuzzyBoolean matchInternal ( Shadow shadow ) { ResolvedType enclosingType = shadow . getIWorld ( ) . resolve ( shadow . getEnclosingType ( ) , true ) ; <START_BUG> if ( enclosingType == ( ResolvedType . MISSING ) ) { <END_BUG> IMessage msg = new org . aspectj . bridge . Message ( "Cant<seq2seq4repair_space>find<seq2seq4repair_space>type<seq2seq4repair_space>pertypewithin<seq2seq4repair_space>matching..." , shadow . getSourceLocation ( ) , true , new ISourceLocation [ ] { getSourceLocation ( ) } ) ; shadow . getIWorld ( ) . getMessageHandler ( ) . handleMessage ( msg ) ; } if ( enclosingType . isInterface ( ) ) return FuzzyBoolean . NO ; typePattern . resolve ( shadow . getIWorld ( ) ) ; return isWithinType ( enclosingType ) ; } public void resolveBindings ( IScope scope , Bindings bindings ) { } protected Test findResidueInternal ( Shadow shadow , ExposedState state ) { } public PerClause concretize ( ResolvedType inAspect ) { } public void write ( DataOutputStream s ) throws IOException { } public static PerClause readPerClause ( VersionedDataInputStream s , ISourceContext context ) throws IOException { } public Kind getKind ( ) { } public String toString ( ) { } public String toDeclarationString ( ) { } private FuzzyBoolean isWithinType ( ResolvedType type ) { } }

Fix:
if ( enclosingType . isMissing ( ) ) {
Buggy code:
public class BooksActivity extends AdapterActivity implements OnBookSelectedListener { public static final String TAG = "BooksActivity" ; private static final String BOOKS_SEARCH_FRAGMENT_INSTANCE = "books_search_fragment_key" ; private static final String ADAPTER_VALUES = "key_adapter" ; private static final String BOOKS_SEARCH_TAG = "bookSearch" ; private static final String BOOK_DETAILS_TAG = "bookDetail" ; private MyApplication application ; private SearchFragment searchFragment ; private BooksAdapter adapter ; private Entity book ; ArrayList < Entity > adapterValues = new ArrayList < Entity > ( ) ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onResume ( ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } public void initializeFragmentUI ( String text , ProgressDialog dialog ) { } @ Override public void handleResult ( ArrayList < Entity > result , String tag ) { if ( tag == ( BooksActivity . BOOKS_SEARCH_TAG ) ) { adapter . addAll ( result ) ; searchFragment = ( ( SearchFragment ) ( getFragmentManager ( ) . findFragmentByTag ( SearchFragment . TAG ) ) ) ; <START_BUG> searchFragment . displayResults ( result , tag ) ; <END_BUG> } if ( tag == ( BooksActivity . BOOK_DETAILS_TAG ) ) { this . book = result . get ( 0 ) ; Log . i ( BooksActivity . TAG , ( "BookId<seq2seq4repair_space>=<seq2seq4repair_space>" + ( book . get ( "id" ) ) ) ) ; BooksDetailsFragment booksDetailsFragment = new BooksDetailsFragment ( book ) ; FragmentTransaction transaction = getFragmentManager ( ) . beginTransaction ( ) ; transaction . replace ( books_fragment_container , booksDetailsFragment , BooksDetailsFragment . TAG ) ; transaction . addToBackStack ( null ) ; transaction . commit ( ) ; } } @ Override public void onBookSelected ( String bookId , ProgressDialog dialog ) { } @ Override public BooksAdapter getAdapter ( ) { } private void searchBooks ( int campusId , String text , ProgressDialog dialog ) { } private void getBook ( int bookId , ProgressDialog dialog ) { } private void getBookList ( int campusId , ProgressDialog dialog ) { } }

Fix:
searchFragment . displayResults ( tag ) ;
Buggy code:
public class OutboundTcpConnection extends Thread { private static final Logger logger = LoggerFactory . getLogger ( OutboundTcpConnection . class ) ; private static final ByteBuffer CLOSE_SENTINEL = ByteBuffer . allocate ( 0 ) ; private static final int OPEN_RETRY_DELAY = 100 ; private final InetAddress endpoint ; private final BlockingQueue < ByteBuffer > queue = new LinkedBlockingQueue < ByteBuffer > ( ) ; private DataOutputStream output ; private Socket socket ; private long completedCount ; public OutboundTcpConnection ( InetAddress remoteEp ) { } public void write ( ByteBuffer buffer ) { } void closeSocket ( ) { } public void run ( ) { } public int getPendingMessages ( ) { } public long getCompletedMesssages ( ) { } private void writeConnected ( ByteBuffer bb ) { try { <START_BUG> output . write ( bb . array ( ) , 0 , bb . limit ( ) ) ; <END_BUG> if ( ( queue . peek ( ) ) == null ) { output . flush ( ) ; } } catch ( IOException e ) { OutboundTcpConnection . logger . info ( ( "error<seq2seq4repair_space>writing<seq2seq4repair_space>to<seq2seq4repair_space>" + ( endpoint ) ) ) ; disconnect ( ) ; } } private void disconnect ( ) { } private ByteBuffer take ( ) { } private boolean connect ( ) { } }

Fix:
output . write ( bb . array ( ) , ( ( bb . position ( ) ) + ( bb . arrayOffset ( ) ) ) , ( ( bb . limit ( ) ) + ( bb . arrayOffset ( ) ) ) ) ;
Buggy code:
class JPASubSystemAdd extends AbstractBoottimeAddStepHandler implements DescriptionProvider { static ModelNode getAddOperation ( ModelNode address , ModelNode currentModel ) { } static final String OPERATION_NAME = ADD ; private ParametersValidator modelValidator = new ParametersValidator ( ) ; private ParametersValidator runtimeValidator = new ParametersValidator ( ) ; private final PersistenceUnitRegistryImpl persistenceUnitRegistry ; public JPASubSystemAdd ( final PersistenceUnitRegistryImpl persistenceUnitRegistry ) { } protected void populateModel ( ModelNode operation , ModelNode model ) throws OperationFailedException { } protected void performBoottime ( OperationContext context , ModelNode operation , ModelNode model , ServiceVerificationHandler verificationHandler , List < ServiceController < ? > > newControllers ) throws OperationFailedException { runtimeValidator . validate ( operation . resolve ( ) ) ; final boolean appclient = ( model . hasDefined ( APPCLIENT ) ) && ( model . get ( APPCLIENT ) . asBoolean ( ) ) ; context . addStep ( new AbstractDeploymentChainStep ( ) { protected void execute ( DeploymentProcessorTarget processorTarget ) { PersistenceProviderResolverHolder . setPersistenceProviderResolver ( PersistenceProviderResolverImpl . getInstance ( ) ) ; processorTarget . addDeploymentProcessor ( PARSE , PARSE_PERSISTENCE_UNIT , new PersistenceUnitParseProcessor ( ) ) ; processorTarget . addDeploymentProcessor ( PARSE , PARSE_PERSISTENCE_ANNOTATION , new JPAAnnotationParseProcessor ( ) ) ; processorTarget . addDeploymentProcessor ( DEPENDENCIES , DEPENDENCIES_JPA , new JPADependencyProcessor ( ) ) ; processorTarget . addDeploymentProcessor ( POST_MODULE , POST_MODULE_PERSISTENCE_REF , new PersistenceRefProcessor ( ) ) ; processorTarget . addDeploymentProcessor ( INSTALL , INSTALL_JPA_INTERCEPTORS , new JPAInterceptorProcessor ( ) ) ; processorTarget . addDeploymentProcessor ( INSTALL , INSTALL_PERSISTENCE_PROVIDER , new PersistenceProviderProcessor ( ) ) ; <START_BUG> processorTarget . addDeploymentProcessor ( INSTALL , INSTALL_PERSISTENTUNIT , new org . jboss . as . jpa . processor . PersistenceUnitDeploymentProcessor ( persistenceUnitRegistry , appclient ) ) ; <END_BUG> } } , RUNTIME ) ; final ModelNode defaultDSNode = operation . require ( DEFAULT_DATASOURCE ) ; final String dataSourceName = defaultDSNode . resolve ( ) . asString ( ) ; final ServiceTarget target = context . getServiceTarget ( ) ; newControllers . add ( JPAService . addService ( target , dataSourceName , verificationHandler ) ) ; } @ Override public ModelNode getModelDescription ( Locale locale ) { } }

Fix:
processorTarget . addDeploymentProcessor ( INSTALL , INSTALL_PERSISTENTUNIT , new org . jboss . as . jpa . processor . PersistenceUnitDeploymentProcessor ( persistenceUnitRegistry ) ) ;
Buggy code:
public class DebugBar extends DevUtilsPanel { private static final MetaDataKey < List < IDebugBarContributor > > CONTRIBS_META_KEY = new MetaDataKey < List < IDebugBarContributor > > ( ) { private static final long serialVersionUID = 1L ; } ; private static final long serialVersionUID = 1L ; public DebugBar ( String id ) { } @ Override public boolean isVisible ( ) { } @ Override public void renderHead ( IHeaderResponse response ) { response . renderCSSReference ( new CompressedResourceReference ( DebugBar . class , "wicket-debugbar.css" ) ) ; <START_BUG> response . renderJavascriptReference ( new JavaScriptResourceReference ( DebugBar . class , "wicket-debugbar.js" ) ) ; <END_BUG> } public static void registerContributor ( IDebugBarContributor contrib ) { } public static void registerContributor ( IDebugBarContributor contrib , Application application ) { } private static List < IDebugBarContributor > getContributors ( ) { } private static List < IDebugBarContributor > getContributors ( Application application ) { } static void registerStandardContributors ( Application application ) { } }

Fix:
response . renderJavaScriptReference ( new JavaScriptResourceReference ( DebugBar . class , "wicket-debugbar.js" ) ) ;
Buggy code:
public class TestArbitraryIndexDir extends AbstractSolrTestCase { static String savedFactory ; @ BeforeClass public static void beforeClass ( ) { } @ AfterClass public static void afterClass ( ) { } @ Override public void setUp ( ) throws Exception { } @ Override public void tearDown ( ) throws Exception { } @ Test public void testLoadNewIndexDir ( ) throws IOException , ParserConfigurationException , SAXException { assertU ( adoc ( "id" , String . valueOf ( 1 ) , "name" , ( "name" + ( String . valueOf ( 1 ) ) ) ) ) ; File idxprops = new File ( ( ( h . getCore ( ) . getDataDir ( ) ) + ( SnapPuller . INDEX_PROPERTIES ) ) ) ; Properties p = new Properties ( ) ; File newDir = new File ( ( ( h . getCore ( ) . getDataDir ( ) ) + "index_temp" ) ) ; newDir . mkdirs ( ) ; p . put ( "index" , newDir . getName ( ) ) ; Writer os = null ; try { os = new OutputStreamWriter ( new FileOutputStream ( idxprops ) , StandardCharsets . UTF_8 ) ; p . store ( os , "index<seq2seq4repair_space>properties" ) ; } catch ( Exception e ) { throw new org . apache . solr . common . SolrException ( ErrorCode . SERVER_ERROR , ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>write<seq2seq4repair_space>" + ( SnapPuller . INDEX_PROPERTIES ) ) , e ) ; } finally { IOUtils . closeWhileHandlingException ( os ) ; } Directory dir = newFSDirectory ( newDir ) ; IndexWriter iw = new IndexWriter ( dir , new org . apache . lucene . index . IndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . standard . StandardAnalyzer ( TEST_VERSION_CURRENT ) ) ) ; Document doc = new Document ( ) ; doc . add ( new org . apache . lucene . document . TextField ( "id" , "2" , Store . YES ) ) ; doc . add ( new org . apache . lucene . document . TextField ( "name" , "name2" , Store . YES ) ) ; iw . addDocument ( doc ) ; iw . commit ( ) ; <START_BUG> iw . close ( ) ; <END_BUG> assertU ( commit ( ) ) ; assertQ ( "return<seq2seq4repair_space>doc<seq2seq4repair_space>with<seq2seq4repair_space>id<seq2seq4repair_space>2" , req ( "id:2" ) , "*[count(////doc)=1]" ) ; dir . close ( ) ; newDir . delete ( ) ; } }

Fix:
iw . shutdown ( ) ;
Buggy code:
public class CommandHandler implements ClientBinaryHandler , ClientEventHandler { private static final Logger logger = Logger . getLogger ( CommandHandler . class . getName ( ) ) ; private InterfaceServer interfaceServer ; private boolean downtimeStarted ; private long downtimeStartTime ; @ Override public void gotConnected ( ClientHandler handler ) throws IOException , SocketTimeoutException { CommandHandler . logger . log ( Level . FINE , "Connection<seq2seq4repair_space>opened:<seq2seq4repair_space>{0}" , handler . getHostAddress ( ) ) ; if ( ( interfaceServer ) == null ) { QuickServer server = handler . getServer ( ) ; Object [ ] storeObj = server . getStoreObjects ( ) ; interfaceServer = ( ( InterfaceServer ) ( storeObj [ 1 ] ) ) ; } interfaceServer . getStats ( ) . getClientCount ( ) . incrementAndGet ( ) ; ClientInfo ci = new ClientInfo ( ) ; ci . setInetAddress ( handler . getSocket ( ) . getInetAddress ( ) ) ; ci . setClientKey ( handler . getHostAddress ( ) ) ; LoadDistributor lb = interfaceServer . getInterfaceHosts ( ) . getLoadDistributor ( ) ; SocketBasedHost host = ( ( SocketBasedHost ) ( lb . getHost ( ci ) ) ) ; if ( host == null ) { if ( ( downtimeStarted ) == false ) { downtimeStarted = true ; downtimeStartTime = System . currentTimeMillis ( ) ; } CommandHandler . logger . warning ( "We<seq2seq4repair_space>do<seq2seq4repair_space>not<seq2seq4repair_space>have<seq2seq4repair_space>any<seq2seq4repair_space>host<seq2seq4repair_space>to<seq2seq4repair_space>send<seq2seq4repair_space>traffic<seq2seq4repair_space>to..<seq2seq4repair_space>so<seq2seq4repair_space>closing<seq2seq4repair_space>it<seq2seq4repair_space>down" ) ; handler . closeConnection ( ) ; interfaceServer . getStats ( ) . getDroppedCount ( ) . incrementAndGet ( ) ; return ; } if ( downtimeStarted ) { downtimeStarted = false ; long diff = ( System . currentTimeMillis ( ) ) - ( downtimeStartTime ) ; interfaceServer . getStats ( ) . addDownTime ( diff ) ; } CommandHandler . logger . log ( Level . FINEST , "SocketBasedHost:<seq2seq4repair_space>{0}" , host ) ; Data data = ( ( Data ) ( handler . getClientData ( ) ) ) ; <START_BUG> data . setRemoteHost ( host . getInetSocketAddress ( ) . getAddress ( ) . getHostAddress ( ) ) ; <END_BUG> data . setRemotePort ( host . getInetSocketAddress ( ) . getPort ( ) ) ; data . setInterfaceServer ( interfaceServer ) ; data . init ( new Socket ( data . getRemoteHost ( ) , data . getRemotePort ( ) ) , handler ) ; } @ Override public void lostConnection ( ClientHandler handler ) throws IOException { } @ Override public void closingConnection ( ClientHandler handler ) throws IOException { } @ Override public void handleBinary ( ClientHandler handler , byte [ ] command ) throws IOException , SocketTimeoutException { } }

Fix:
data . setRemoteHost ( host . getInetAddress ( ) . getHostAddress ( ) ) ;
Buggy code:
public class DynamicEndpointSnitchTest { @ Test public void testSnitch ( ) throws IOException , InterruptedException , ConfigurationException { <START_BUG> instance . initClient ( ) ; <END_BUG> int sleeptime = 150 ; DynamicEndpointSnitch dsnitch = new DynamicEndpointSnitch ( new SimpleSnitch ( ) ) ; InetAddress self = FBUtilities . getBroadcastAddress ( ) ; ArrayList < InetAddress > order = new ArrayList < InetAddress > ( ) ; InetAddress host1 = InetAddress . getByName ( "127.0.0.1" ) ; InetAddress host2 = InetAddress . getByName ( "127.0.0.2" ) ; InetAddress host3 = InetAddress . getByName ( "127.0.0.3" ) ; for ( int i = 0 ; i < 5 ; i ++ ) { dsnitch . receiveTiming ( host1 , 1.0 ) ; dsnitch . receiveTiming ( host2 , 1.0 ) ; dsnitch . receiveTiming ( host3 , 1.0 ) ; } Thread . sleep ( sleeptime ) ; order . add ( host1 ) ; order . add ( host2 ) ; order . add ( host3 ) ; assert dsnitch . getSortedListByProximity ( self , order ) . equals ( order ) ; dsnitch . receiveTiming ( host1 , 2.0 ) ; Thread . sleep ( sleeptime ) ; order . clear ( ) ; order . add ( host2 ) ; order . add ( host3 ) ; order . add ( host1 ) ; assert dsnitch . getSortedListByProximity ( self , order ) . equals ( order ) ; dsnitch . receiveTiming ( host2 , 2.0 ) ; Thread . sleep ( sleeptime ) ; order . clear ( ) ; order . add ( host3 ) ; order . add ( host1 ) ; order . add ( host2 ) ; assert dsnitch . getSortedListByProximity ( self , order ) . equals ( order ) ; for ( int i = 0 ; i < 2 ; i ++ ) { dsnitch . receiveTiming ( host3 , 2.0 ) ; } Thread . sleep ( sleeptime ) ; order . clear ( ) ; order . add ( host1 ) ; order . add ( host2 ) ; order . add ( host3 ) ; assert dsnitch . getSortedListByProximity ( self , order ) . equals ( order ) ; for ( int i = 0 ; i < 2 ; i ++ ) { dsnitch . receiveTiming ( host3 , 1.0 ) ; } Thread . sleep ( sleeptime ) ; order . clear ( ) ; order . add ( host1 ) ; order . add ( host2 ) ; order . add ( host3 ) ; assert dsnitch . getSortedListByProximity ( self , order ) . equals ( order ) ; } }

Fix:
instance . initClient ( 0 ) ;
Buggy code:
class MacCommandLauncher extends CommandLauncherProxy { MacCommandLauncher ( CommandLauncher launcher ) { } public Process exec ( Project project , String [ ] cmd , String [ ] env , File workingDir ) throws IOException , TaskException { if ( workingDir == null ) { return exec ( project , cmd , env ) ; } System . getProperties ( ) . put ( "user.dir" , workingDir . getAbsolutePath ( ) ) ; try { return exec ( project , cmd , env ) ; } finally { <START_BUG> System . getProperties ( ) . put ( "user.dir" , antWorkingDirectory ) ; <END_BUG> } } }

Fix:
System . getProperties ( ) . put ( "user.dir" , c_antWorkingDirectory ) ;
Buggy code:
public class TestPerSegmentDeletes extends LuceneTestCase { public void testDeletes1 ( ) throws Exception { } void part2 ( IndexWriter writer , TestPerSegmentDeletes . RangeMergePolicy fsmp ) throws Exception { } boolean segThere ( SegmentInfoPerCommit info , SegmentInfos infos ) { } public static void printDelDocs ( Bits bits ) { } public int [ ] toDocsArray ( Term term , Bits bits , IndexReader reader ) throws IOException { Fields fields = MultiFields . getFields ( reader ) ; Terms cterms = fields . terms ( term . field ) ; TermsEnum ctermsEnum = cterms . iterator ( null ) ; if ( ctermsEnum . seekExact ( new org . apache . lucene . util . BytesRef ( term . text ( ) ) , false ) ) { <START_BUG> DocsEnum docsEnum = _TestUtil . docs ( random ( ) , ctermsEnum , bits , null , false ) ; <END_BUG> return TestPerSegmentDeletes . toArray ( docsEnum ) ; } return null ; } public static int [ ] toArray ( DocsEnum docsEnum ) throws IOException { } public class RangeMergePolicy extends MergePolicy { boolean doMerge = false ; int start ; int length ; private final boolean useCompoundFile ; private RangeMergePolicy ( boolean useCompoundFile ) { } @ Override public void close ( ) { } @ Override public MergeSpecification findMerges ( SegmentInfos segmentInfos ) throws IOException { } @ Override public MergeSpecification findForcedMerges ( SegmentInfos segmentInfos , int maxSegmentCount , Map < SegmentInfoPerCommit , Boolean > segmentsToMerge ) throws IOException { } @ Override public MergeSpecification findForcedDeletesMerges ( SegmentInfos segmentInfos ) throws IOException { } @ Override public boolean useCompoundFile ( SegmentInfos segments , SegmentInfoPerCommit newSegment ) { } } }

Fix:
DocsEnum docsEnum = _TestUtil . docs ( random ( ) , ctermsEnum , bits , null , 0 ) ;
Buggy code:
public class ScriptCondition extends AbstractScriptComponent implements Condition { private boolean value = false ; public boolean eval ( ) throws BuildException { initScriptRunner ( ) ; <START_BUG> Object result = executeScript ( "ant_condition" ) ; <END_BUG> return getValue ( ) ; } public boolean getValue ( ) { } public void setValue ( boolean value ) { } }

Fix:
executeScript ( "ant_condition" ) ;
Buggy code:
public abstract class ComplexFormatAbstractTest extends TestCase { ComplexFormat complexFormat = null ; ComplexFormat complexFormatJ = null ; protected abstract Locale getLocale ( ) { } protected abstract char getDecimalCharacter ( ) { } protected void setUp ( ) throws Exception { } public void testSimpleNoDecimals ( ) { } public void testSimpleWithDecimals ( ) { } public void testSimpleWithDecimalsTrunc ( ) { } public void testNegativeReal ( ) { } public void testNegativeImaginary ( ) { } public void testNegativeBoth ( ) { } public void testZeroReal ( ) { } public void testZeroImaginary ( ) { } public void testDifferentImaginaryChar ( ) { } public void testStaticFormatComplex ( ) { } public void testNan ( ) { } public void testPositiveInfinity ( ) { } public void testNegativeInfinity ( ) { } public void testParseSimpleNoDecimals ( ) { } public void testParseSimpleWithDecimals ( ) { } public void testParseSimpleWithDecimalsTrunc ( ) { } public void testParseNegativeReal ( ) { } public void testParseNegativeImaginary ( ) { } public void testParseNegativeBoth ( ) { } public void testParseZeroReal ( ) { } public void testParseZeroImaginary ( ) { } public void testParseDifferentImaginaryChar ( ) { } public void testParseNan ( ) { } public void testParsePositiveInfinity ( ) { } public void testPaseNegativeInfinity ( ) { } public void testConstructorSingleFormat ( ) { } public void testGetImaginaryFormat ( ) { } public void testSetImaginaryFormatNull ( ) { } public void testSetRealFormatNull ( ) { } public void testGetRealFormat ( ) { } public void testSetImaginaryCharacterNull ( ) { } public void testSetImaginaryCharacterEmpty ( ) { } public void testFormatNumber ( ) { ComplexFormat cf = ComplexFormat . getInstance ( getLocale ( ) ) ; <START_BUG> Double pi = new Double ( Math . PI ) ; <END_BUG> String text = cf . format ( pi ) ; assertEquals ( ( ( "3" + ( getDecimalCharacter ( ) ) ) + "14" ) , text ) ; } public void testFormatObject ( ) { } public void testForgottenImaginaryCharacter ( ) { } }

Fix:
Double pi = Double . valueOf ( Math . PI ) ;
Buggy code:
public class HelpCommand extends Command { static final String NOT_A_REDMINE_COMMAND_MESSAGE = "'%s'<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>redmine<seq2seq4repair_space>command.<seq2seq4repair_space>Call<seq2seq4repair_space>'help'<seq2seq4repair_space>to<seq2seq4repair_space>see<seq2seq4repair_space>available<seq2seq4repair_space>commands." ; private static final String NAME = "help" ; private static final String DESCRIPTION = "Display<seq2seq4repair_space>general<seq2seq4repair_space>help<seq2seq4repair_space>or<seq2seq4repair_space>(if<seq2seq4repair_space>provided)<seq2seq4repair_space>command<seq2seq4repair_space>help." ; private static final Argument [ ] ARGUMENTS = new Argument [ ] { new Argument ( "command" , "The<seq2seq4repair_space>command<seq2seq4repair_space>to<seq2seq4repair_space>show<seq2seq4repair_space>help." , true ) } ; private final Map < String , Command > commands ; public HelpCommand ( Configuration configuration , PrintStream out , Map < String , Command > commands ) { } @ Override public void process ( String [ ] arguments ) throws Exception { } private void printGeneralHelp ( ) { } private void printCommandHelp ( Command command ) { String arguments = createArgumentHelpString ( command ) ; println ( "Command\n¯¯¯¯¯¯¯" ) ; println ( command . getName ( ) ) ; println ( ) ; <START_BUG> println ( "Description\n¯¯¯¯¯¯¯¯¯¯" ) ; <END_BUG> println ( command . getDescription ( ) ) ; println ( command . getLongDescription ( ) ) ; println ( ) ; println ( "usage:<seq2seq4repair_space>redmine<seq2seq4repair_space>%s<seq2seq4repair_space>%s" , command . getName ( ) , arguments ) ; println ( ) ; printArgumentHelp ( command ) ; } private void printArgumentHelp ( Command command ) { } private void printCommandHelp ( String commandName ) { } private String createArgumentHelpString ( Command command ) { } }

Fix:
println ( "Description\n¯¯¯¯¯¯¯¯¯¯¯" ) ;
Buggy code:
public class SQLDatabase { public static final String DRIVER = "org.sqlite.JDBC" ; public static final int TIMEOUT = 5 ; public static final int ADD_USER = 0 ; public static final int REMOVE_USER = - 1 ; public static final int NONE = 0 ; public static final int VIEW = 1 ; public static final int EDIT = 2 ; public static final int OWNER = 3 ; private Connection connection ; public SQLDatabase ( String databaseName ) { } public ResultSet getProjects ( String username ) { } public boolean updateAccess ( int accessLevel , String projectId , String username ) { } public ResultSet getFiles ( String projectId ) throws DatabaseException { } public void newProject ( String name , String ownerId ) { } public void newFile ( String fileName , String projectId ) { } public ResultSet getUserNames ( String projectId ) { } public boolean authenticate ( String username , String password ) { } public boolean newSession ( String username , String serialNumber , String sessionId ) { } public boolean removeSession ( String sessionId ) { } public ResultSet getSessionInfo ( String sessionId ) { } public boolean addUser ( String username , String password ) { } ResultSet query ( String query ) throws SQLException { } void update ( String query ) throws SQLException { } public ResultSet getFile ( String uuid ) throws DatabaseException { } public void renameProject ( String uuid , String newName ) throws DatabaseException { try { <START_BUG> this . update ( ( ( ( ( "UPDATE<seq2seq4repair_space>projects<seq2seq4repair_space>SET<seq2seq4repair_space>PorjectName<seq2seq4repair_space>=<seq2seq4repair_space>" + newName ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>ProjectID<seq2seq4repair_space>=<seq2seq4repair_space>" ) + uuid ) + ";" ) ) ; <END_BUG> } catch ( SQLException e ) { e . printStackTrace ( ) ; } } public void deleteProject ( String projectId ) throws DatabaseException { } }

Fix:
this . update ( ( ( ( ( "UPDATE<seq2seq4repair_space>projects<seq2seq4repair_space>SET<seq2seq4repair_space>ProjectName<seq2seq4repair_space>=<seq2seq4repair_space>" + newName ) + "<seq2seq4repair_space>WHERE<seq2seq4repair_space>ProjectID<seq2seq4repair_space>=<seq2seq4repair_space>" ) + uuid ) + ";" ) ) ;
Buggy code:
public class SpamPanel extends DefaultPanel implements ActionListener { private JDialog dialog ; private AccountItem item ; private JCheckBox enableCheckBox ; private JCheckBox addressCheckBox ; private JCheckBox incomingCheckBox ; private JCheckBox markCheckBox ; private JRadioButton incomingTrashRadioButton ; private JRadioButton incomingMoveToRadioButton ; private JButton incomingChooseFolderButton ; private JRadioButton markTrashRadioButton ; private JRadioButton markMoveToRadioButton ; private JButton markChooseFolderButton ; private MultiLineLabel label ; private FrameMediator mediator ; public SpamPanel ( FrameMediator mediator , AccountItem item ) { } protected void initComponents ( ) { } protected void layoutComponents ( ) { <START_BUG> FormLayout layout = new FormLayout ( "10dlu,<seq2seq4repair_space>10dlu,<seq2seq4repair_space>max(100;default),<seq2seq4repair_space>3dlu,<seq2seq4repair_space>fill:max(150dlu;default):grow,<seq2seq4repair_space>3dlu,<seq2seq4repair_space>fill:max(150dlu;default):grow" , "" ) ; <END_BUG> DefaultFormBuilder builder = new DefaultFormBuilder ( this , layout ) ; builder . setLeadingColumnOffset ( 1 ) ; builder . setDefaultDialogBorder ( ) ; builder . setLeadingColumnOffset ( 1 ) ; builder . appendSeparator ( MailResourceLoader . getString ( "dialog" , "account" , "separator_adaptive_spam_filter" ) ) ; builder . append ( label , 4 ) ; builder . nextLine ( ) ; builder . append ( enableCheckBox , 4 ) ; builder . nextLine ( ) ; builder . appendSeparator ( MailResourceLoader . getString ( "dialog" , "account" , "separator_filter_options" ) ) ; builder . nextLine ( ) ; builder . append ( addressCheckBox , 4 ) ; builder . nextLine ( ) ; builder . append ( incomingCheckBox , 4 ) ; builder . nextLine ( ) ; builder . setLeadingColumnOffset ( 2 ) ; builder . append ( incomingTrashRadioButton , 3 ) ; builder . nextLine ( ) ; builder . append ( incomingMoveToRadioButton , 1 ) ; builder . append ( incomingChooseFolderButton , 2 ) ; builder . setLeadingColumnOffset ( 1 ) ; builder . append ( markCheckBox , 4 ) ; builder . nextLine ( ) ; builder . setLeadingColumnOffset ( 2 ) ; builder . append ( markTrashRadioButton , 3 ) ; builder . nextLine ( ) ; builder . append ( markMoveToRadioButton , 1 ) ; builder . append ( markChooseFolderButton , 2 ) ; } public void updateComponents ( boolean b ) { } public void actionPerformed ( ActionEvent arg0 ) { } private void enableComponents ( boolean enable ) { } private void enableIncoming ( boolean enable ) { } private void enableMark ( boolean enable ) { } }

Fix:
FormLayout layout = new FormLayout ( "10dlu,<seq2seq4repair_space>10dlu,<seq2seq4repair_space>max(100;default),<seq2seq4repair_space>3dlu,<seq2seq4repair_space>max(150dlu;default):grow,<seq2seq4repair_space>3dlu" , "" ) ;
Buggy code:
public class ClassLiteralAccess extends Expression { public TypeReference type ; public TypeBinding targetType ; FieldBinding syntheticField ; public ClassLiteralAccess ( int sourceEnd , TypeReference t ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream , boolean valueRequired ) { } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { constant = NotAConstant ; if ( ( targetType = type . resolveType ( scope , true ) ) == null ) return null ; if ( ( targetType . isArrayType ( ) ) && ( ( ( ( ArrayBinding ) ( targetType ) ) . leafComponentType ) == ( VoidBinding ) ) ) { scope . problemReporter ( ) . cannotAllocateVoidArray ( this ) ; return null ; } else if ( targetType . isTypeVariable ( ) ) { scope . problemReporter ( ) . illegalClassLiteralForTypeVariable ( ( ( TypeVariableBinding ) ( targetType ) ) , this ) ; } ReferenceBinding classType = scope . getJavaLangClass ( ) ; if ( classType . isGenericType ( ) ) { TypeBinding boxedType = null ; if ( ( targetType . id ) == ( TypeIds . T_void ) ) { boxedType = scope . environment ( ) . getType ( TypeConstants . JAVA_LANG_VOID ) ; if ( boxedType == null ) { <START_BUG> boxedType = new ProblemReferenceBinding ( TypeConstants . JAVA_LANG_VOID , ProblemReasons . NotFound ) ; <END_BUG> } } else { boxedType = scope . boxing ( targetType ) ; } this . resolvedType = scope . environment ( ) . createParameterizedType ( classType , new TypeBinding [ ] { boxedType } , null ) ; } else { this . resolvedType = classType ; } return this . resolvedType ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
boxedType = new ProblemReferenceBinding ( TypeConstants . JAVA_LANG_VOID , null , ProblemReasons . NotFound ) ;
Buggy code:
class NativeManagementServices { private static final int WINDOW_SIZE = Configuration . WINDOW_SIZE ; private static final OptionMap OPTIONS = OptionMap . create ( RECEIVE_WINDOW_SIZE , NativeManagementServices . WINDOW_SIZE ) ; static synchronized void installRemotingServicesIfNotInstalled ( final ServiceTarget serviceTarget , final String hostName , final ServiceVerificationHandler verificationHandler , final List < ServiceController < ? > > newControllers , final ServiceRegistry serviceContainer ) { if ( ( serviceContainer . getService ( MANAGEMENT_ENDPOINT ) ) == null ) { ManagementChannelRegistryService . addService ( serviceTarget , MANAGEMENT_ENDPOINT ) ; <START_BUG> ManagementRemotingServices . installRemotingEndpoint ( serviceTarget , MANAGEMENT_ENDPOINT , hostName , MANAGEMENT , NativeManagementServices . OPTIONS , verificationHandler , newControllers ) ; <END_BUG> ManagementRemotingServices . installManagementChannelServices ( serviceTarget , MANAGEMENT_ENDPOINT , new ModelControllerClientOperationHandlerFactoryService ( ) , JBOSS_SERVER_CONTROLLER , MANAGEMENT_CHANNEL , verificationHandler , newControllers ) ; } } }

Fix:
ManagementRemotingServices . installRemotingManagementEndpoint ( serviceTarget , MANAGEMENT_ENDPOINT , hostName , MANAGEMENT , NativeManagementServices . OPTIONS , verificationHandler , newControllers ) ;
Buggy code:
@ Component @ Transactional ( readOnly = true ) public class SynthesisService { private static Logger logger = LoggerFactory . getLogger ( SynthesisService . class ) ; @ Autowired private OrderRepository orderRepository ; @ Autowired private PrimerProductRepository primerProductRepository ; @ Autowired private PrimerProductValueRepository primerProductValueRepository ; @ Autowired private BoardRepository boardRepository ; @ Autowired private BoardHoleRepository boardHoleRepository ; @ Autowired private PrimerProductOperationRepository primerProductOperationRepository ; public Page < PrimerProduct > makeTableQuery ( String customer_code , String modiFlag , String tbn1 , String tbn2 , String purifytype , Pageable pageable ) { } public Board makeTable ( Board board ) { } public Board addNewHole ( Board board ) { } @ Transactional ( readOnly = false ) public String submitBoard ( Board board ) { PrimerProductOperation primerProductOperation = new PrimerProductOperation ( ) ; List < PrimerProductOperation > primerProductOperations = new ArrayList < PrimerProductOperation > ( ) ; board . setCreateUser ( 123 ) ; board . setCreateTime ( new Date ( ) ) ; List < BoardHole > boardHoles = board . getBoardHoles ( ) ; BoardHole boardHole = null ; for ( int i = ( boardHoles . size ( ) ) - 1 ; i >= 0 ; i -- ) { boardHole = ( ( BoardHole ) ( boardHoles . get ( i ) ) ) ; boardHole . setCreateUser ( 123L ) ; boardHole . setCreateTime ( new Date ( ) ) ; boardHole . setBoard ( board ) ; if ( ( ( boardHole . getPrimerProduct ( ) ) == null ) || ( ( boardHole . getPrimerProduct ( ) . getId ( ) ) == null ) ) { if ( ( boardHole . getId ( ) ) != null ) { boardHoleRepository . delete ( boardHole ) ; } boardHoles . remove ( i ) ; } else { primerProductOperation = new PrimerProductOperation ( ) ; primerProductOperation . setPrimerProduct ( boardHole . getPrimerProduct ( ) ) ; <START_BUG> primerProductOperation . setType ( makeTableSuccess ) ; <END_BUG> primerProductOperation . setTypeDesc ( "制表成功" ) ; primerProductOperation . setUserCode ( "123" ) ; primerProductOperation . setUserName ( "张三" ) ; primerProductOperation . setCreateTime ( new Date ( ) ) ; primerProductOperation . setBackTimes ( 0 ) ; primerProductOperation . setFailReason ( "成功了" ) ; primerProductOperations . add ( primerProductOperation ) ; PrimerProduct primerProduct = primerProductRepository . findOne ( boardHole . getPrimerProduct ( ) . getId ( ) ) ; if ( primerProduct != null ) { primerProduct . setBoardNo ( board . getBoardNo ( ) ) ; primerProduct . setOperationType ( synthesis ) ; primerProductRepository . save ( primerProduct ) ; } } } boardRepository . save ( board ) ; return "" ; } public List < Board > synthesisQuery ( String boardNo ) { } @ Transactional ( readOnly = false ) public String submitSynthesis ( Board board , String failReason ) { } public EntityReply < File > exportPimerProduct ( String boardNo , Invocation inv ) throws IOException { } }

Fix:
primerProductOperation . setType ( makeTable ) ;
Buggy code:
public class CheckboxWidget implements Widget { private Object initialValue ; private String value = "true" ; private String label ; public CheckboxWidget ( ) { } public CheckboxWidget ( String value ) { } public CheckboxWidget ( String label , String value ) { } public String getValue ( ) { } public void setValue ( String value ) { } public String getLabel ( ) { } public void setLabel ( String label ) { } @ Override public String generateHtml ( FormEntryContext context ) { } @ Override public Object getValue ( FormEntryContext context , HttpServletRequest request ) { } @ Override public void setInitialValue ( Object initialValue ) { <START_BUG> this . initialValue = value ; <END_BUG> } }

Fix:
this . initialValue = initialValue ;
Buggy code:
public class PropertiesTest { public static void main ( String [ ] args ) throws IOException { Properties dbprop = new Properties ( ) ; <START_BUG> InputStream inStream = PropertiesTest . class . getResourceAsStream ( "//webapp//resource//db.properties" ) ; <END_BUG> dbprop . load ( inStream ) ; String ClassName = dbprop . getProperty ( "oracle.ClassName" ) ; String url = dbprop . getProperty ( "oracle.url" ) ; String user = dbprop . getProperty ( "oracle.user" ) ; String password = dbprop . getProperty ( "oracle.password" ) ; System . out . println ( ( "classname<seq2seq4repair_space>=<seq2seq4repair_space>" + ClassName ) ) ; System . out . println ( ( "url<seq2seq4repair_space>=<seq2seq4repair_space>" + url ) ) ; System . out . println ( ( "user<seq2seq4repair_space>=<seq2seq4repair_space>" + user ) ) ; System . out . println ( ( "password<seq2seq4repair_space>=<seq2seq4repair_space>" + password ) ) ; } }

Fix:
InputStream inStream = PropertiesTest . class . getResourceAsStream ( "//webapp//spring//db.properties" ) ;
Buggy code:
@ Slf4j public class LocalImageServer implements ImageServer { private final String folderPath ; public LocalImageServer ( String folderPath ) { } @ Override public String write ( String fileName , MultipartFile file ) { try { <START_BUG> String path = ( ( folderPath ) + ( File . pathSeparator ) ) + fileName ; <END_BUG> File to = new File ( path ) ; Files . createParentDirs ( to ) ; Files . write ( file . getBytes ( ) , to ) ; return fileName ; } catch ( Exception e ) { log . error ( "fail<seq2seq4repair_space>to<seq2seq4repair_space>write<seq2seq4repair_space>file<seq2seq4repair_space>{},<seq2seq4repair_space>cause:{}" , fileName , Throwables . getStackTraceAsString ( e ) ) ; throw new ServiceException ( "file.upload.fail" ) ; } } @ Override public Boolean delete ( String fileName ) { } }

Fix:
String path = ( ( folderPath ) + ( File . separatorChar ) ) + fileName ;
Buggy code:
public class Xor implements Function { @ Override public Object call ( Properties bindings , Object [ ] args ) { <START_BUG> if ( ( ( ( ( ( args . length ) == 2 ) && ( ( args [ 0 ] ) != null ) ) && ( ( args [ 0 ] ) instanceof Boolean ) ) && ( ( args [ 1 ] ) != null ) ) && ( ( args [ 0 ] ) instanceof Boolean ) ) { <END_BUG> boolean o1 = ( ( Boolean ) ( args [ 0 ] ) ) . booleanValue ( ) ; boolean o2 = ( ( Boolean ) ( args [ 1 ] ) ) . booleanValue ( ) ; return o1 != o2 ; } return new com . google . refine . expr . EvalError ( ( ( ControlFunctionRegistry . getFunctionName ( this ) ) + "<seq2seq4repair_space>expects<seq2seq4repair_space>2<seq2seq4repair_space>booleans" ) ) ; } @ Override public void write ( JSONWriter writer , Properties options ) throws JSONException { } }

Fix:
if ( ( ( ( ( ( args . length ) == 2 ) && ( ( args [ 0 ] ) != null ) ) && ( ( args [ 0 ] ) instanceof Boolean ) ) && ( ( args [ 1 ] ) != null ) ) && ( ( args [ 1 ] ) instanceof Boolean ) ) {
Buggy code:
public class JavaEnvUtilsTest extends TestCase { private static final FileUtils FILE_UTILS = FileUtils . getFileUtils ( ) ; public JavaEnvUtilsTest ( String s ) { } public void testGetExecutableNetware ( ) { } public void testGetExecutableWindows ( ) { } public void testGetExecutableMostPlatforms ( ) { if ( ( ! ( Os . isName ( "netware" ) ) ) && ( ! ( Os . isFamily ( "windows" ) ) ) ) { String javaHome = JavaEnvUtilsTest . FILE_UTILS . normalize ( System . getProperty ( "java.home" ) ) . getAbsolutePath ( ) ; String extension = ( Os . isFamily ( "dos" ) ) ? ".exe" : "" ; String j = JavaEnvUtils . getJreExecutable ( "java" ) ; if ( ! ( extension . equals ( "" ) ) ) { assertTrue ( j . endsWith ( extension ) ) ; } assertTrue ( ( j + "<seq2seq4repair_space>is<seq2seq4repair_space>absolute" ) , new File ( j ) . isAbsolute ( ) ) ; assertTrue ( ( j + "<seq2seq4repair_space>is<seq2seq4repair_space>normalized<seq2seq4repair_space>and<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>JRE<seq2seq4repair_space>dir" ) , j . startsWith ( javaHome ) ) ; j = JavaEnvUtils . getJdkExecutable ( "javac" ) ; if ( ! ( extension . equals ( "" ) ) ) { assertTrue ( j . endsWith ( extension ) ) ; } assertTrue ( ( j + "<seq2seq4repair_space>is<seq2seq4repair_space>absolute" ) , new File ( j ) . isAbsolute ( ) ) ; String javaHomeParent = JavaEnvUtilsTest . FILE_UTILS . normalize ( ( javaHome + "//.." ) ) . getAbsolutePath ( ) ; assertTrue ( ( j + "<seq2seq4repair_space>is<seq2seq4repair_space>normalized<seq2seq4repair_space>and<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>JDK<seq2seq4repair_space>dir" ) , j . startsWith ( javaHomeParent ) ) ; <START_BUG> if ( Os . isFamily ( "mac" ) ) { <END_BUG> assertTrue ( ( j + "<seq2seq4repair_space>is<seq2seq4repair_space>normalized<seq2seq4repair_space>and<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>JRE<seq2seq4repair_space>dir" ) , j . startsWith ( javaHome ) ) ; } else { assertTrue ( ( j + "<seq2seq4repair_space>is<seq2seq4repair_space>normalized<seq2seq4repair_space>and<seq2seq4repair_space>not<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>JRE<seq2seq4repair_space>dir" ) , ( ! ( j . startsWith ( javaHome ) ) ) ) ; } assertEquals ( ( "foo" + extension ) , JavaEnvUtils . getJreExecutable ( "foo" ) ) ; assertEquals ( ( "foo" + extension ) , JavaEnvUtils . getJdkExecutable ( "foo" ) ) ; } } public void testIsAtLeastJavaVersion ( ) { } }

Fix:
if ( ( Os . isFamily ( "mac" ) ) && ( ( JavaEnvUtils . getJavaVersionNumber ( ) ) <= ( JavaEnvUtils . VERSION_1_6 ) ) ) {
Buggy code:
public class TestExpressionRescorer extends LuceneTestCase { IndexSearcher searcher ; DirectoryReader reader ; Directory dir ; @ Override public void setUp ( ) throws Exception { super . setUp ( ) ; dir = newDirectory ( ) ; RandomIndexWriter iw = new RandomIndexWriter ( random ( ) , dir ) ; Document doc = new Document ( ) ; doc . add ( newStringField ( "id" , "1" , YES ) ) ; doc . add ( newTextField ( "body" , "some<seq2seq4repair_space>contents<seq2seq4repair_space>and<seq2seq4repair_space>more<seq2seq4repair_space>contents" , NO ) ) ; doc . add ( new NumericDocValuesField ( "popularity" , 5 ) ) ; iw . addDocument ( doc ) ; doc = new Document ( ) ; doc . add ( newStringField ( "id" , "2" , YES ) ) ; doc . add ( newTextField ( "body" , "another<seq2seq4repair_space>document<seq2seq4repair_space>with<seq2seq4repair_space>different<seq2seq4repair_space>contents" , NO ) ) ; doc . add ( new NumericDocValuesField ( "popularity" , 20 ) ) ; iw . addDocument ( doc ) ; doc = new Document ( ) ; doc . add ( newStringField ( "id" , "3" , YES ) ) ; doc . add ( newTextField ( "body" , "crappy<seq2seq4repair_space>contents" , NO ) ) ; doc . add ( new NumericDocValuesField ( "popularity" , 2 ) ) ; iw . addDocument ( doc ) ; reader = iw . getReader ( ) ; searcher = new IndexSearcher ( reader ) ; <START_BUG> iw . close ( ) ; <END_BUG> } @ Override public void tearDown ( ) throws Exception { } public void testBasic ( ) throws Exception { } }

Fix:
iw . shutdown ( ) ;
Buggy code:
final class ArrayToCollectionGenericConverter implements GenericConverter { private final GenericConversionService conversionService ; public ArrayToCollectionGenericConverter ( GenericConversionService conversionService ) { } public Object convert ( Object source , TypeDescriptor sourceType , TypeDescriptor targetType ) { int length = Array . getLength ( source ) ; Collection collection = CollectionFactory . createCollection ( targetType . getType ( ) , length ) ; TypeDescriptor sourceElementType = sourceType . getElementTypeDescriptor ( ) ; TypeDescriptor targetElementType = targetType . getElementTypeDescriptor ( ) ; if ( ( targetElementType == ( TypeDescriptor . NULL ) ) || ( sourceElementType . isAssignableTo ( targetElementType ) ) ) { for ( int i = 0 ; i < length ; i ++ ) { collection . add ( Array . get ( source , i ) ) ; } } else { GenericConverter converter = this . conversionService . getConverter ( sourceElementType , targetElementType ) ; if ( converter == null ) { <START_BUG> throw new org . springframework . core . convert . ConverterNotFoundException ( sourceType , targetType ) ; <END_BUG> } for ( int i = 0 ; i < length ; i ++ ) { collection . add ( converter . convert ( Array . get ( source , i ) , sourceElementType , targetElementType ) ) ; } } return collection ; } }

Fix:
throw new org . springframework . core . convert . ConverterNotFoundException ( sourceElementType , targetElementType ) ;
Buggy code:
public class TripleDES { private static final Base64 mBase = new Base64 ( ) ; public static String encrypt ( String message , String key ) { } public static String decrypt ( String message , String key ) { try { <START_BUG> byte [ ] realMessage = TripleDES . mBase . decode ( message ) ; <END_BUG> final MessageDigest md = MessageDigest . getInstance ( "md5" ) ; final byte [ ] digestOfPassword = md . digest ( key . getBytes ( "utf-8" ) ) ; final byte [ ] keyBytes = Arrays . copyOf ( digestOfPassword , 24 ) ; for ( int j = 0 , k = 16 ; j < 8 ; ) { keyBytes [ ( k ++ ) ] = keyBytes [ ( j ++ ) ] ; } final SecretKey keySecret = new SecretKeySpec ( keyBytes , "DESede" ) ; final IvParameterSpec iv = new IvParameterSpec ( new byte [ 8 ] ) ; final Cipher decipher = Cipher . getInstance ( "DESede//CBC//PKCS5Padding" ) ; decipher . init ( Cipher . DECRYPT_MODE , keySecret , iv ) ; final byte [ ] plainText = decipher . doFinal ( realMessage ) ; return new String ( plainText , StandardCharsets . UTF_8 ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return "FAIL" ; } }

Fix:
byte [ ] realMessage = TripleDES . mBase . decode ( message . getBytes ( ) ) ;
Buggy code:
public class ReturnStatement extends Statement { private Expression optionalExpression = null ; ReturnStatement ( AST ast ) { } public int getNodeType ( ) { } ASTNode clone ( AST target ) { ReturnStatement result = new ReturnStatement ( target ) ; result . setSourceRange ( this . getStartPosition ( ) , this . getLength ( ) ) ; <START_BUG> result . setLeadingComment ( getLeadingComment ( ) ) ; <END_BUG> result . setExpression ( ( ( Expression ) ( ASTNode . copySubtree ( target , getExpression ( ) ) ) ) ) ; return result ; } public boolean subtreeMatch ( ASTMatcher matcher , Object other ) { } void accept0 ( ASTVisitor visitor ) { } public Expression getExpression ( ) { } public void setExpression ( Expression expression ) { } int memSize ( ) { } int treeSize ( ) { } }

Fix:
result . copyLeadingComment ( this ) ;