nus-yam/ex-repair huggingface dataset:
Buggy code:
public class ProjectHelper { private static Log log = LogFactory . getLog ( ProjectHelper . class ) ; private ProjectMapper mProjectMapper ; public ProjectHelper ( ) { } public String getProjectListXML ( AccountObject account ) { } public List < String > getProjectScrumWorkerList ( IUserSession userSession , IProject project ) { } public List < AccountObject > getProjectScrumWorkerListForDb ( IUserSession userSession , ProjectObject project ) { ProjectMapper projectMapper = new ProjectMapper ( ) ; <START_BUG> return projectMapper . getProjectScrumWorkers ( project . getId ( ) ) ; <END_BUG> } public String getCreateProjectXML ( HttpServletRequest request , IUserSession userSession , String fromPage , ProjectInfo projectInfo ) { } public ArrayList < AccountObject > getProjectMemberList ( ProjectObject project ) { } private ProjectInfoForm convertProjectInfo ( ProjectInfo projectInfo ) { } public ProjectObject getProject ( long id ) { } public void updateProject ( long id , ProjectInfo projectInfo ) { } }

Fix:
return projectMapper . getProjectWorkers ( project . getId ( ) ) ;
Buggy code:
public class StudentScanRequest extends AppCompatActivity { private TextView signInResult ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } public void getIntentData ( ) { Bundle scanData = getIntent ( ) . getExtras ( ) ; if ( scanData != null ) { final String lectureId = scanData . getString ( "Content" ) ; final String userName = scanData . getString ( "UserName" ) ; <START_BUG> String attendanceRequest = "Attendance" ; <END_BUG> JSONProcessor processor = new JSONProcessor ( ) ; processor . setmListener ( new JSONProcessor . Listener ( ) { @ Override public void onResult ( String response ) { if ( response . equals ( "Logged<seq2seq4repair_space>In" ) ) { signInResult . setText ( ( ( userName + ",<seq2seq4repair_space>signed<seq2seq4repair_space>in<seq2seq4repair_space>for<seq2seq4repair_space>lecture:<seq2seq4repair_space>" ) + lectureId ) ) ; } else { signInResult . setText ( "Login<seq2seq4repair_space>attempt<seq2seq4repair_space>failed" ) ; } } } ) ; processor . execute ( attendanceRequest , lectureId , userName ) ; } } No newline ; at end ; of file ; }

Fix:
String attendanceRequest = getString ( attendance_request ) ;
Buggy code:
public class ResourceReferenceRegistry { private static class Key { private final String scope ; private final String name ; private final Locale locale ; private final String style ; private final String variation ; public Key ( String scope , String name , Locale locale , String style , String variation ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } } private final Map < ResourceReferenceRegistry . Key , ResourceReference > map = new ConcurrentHashMap < ResourceReferenceRegistry . Key , ResourceReference > ( ) ; private final Queue < ResourceReferenceRegistry . Key > autoAddedQueue = new ConcurrentLinkedQueue < ResourceReferenceRegistry . Key > ( ) ; private int autoAddedCapacity = 1000 ; public ResourceReferenceRegistry ( ) { } public void registerResourceReference ( ResourceReference reference ) { } public void unregisterResourceReference ( ResourceReference reference ) { } protected ResourceReference getResourceReference ( Class < ? > scope , String name , Locale locale , String style , String variation , boolean strict , boolean createIfNotFound ) { ResourceReferenceRegistry . Key key = new ResourceReferenceRegistry . Key ( scope . getName ( ) , name , locale , style , variation ) ; ResourceReference res = map . get ( key ) ; if ( strict ) { <START_BUG> if ( res == null ) { <END_BUG> res = addDefaultResourceReference ( scope , name , locale , style , variation ) ; } } if ( strict || ( res != null ) ) { return res ; } else { res = getResourceReference ( scope , name , locale , style , null , true , false ) ; if ( res == null ) { res = getResourceReference ( scope , name , locale , null , variation , true , false ) ; } if ( res == null ) { res = getResourceReference ( scope , name , locale , null , null , true , false ) ; } if ( res == null ) { res = getResourceReference ( scope , name , null , style , variation , true , false ) ; } if ( res == null ) { res = getResourceReference ( scope , name , null , style , null , true , false ) ; } if ( res == null ) { res = getResourceReference ( scope , name , null , null , variation , true , false ) ; } if ( res == null ) { res = getResourceReference ( scope , name , null , null , null , true , false ) ; } if ( ( res == null ) && createIfNotFound ) { res = addDefaultResourceReference ( scope , name , locale , style , variation ) ; } return res ; } } private final ClassScanner scanner = new ClassScanner ( ) { @ Override void foundResourceReference ( ResourceReference reference ) { } } ; public ResourceReference getResourceReference ( Class < ? > scope , String name , Locale locale , String style , String variation , boolean strict ) { } private ResourceReference addDefaultResourceReference ( Class < ? > scope , String name , Locale locale , String style , String variation ) { } protected ResourceReference createDefaultResourceReference ( Class < ? > scope , String name , Locale locale , String style , String variation ) { } public void setAutoAddedCapacity ( int autoAddedCapacity ) { } public int getAutoAddedCapacity ( ) { } }

Fix:
if ( ( res == null ) && createIfNotFound ) {
Buggy code:
public class LocalizerTest extends TestCase { private Application application ; private IResourceSettings settings ; private Localizer localizer ; public LocalizerTest ( String message ) { } protected void setUp ( ) throws Exception { super . setUp ( ) ; application = new DummyApplication ( ) ; settings = application . getResourceSettings ( ) ; settings . addStringResourceLoader ( new wicket . resource . loader . ApplicationStringResourceLoader ( application ) ) ; <START_BUG> localizer = application . getMarkupSettings ( ) . getLocalizer ( ) ; <END_BUG> } public void testGetStringValidString ( ) { } public void testGetStringMissingStringReturnDefault ( ) { } public void testGetStringMissingStringNoDefault ( ) { } public void testGetStringMissingStringDoNotUseDefault ( ) { } public void testGetStringMissingStringExceptionThrown ( ) { } public void testGetStringPropertySubstitution ( ) { } public void testAllOtherMethodsDelegateCorrectly ( ) { } }

Fix:
localizer = application . getResourceSettings ( ) . getLocalizer ( ) ;
Buggy code:
class AddClassFileToIndex extends IndexRequest { IFile resource ; IndexManager manager ; IPath indexedContainer ; byte [ ] contents ; public AddClassFileToIndex ( IFile resource , IndexManager manager , IPath indexedContainer ) { } public boolean belongsTo ( String jobFamily ) { } public boolean execute ( IProgressMonitor progressMonitor ) { if ( ( progressMonitor != null ) && ( progressMonitor . isCanceled ( ) ) ) return IJob . COMPLETE ; try { <START_BUG> IIndex index = manager . getIndex ( this . indexedContainer ) ; <END_BUG> if ( index == null ) return IJob . COMPLETE ; ReadWriteMonitor monitor = manager . getMonitorFor ( index ) ; if ( monitor == null ) return IJob . COMPLETE ; try { monitor . enterWrite ( ) ; byte [ ] contents = this . getContents ( ) ; if ( contents == null ) return IJob . FAILED ; index . add ( new IFileDocument ( resource , contents ) , new BinaryIndexer ( true ) ) ; } finally { monitor . exitWrite ( ) ; } } catch ( IOException e ) { if ( JobManager . VERBOSE ) { JobManager . verbose ( ( ( "-><seq2seq4repair_space>failed<seq2seq4repair_space>to<seq2seq4repair_space>index<seq2seq4repair_space>" + ( this . resource ) ) + "<seq2seq4repair_space>because<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>following<seq2seq4repair_space>exception:" ) ) ; e . printStackTrace ( ) ; } return IJob . FAILED ; } return IJob . COMPLETE ; } private byte [ ] getContents ( ) { } public void initializeContents ( ) { } public String toString ( ) { } }

Fix:
IIndex index = manager . getIndex ( this . indexedContainer , true , true ) ;
Buggy code:
public abstract class AjaxFormComponentUpdatingBehavior extends AjaxEventBehavior { public AjaxFormComponentUpdatingBehavior ( final String event ) { } protected void onBind ( ) { } protected final FormComponent getFormComponent ( ) { } protected final CharSequence getEventHandler ( ) { <START_BUG> return getCallbackScript ( new AppendingStringBuffer ( "wicketAjaxPost('" ) . append ( getCallbackUrl ( true , false ) ) . append ( ( ( "',<seq2seq4repair_space>wicketSerialize(document.getElementById('" + ( getComponent ( ) . getMarkupId ( ) ) ) + "'))" ) ) , null , null ) ; <END_BUG> } protected void onCheckEvent ( String event ) { } protected final void onEvent ( final AjaxRequestTarget target ) { } protected abstract void onUpdate ( AjaxRequestTarget target ) { } protected void onError ( AjaxRequestTarget target , RuntimeException e ) { } }

Fix:
return getCallbackScript ( new AppendingStringBuffer ( "wicketAjaxPost('" ) . append ( getCallbackUrl ( false ) ) . append ( ( ( "',<seq2seq4repair_space>wicketSerialize(document.getElementById('" + ( getComponent ( ) . getMarkupId ( ) ) ) + "'))" ) ) , null , null ) ;
Buggy code:
class NewDomainControllerImpl implements NewDomainController { private final NewDomainModelImpl domainModel ; NewDomainControllerImpl ( final ExtensibleConfigurationPersister configurationPersister ) { } @ Override public Cancellable execute ( final ModelNode operation , final ResultHandler handler ) { } @ Override public ModelNode execute ( final ModelNode operation ) throws CancellationException , OperationFailedException { } @ Override public void addClient ( final NewHostControllerClient client ) { <START_BUG> Logger . getLogger ( "org.jboss.domain" ) . info ( ( "register<seq2seq4repair_space>client<seq2seq4repair_space>" + client ) ) ; <END_BUG> } @ Override public void removeClient ( final String id ) { } public ModelNode getModel ( ) { } }

Fix:
Logger . getLogger ( "org.jboss.domain" ) . info ( ( "register<seq2seq4repair_space>host<seq2seq4repair_space>" + ( client . getId ( ) ) ) ) ;
Buggy code:
public class Snippet149 { public static void main ( String [ ] args ) { Display display = new Display ( ) ; Shell shell = new Shell ( display ) ; shell . setLayout ( new FillLayout ( ) ) ; Table table = new Table ( shell , SWT . BORDER ) ; table . setHeaderVisible ( true ) ; table . setLinesVisible ( true ) ; for ( int i = 0 ; i < 2 ; i ++ ) { <START_BUG> TableColumn column = new TableColumn ( table , SWT . NONE ) ; <END_BUG> } table . getColumn ( 0 ) . setText ( "Task" ) ; table . getColumn ( 1 ) . setText ( "Progress" ) ; for ( int i = 0 ; i < 40 ; i ++ ) { TableItem item = new TableItem ( table , SWT . NONE ) ; item . setText ( ( "Task<seq2seq4repair_space>" + i ) ) ; if ( ( i % 5 ) == 0 ) { ProgressBar bar = new ProgressBar ( table , SWT . NONE ) ; bar . setSelection ( i ) ; TableEditor editor = new TableEditor ( table ) ; editor . grabHorizontal = editor . grabVertical = true ; editor . setEditor ( bar , item , 1 ) ; } } table . getColumn ( 0 ) . pack ( ) ; table . getColumn ( 1 ) . setWidth ( 128 ) ; shell . pack ( ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) { display . sleep ( ) ; } } } }

Fix:
new TableColumn ( table , SWT . NONE ) ;
Buggy code:
@ RunWith ( Arquillian . class ) public class InterceptorOrderTest { @ Deployment public static Archive < ? > deploy ( ) { } @ Test public void testOrder ( Processor processor ) { } @ Test public void testOrder2 ( Processor processor ) { Counter . count = 0 ; SimpleProcessor . count = 0 ; CdiInterceptor . count = 0 ; CdiInterceptor2 . count = 0 ; EjbInterceptor . count = 0 ; EjbInterceptor2 . count = 0 ; <START_BUG> int sum = processor . subtract ( 34 , 13 ) ; <END_BUG> Assert . assertEquals ( 21 , sum ) ; Assert . assertEquals ( 0 , count ) ; Assert . assertEquals ( 1 , CdiInterceptor2 . count ) ; Assert . assertEquals ( 2 , CdiInterceptor . count ) ; Assert . assertEquals ( 3 , SimpleProcessor . count ) ; } }

Fix:
int sum = processor . substract ( 34 , 13 ) ;
Buggy code:
public final class DB2LengthOperatorNode extends UnaryOperatorNode { public void init ( Object operand ) { } public ValueNode bindExpression ( FromList fromList , SubqueryList subqueryList , Vector aggregateVector ) throws StandardException { } public String getReceiverInterfaceName ( ) { } public void generateExpression ( ExpressionClassBuilder acb , MethodBuilder mb ) throws StandardException { } private int getConstantLength ( ) throws StandardException { DataTypeDescriptor typeDescriptor = operand . getTypeServices ( ) ; switch ( typeDescriptor . getJDBCTypeId ( ) ) { case Types . BIGINT : return 8 ; <START_BUG> case JDBC30Translation . SQL_TYPES_BOOLEAN : <END_BUG> case Types . BIT : return 1 ; case Types . BINARY : case Types . CHAR : return typeDescriptor . getMaximumWidth ( ) ; case Types . DATE : return 4 ; case Types . DECIMAL : case Types . NUMERIC : return ( ( typeDescriptor . getPrecision ( ) ) // 2 ) + 1 ; case Types . DOUBLE : return 8 ; case Types . FLOAT : case Types . REAL : case Types . INTEGER : return 4 ; case Types . SMALLINT : return 2 ; case Types . TIME : return 3 ; case Types . TIMESTAMP : return 10 ; case Types . TINYINT : return 1 ; case Types . LONGVARCHAR : case Types . VARCHAR : case Types . LONGVARBINARY : case Types . VARBINARY : case Types . BLOB : return getConstantNodeLength ( ) ; default : return - 1 ; } } private int getConstantNodeLength ( ) throws StandardException { } }

Fix:
case Types . BOOLEAN :
Buggy code:
public class ReconcileWorkingCopyOperation extends JavaModelOperation { boolean createAST ; int astLevel ; boolean forceProblemDetection ; WorkingCopyOwner workingCopyOwner ; CompilationUnit ast ; public ReconcileWorkingCopyOperation ( IJavaElement workingCopy , boolean creatAST , int astLevel , boolean forceProblemDetection , WorkingCopyOwner workingCopyOwner ) { } protected void executeOperation ( ) throws JavaModelException { if ( ( this . progressMonitor ) != null ) { if ( this . progressMonitor . isCanceled ( ) ) return ; this . progressMonitor . beginTask ( org . eclipse . jdt . internal . core . util . Util . bind ( "element.reconciling" ) , 2 ) ; } CompilationUnit workingCopy = getWorkingCopy ( ) ; boolean wasConsistent = workingCopy . isConsistent ( ) ; try { if ( ! wasConsistent ) { JavaElementDeltaBuilder deltaBuilder = new JavaElementDeltaBuilder ( workingCopy ) ; this . ast = workingCopy . makeConsistent ( this . createAST , this . astLevel , this . progressMonitor ) ; deltaBuilder . buildDeltas ( ) ; if ( ( progressMonitor ) != null ) progressMonitor . worked ( 2 ) ; if ( ( deltaBuilder . delta ) != null ) { addReconcileDelta ( workingCopy , deltaBuilder . delta ) ; } } else { if ( forceProblemDetection ) { IProblemRequestor problemRequestor = workingCopy . getPerWorkingCopyInfo ( ) ; if ( ( problemRequestor != null ) && ( problemRequestor . isActive ( ) ) ) { CompilationUnitDeclaration unit = null ; try { problemRequestor . beginReporting ( ) ; char [ ] contents = workingCopy . getContents ( ) ; unit = CompilationUnitProblemFinder . process ( workingCopy , contents , this . workingCopyOwner , problemRequestor , false , this . progressMonitor ) ; problemRequestor . endReporting ( ) ; if ( ( progressMonitor ) != null ) progressMonitor . worked ( 1 ) ; if ( ( this . createAST ) && ( unit != null ) ) { Map options = workingCopy . getJavaProject ( ) . getOptions ( true ) ; <START_BUG> this . ast = AST . convertCompilationUnit ( this . astLevel , unit , contents , options , this . progressMonitor ) ; <END_BUG> if ( ( progressMonitor ) != null ) progressMonitor . worked ( 1 ) ; } } finally { if ( unit != null ) { unit . cleanUp ( ) ; } } } } } } finally { if ( ( progressMonitor ) != null ) progressMonitor . done ( ) ; } } protected CompilationUnit getWorkingCopy ( ) { } public boolean isReadOnly ( ) { } protected IJavaModelStatus verify ( ) { } }

Fix:
this . ast = AST . convertCompilationUnit ( this . astLevel , unit , contents , options , true , this . progressMonitor ) ;
Buggy code:
public class Chat extends JavaPlugin { private static Chat instance ; public static String label ; public FileManager fileManager ; public ConfigManager configManager ; public boolean useGroupManager ; public boolean usePermissionEx ; public GroupManager groupManager ; public final Logger logger = Bukkit . getServer ( ) . getLogger ( ) ; @ Override public void onEnable ( ) { } public static Chat getInstance ( ) { } public void registreEvents ( Listener ... listeners ) { } public boolean hasPermission ( Player player , String permission ) { } public String getUsage ( String commande ) { } public boolean sendPluginMessage ( CommandSender target , String message , boolean isError ) { } public String getArguments ( String [ ] args , int start ) { String result = "" ; if ( start < ( args . length ) ) { for ( int i = start ; i < ( args . length ) ; i ++ ) <START_BUG> result += ( i == start ? "<seq2seq4repair_space>" : "" ) + ( args [ i ] ) ; <END_BUG> } return result ; } }

Fix:
result += ( i != start ? "<seq2seq4repair_space>" : "" ) + ( args [ i ] ) ;
Buggy code:
public class PromptPasswordState implements State { private final ConsoleWrapper theConsole ; private final StateValues stateValues ; private final boolean rePrompt ; public PromptPasswordState ( ConsoleWrapper theConsole , StateValues stateValues , boolean rePrompt ) { } @ Override public State execute ( ) { if ( ( stateValues . isSilentOrNonInteractive ( ) ) == false ) { if ( ( rePrompt ) == false ) { theConsole . printf ( DomainManagementMessages . MESSAGES . passwordPrompt ( ) ) ; char [ ] tempChar = theConsole . readPassword ( "<seq2seq4repair_space>:<seq2seq4repair_space>" ) ; if ( ( tempChar == null ) || ( ( tempChar . length ) == 0 ) ) { return new ErrorState ( theConsole , DomainManagementMessages . MESSAGES . noPasswordExiting ( ) ) ; } stateValues . setPassword ( tempChar ) ; return new ValidatePasswordState ( theConsole , stateValues ) ; } else { theConsole . printf ( DomainManagementMessages . MESSAGES . passwordConfirmationPrompt ( ) ) ; char [ ] secondTempChar = theConsole . readPassword ( "<seq2seq4repair_space>:<seq2seq4repair_space>" ) ; if ( secondTempChar == null ) { secondTempChar = new char [ 0 ] ; } if ( ( Arrays . equals ( stateValues . getPassword ( ) , secondTempChar ) ) == false ) { return new ErrorState ( theConsole , DomainManagementMessages . MESSAGES . passwordMisMatch ( ) , new PromptPasswordState ( theConsole , stateValues , false ) ) ; } <START_BUG> return stateValues . rolePropertiesFound ( ) ? new PromptRolesState ( theConsole , stateValues ) : new PreModificationState ( theConsole , stateValues ) ; <END_BUG> } } return new ValidatePasswordState ( theConsole , stateValues ) ; } }

Fix:
return stateValues . groupPropertiesFound ( ) ? new PromptGroupsState ( theConsole , stateValues ) : new PreModificationState ( theConsole , stateValues ) ;
Buggy code:
public class DocCheckinner implements AsyncCallback < Document > { private Editor editor ; public DocCheckinner ( ) { } public DocCheckinner ( Editor editor ) { } public void checkinDocument ( Document doc , String clientId ) { } @ Override public void onFailure ( Throwable caught ) { } @ Override public void onSuccess ( Document result ) { if ( ( this . editor ) != null ) { this . editor . refresh ( result ) ; } new edu . caltech . cs141b . collaborator . ui . Notification ( ( ( "Document<seq2seq4repair_space>\"" + ( result . getTitle ( ) ) ) + "\"<seq2seq4repair_space>checked<seq2seq4repair_space>in." ) ) . show ( ) ; if ( result . getSimulate ( ) ) { final Document doc = result ; final Editor editor = this . editor ; Random randomGenerator = new Random ( ) ; Timer t = new Timer ( ) { public void run ( ) { if ( editor != null ) { new DocCheckouter ( editor ) . checkoutDocument ( doc . getKey ( ) , clientId ) ; } else { new DocCheckouter ( ) . checkoutDocument ( doc . getKey ( ) , clientId ) ; } } } ; <START_BUG> t . schedule ( randomGenerator . nextInt ( 15000 ) ) ; <END_BUG> } } }

Fix:
t . schedule ( randomGenerator . nextInt ( thinkTime ) ) ;
Buggy code:
public class IteratorUtilsTest extends BulkTest { public IteratorUtilsTest ( final String name ) { } public static Test suite ( ) { } public void testAsIterable ( ) { } public void testAsIterableNull ( ) { } public void testAsMultipleIterable ( ) { } public void testAsMultipleIterableNull ( ) { } public void testToList ( ) { } public void testToArray ( ) { } public void testToArray2 ( ) { } public void testArrayIterator ( ) { } public void testArrayListIterator ( ) { } private Iterator < String > getImmutableIterator ( ) { } private ListIterator < String > getImmutableListIterator ( ) { } public void testEmptyIterator ( ) { } public void testEmptyListIterator ( ) { } @ SuppressWarnings ( "unchecked" ) public void testEmptyMapIterator ( ) { } @ SuppressWarnings ( "unchecked" ) public void testEmptyOrderedIterator ( ) { } @ SuppressWarnings ( "unchecked" ) public void testEmptyOrderedMapIterator ( ) { } public void testUnmodifiableIteratorIteration ( ) { } public void testUnmodifiableListIteratorIteration ( ) { } public void testUnmodifiableIteratorImmutability ( ) { } public void testUnmodifiableListIteratorImmutability ( ) { } public void testNodeListIterator ( ) { } public void testNodeIterator ( ) { } private Node [ ] createNodes ( ) { } private NodeList createNodeList ( final Node [ ] nodes ) { return new NodeList ( ) { <START_BUG> public Node item ( int index ) { <END_BUG> return nodes [ index ] ; } public int getLength ( ) { return nodes . length ; } } ; } }

Fix:
public Node item ( final int index ) {
Buggy code:
public class BooleanQueryTst { String queryText ; final int [ ] expectedDocNrs ; SingleFieldTestDb dBase ; String fieldName ; Assert testCase ; BasicQueryFactory qf ; boolean verbose = true ; public BooleanQueryTst ( String queryText , int [ ] expectedDocNrs , SingleFieldTestDb dBase , String fieldName , Assert testCase , BasicQueryFactory qf ) { } public void setVerbose ( boolean verbose ) { } class TestCollector extends Collector { int totalMatched ; boolean [ ] encountered ; private Scorer scorer = null ; private int docBase = 0 ; TestCollector ( ) { } @ Override public void setScorer ( Scorer scorer ) throws IOException { } @ Override public boolean acceptsDocsOutOfOrder ( ) { } @ Override public void setNextReader ( AtomicReaderContext context ) throws IOException { <START_BUG> this . docBase = docBase ; <END_BUG> } @ Override public void collect ( int docNr ) throws IOException { } void checkNrHits ( ) { } } public void doTest ( ) throws Exception { } }

Fix:
docBase = context . docBase ;
Buggy code:
public abstract class LocalFolder extends Folder { protected int nextMessageUid ; protected AbstractMessage aktMessage ; protected DataStorageInterface dataStorage ; protected AbstractSearchEngine searchEngine ; public LocalFolder ( FolderItem item ) { } public LocalFolder ( String name ) { } public void removeFolder ( ) throws Exception { } protected Object generateNextMessageUid ( ) { } public void setNextMessageUid ( int next ) { } public abstract DataStorageInterface getDataStorageInstance ( ) { } public boolean exists ( Object uid , WorkerStatusController worker ) throws Exception { } public Object addMessage ( AbstractMessage message , WorkerStatusController worker ) throws Exception { } public Object addMessage ( String source , WorkerStatusController worker ) throws Exception { } public void removeMessage ( Object uid , WorkerStatusController worker ) throws Exception { } public AbstractMessage getMessage ( Object uid , WorkerStatusController worker ) throws Exception { if ( ( aktMessage ) != null ) { if ( aktMessage . getUID ( ) . equals ( uid ) ) { return ( ( AbstractMessage ) ( aktMessage . clone ( ) ) ) ; } } String source = getMessageSource ( uid , worker ) ; <START_BUG> AbstractMessage message = new Rfc822Parser ( ) . parse ( source , true , null , 0 ) ; <END_BUG> message . setUID ( uid ) ; message . setSource ( source ) ; aktMessage = message ; return ( ( AbstractMessage ) ( message . clone ( ) ) ) ; } public MimePart getMimePart ( Object uid , Integer [ ] address , WorkerStatusController worker ) throws Exception { } public ColumbaHeader getMessageHeader ( Object uid , WorkerStatusController worker ) throws Exception { } public String getMessageSource ( Object uid , WorkerStatusController worker ) throws Exception { } public MimePartTree getMimePartTree ( Object uid , WorkerStatusController worker ) throws Exception { } public AbstractSearchEngine getSearchEngineInstance ( ) { } public Object [ ] searchMessages ( Filter filter , Object [ ] uids , WorkerStatusController worker ) throws Exception { } public Object [ ] searchMessages ( Filter filter , WorkerStatusController worker ) throws Exception { } public int size ( ) { } }

Fix:
AbstractMessage message = new Rfc822Parser ( ) . parse ( source , null ) ;
Buggy code:
public class CLWorldHelper { public static int getBlockLightValue_do ( World world , int x , int y , int z , boolean par4 ) { } @ SideOnly ( Side . CLIENT ) public static int getLightBrightnessForSkyBlocks ( World world , int x , int y , int z , int lightValue ) { } public static int computeLightValue ( World world , int par_x , int par_y , int par_z , EnumSkyBlock par1Enu ) { if ( ( par1Enu == ( EnumSkyBlock . Sky ) ) && ( world . pipe . canBlockSeeTheSky ( par_x , par_y , par_z ) ) ) { return 15 ; } else { Block block = world . getBlock ( par_x , par_y , par_z ) ; int currentLight = 0 ; if ( par1Enu != ( EnumSkyBlock . Sky ) ) { currentLight = ( block == null ) ? 0 : CLWorldHelper . getLightValueSomehow ( block , world , par_x , par_y , par_z ) ; if ( ( currentLight > 0 ) && ( currentLight <= 15 ) ) { currentLight = ( ( ( currentLight << 15 ) | ( currentLight << 10 ) ) | ( currentLight << 5 ) ) | currentLight ; } } int opacity = ( block == null ) ? 0 : block . getLightOpacity ( world , par_x , par_y , par_z ) ; if ( ( opacity >= 15 ) && ( currentLight > 0 ) ) { opacity = 1 ; } if ( opacity < 1 ) { opacity = 1 ; } if ( opacity >= 15 ) { return 0 ; } else <START_BUG> if ( ( currentLight & 15 ) >= 14 ) { <END_BUG> return currentLight ; } else { for ( int faceIndex = 0 ; faceIndex < 6 ; ++ faceIndex ) { int l1 = par_x + ( Facing . offsetsXForSide [ faceIndex ] ) ; int i2 = par_y + ( Facing . offsetsYForSide [ faceIndex ] ) ; int j2 = par_z + ( Facing . offsetsZForSide [ faceIndex ] ) ; int neighborLight = world . pipe . getSavedLightValue ( par1Enu , l1 , i2 , j2 ) ; int ll = neighborLight & 15 ; int rl = neighborLight & 480 ; int gl = neighborLight & 15360 ; int bl = neighborLight & 491520 ; ll -= opacity & 15 ; rl = Math . max ( 0 , ( rl - ( opacity << 5 ) ) ) ; gl = Math . max ( 0 , ( gl - ( opacity << 10 ) ) ) ; bl = Math . max ( 0 , ( bl - ( opacity << 15 ) ) ) ; if ( ll > ( currentLight & 15 ) ) { currentLight = ( currentLight & 507360 ) | ll ; } if ( rl > ( currentLight & 480 ) ) { currentLight = ( currentLight & 506895 ) | rl ; } if ( gl > ( currentLight & 15360 ) ) { currentLight = ( currentLight & 492015 ) | gl ; } if ( bl > ( currentLight & 491520 ) ) { currentLight = ( currentLight & 15855 ) | bl ; } } return currentLight ; } } } public static boolean updateLightByType ( World world , EnumSkyBlock par1Enu , int par_x , int par_y , int par_z ) { } public static boolean updateLightByType_withIncrement ( World world , EnumSkyBlock par1Enu , int par_x , int par_y , int par_z , boolean shouldIncrement , int rel_x , int rel_y , int rel_z ) { } private static int getLightValueSomehow ( Block block , World world , int par_x , int par_y , int par_z ) { } private static void nop ( ) { } No newline ; at end ; of file ; }

Fix:
if ( currentLight == 507375 ) {
Buggy code:
public class TestUniqueTermCount extends LuceneTestCase { Directory dir ; IndexReader reader ; ArrayList < Integer > expected = new ArrayList < Integer > ( ) ; @ Override public void setUp ( ) throws Exception { super . setUp ( ) ; dir = newDirectory ( ) ; IndexWriterConfig config = newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random , MockTokenizer . SIMPLE , true ) ) . setMergePolicy ( newLogMergePolicy ( ) ) ; config . setSimilarity ( new TestUniqueTermCount . TestSimilarity ( ) ) ; RandomIndexWriter writer = new RandomIndexWriter ( random , dir , config ) ; Document doc = new Document ( ) ; Field foo = newField ( "foo" , "" , TYPE_UNSTORED ) ; doc . add ( foo ) ; for ( int i = 0 ; i < 100 ; i ++ ) { <START_BUG> foo . setValue ( addValue ( ) ) ; <END_BUG> writer . addDocument ( doc ) ; } reader = writer . getReader ( ) ; writer . close ( ) ; } @ Override public void tearDown ( ) throws Exception { } public void test ( ) throws Exception { } private String addValue ( ) { } class TestSimilarity extends DefaultSimilarity { @ Override public void computeNorm ( FieldInvertState state , Norm norm ) { } } }

Fix:
foo . setStringValue ( addValue ( ) ) ;
Buggy code:
@ Api ( basePath = "v1//activity" , value = "" , description = "活动" ) @ Controller @ RequestMapping ( "v1//activity" ) public class ActivityController extends BaseController { private static final Log LOGGER = LogFactory . getLog ( ActivityController . class ) ; @ Resource ( name = "activityService" ) IActivityService activityService ; @ Resource ( name = "userService" ) IUserService userService ; @ ApiOperation ( value = "发起活动" , httpMethod = "POST" , response = BaseResultVo . class , notes = "画家发起活动" ) @ RequestMapping ( value = "//initiate" , method = RequestMethod . POST , produces = "application//json;<seq2seq4repair_space>charset=utf-8" ) @ ResponseStatus ( HttpStatus . CREATED ) @ ResponseBody public BaseResultVo initiateActivity ( @ RequestParam @ ApiParam ( "活动发起人（画家//机构）ID" ) String initiatorId , @ RequestParam @ ApiParam ( "活动时间" ) String time , @ RequestParam @ ApiParam ( "活动地点" ) String place , @ RequestParam @ ApiParam ( "活动内容(描述)" ) String description , @ RequestParam @ ApiParam ( "图片URL" ) String imageURL ) { } @ ApiOperation ( value = "参加活动" , httpMethod = "POST" , response = BaseResultVo . class , notes = "普通用户参加活动" ) @ RequestMapping ( value = "//join" , method = RequestMethod . POST , produces = "application//json;<seq2seq4repair_space>charset=utf-8" ) @ ResponseBody public BaseResultVo joinActivity ( @ RequestParam @ ApiParam ( "活动ID" ) String activityId , @ RequestParam @ ApiParam ( "参加活动的用户ID" ) String userId ) { try { <START_BUG> activityService . joinActivity ( activityId , userId ) ; <END_BUG> } catch ( BaseException e ) { return buildFailedResultInfo ( e ) ; } return buildSuccessResultInfo ( "参加活动成功！" ) ; } @ ApiOperation ( value = "获得活动列表" , httpMethod = "GET" , response = BaseResultVo . class , notes = "获得用户发起或参与的活动列表" ) @ RequestMapping ( value = "//list//{id}" , method = RequestMethod . GET , produces = "application//json;<seq2seq4repair_space>charset=utf-8" ) @ ResponseBody public BaseResultVo listActivities ( @ PathVariable ( "id" ) @ ApiParam ( "用户ID" ) String userId ) { } @ ApiOperation ( value = "获得参与某一活动的用户列表" , httpMethod = "GET" , response = BaseResultVo . class , notes = "根据活动ID获得参与该活动的所有用户信息" ) @ RequestMapping ( value = "//listUsers//{id}" , method = RequestMethod . GET , produces = "application//json;<seq2seq4repair_space>charset=utf-8" ) @ ResponseBody public BaseResultVo listParticipants ( @ PathVariable ( "id" ) @ ApiParam ( "活动ID" ) String activityId ) { } No newline ; at end ; of file ; }

Fix:
activityService . joinActivity ( userId , activityId ) ;
Buggy code:
public class AprioriAlgo { int [ ] [ ] dset ; int [ ] arr = new int [ 30 ] ; Vector < String > candidates = new Vector < String > ( ) ; int numItems ; int numTransactions ; double minSup ; String [ ] attribs ; public void AprioriAlgo ( int n ) { } void makedata ( String fn ) { } void showdata ( ) { } public void AprioriAlgoProcess ( String fp ) { } private void generateCandidates ( int n ) { } private void calculateFrequentItemsets ( int n ) { } private void display ( ) { } public static void main ( String [ ] args ) throws IOException { String fileToParse ; BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; System . out . print ( "\nEnter<seq2seq4repair_space>Transaction<seq2seq4repair_space>Database<seq2seq4repair_space>File<seq2seq4repair_space>Name<seq2seq4repair_space>(Data<seq2seq4repair_space>in<seq2seq4repair_space>Binary<seq2seq4repair_space>form)<seq2seq4repair_space>:<seq2seq4repair_space>" ) ; fileToParse = "dataset.csv" ; AprioriAlgo ap = new AprioriAlgo ( ) ; <START_BUG> ap . minSup = 0.7 ; <END_BUG> ap . AprioriAlgoProcess ( fileToParse ) ; } }

Fix:
ap . minSup = 0.8 ;
Buggy code:
public class SendLaterAction extends FrameAction { public SendLaterAction ( AbstractFrameController FrameController ) { } public void actionPerformed ( ActionEvent evt ) { final ComposerController composerController = ( ( ComposerController ) ( getFrameController ( ) ) ) ; <START_BUG> if ( ! ( composerController . checkState ( ) ) ) <END_BUG> return ; AccountItem item = ( ( org . columba . mail . gui . composer . ComposerModel ) ( composerController . getModel ( ) ) ) . getAccountItem ( ) ; SpecialFoldersItem folderItem = item . getSpecialFoldersItem ( ) ; OutboxFolder destFolder = ( ( OutboxFolder ) ( treeModel . getFolder ( 103 ) ) ) ; ComposerCommandReference [ ] r = new ComposerCommandReference [ 1 ] ; r [ 0 ] = new ComposerCommandReference ( composerController , destFolder ) ; SaveMessageCommand c = new SaveMessageCommand ( r ) ; processor . addOp ( c ) ; } }

Fix:
if ( composerController . checkState ( ) )
Buggy code:
public class TrieNode { public TrieNode [ ] children ; public int numChildren ; public boolean isWord ; public TrieNode ( ) { } public boolean isLeaf ( ) { } public void addChild ( char c , TrieNode child ) { } public void removeChild ( char c ) { <START_BUG> if ( ( children [ Trie . charToIndex ( c ) ] ) != null ) <END_BUG> throw new RuntimeException ( ( ( "No<seq2seq4repair_space>child<seq2seq4repair_space>for<seq2seq4repair_space>char<seq2seq4repair_space>'" + c ) + "'" ) ) ; children [ Trie . charToIndex ( c ) ] = null ; ( numChildren ) -- ; } public TrieNode getChild ( char c ) { } public int firstChildIndex ( ) { } }

Fix:
if ( ( children [ Trie . charToIndex ( c ) ] ) == null )
Buggy code:
class DependencyProperty < T > extends AbstractProperty < T > { private Set < String > dependentProperties ; public DependencyProperty ( Object bean , PropertyAccessor < T > propertyAccessor , Collection < String > availablePropertyNames ) { } private void initializeDependentProperties ( ) { } private void validateDependentProperties ( Collection < String > availablePropertyNames ) { } private void validateDependsOnExistingProperties ( Collection < String > availablePropertyNames ) { if ( ! ( availablePropertyNames . containsAll ( dependentProperties ) ) ) { List < String > nonExistingDependentProperties = Lists . newArrayList ( dependentProperties ) ; nonExistingDependentProperties . removeAll ( availablePropertyNames ) ; <START_BUG> throw new RuntimeException ( ( ( ( ( toString ( ) ) + "<seq2seq4repair_space>depends<seq2seq4repair_space>on<seq2seq4repair_space>following<seq2seq4repair_space>non-existing<seq2seq4repair_space>properties<seq2seq4repair_space>'" ) + ( StringUtils . join ( nonExistingDependentProperties , "," ) ) ) + "'" ) ) ; <END_BUG> } } private void validateNotDependsOnSelf ( ) { } @ Override public void addPropertyChangeListener ( PresentationModelPropertyChangeListener listener ) { } @ Override public void removePropertyChangeListener ( PresentationModelPropertyChangeListener listener ) { } private void addListenerToDependentProperties ( PresentationModelPropertyChangeListener listener ) { } private void removeListenerOffDependentProperties ( PresentationModelPropertyChangeListener listener ) { } @ Override public String toString ( ) { } }

Fix:
throw new RuntimeException ( ( ( ( ( toString ( ) ) + "<seq2seq4repair_space>depends<seq2seq4repair_space>on<seq2seq4repair_space>the<seq2seq4repair_space>following<seq2seq4repair_space>non-existent<seq2seq4repair_space>properties<seq2seq4repair_space>'" ) + ( StringUtils . join ( nonExistingDependentProperties , "," ) ) ) + "'" ) ) ;
Buggy code:
public class TestEntityManagerMethodsThrowAfterClose extends TestCase { private EntityManagerFactory emf ; private EntityManager em ; private AllFieldTypes aft = new AllFieldTypes ( ) ; public void setUp ( ) { } public void tearDown ( ) { } public void testPersistAfterClose ( ) { } public void testMergeAfterClose ( ) { } public void testRemoveAfterClose ( ) { } public void testFindAfterClose ( ) { } public void testGetReferenceAfterClose ( ) { } public void testFlushAfterClose ( ) { } public void testSetFlushModeAfterClose ( ) { } public void testGetFlushModeAfterClose ( ) { } public void testLockAfterClose ( ) { } public void testRefreshAfterClose ( ) { } public void testClearAfterClose ( ) { } public void testContainsAfterClose ( ) { } public void testCreateQueryAfterClose ( ) { } public void testCreateNamedQueryAfterClose ( ) { } public void testCreateNativeQueryAfterClose ( ) { } public void testCreateNativeQueryWithMappingAfterClose ( ) { } public void testJoinTransactionAfterClose ( ) { } public void testGetDelegateAfterClose ( ) { } public void testCloseAfterClose ( ) { } public static void main ( String [ ] args ) { <START_BUG> TestRunner . run ( TestPersistence . class ) ; <END_BUG> } }

Fix:
TestRunner . run ( TestEntityManagerMethodsThrowAfterClose . class ) ;
Buggy code:
public class TestParallelTermEnum extends LuceneTestCase { private AtomicReader ir1 ; private AtomicReader ir2 ; private Directory rd1 ; private Directory rd2 ; @ Override public void setUp ( ) throws Exception { } @ Override public void tearDown ( ) throws Exception { } private void checkTerms ( Terms terms , Bits liveDocs , String ... termsList ) throws IOException { assertNotNull ( terms ) ; final TermsEnum te = terms . iterator ( null ) ; for ( String t : termsList ) { BytesRef b = te . next ( ) ; assertNotNull ( b ) ; assertEquals ( t , b . utf8ToString ( ) ) ; <START_BUG> DocsEnum td = _TestUtil . docs ( random ( ) , te , liveDocs , null , false ) ; <END_BUG> assertTrue ( ( ( td . nextDoc ( ) ) != ( DocIdSetIterator . NO_MORE_DOCS ) ) ) ; assertEquals ( 0 , td . docID ( ) ) ; assertEquals ( td . nextDoc ( ) , NO_MORE_DOCS ) ; } assertNull ( te . next ( ) ) ; } public void test1 ( ) throws IOException { } }

Fix:
DocsEnum td = _TestUtil . docs ( random ( ) , te , liveDocs , null , 0 ) ;
Buggy code:
public final class BoundedQueueThreadPoolAdd extends AbstractExecutorAdd { private static final long serialVersionUID = 5597662601486525937L ; private final ScaledCount queueLength ; private String handoffExecutor ; private boolean blocking ; private boolean allowCoreTimeout ; private ScaledCount coreThreads ; public BoundedQueueThreadPoolAdd ( final String name , final ScaledCount maxThreads , final ScaledCount queueLength ) { } protected < P > void applyUpdate ( final UpdateContext updateContext , final UpdateResultHandler < ? super Void , P > handler , final P param ) { <START_BUG> final BatchBuilder builder = updateContext . getBatchBuilder ( ) ; <END_BUG> final ScaledCount coreThreadsCount = getCoreThreads ( ) ; final ScaledCount maxThreadsCount = getMaxThreads ( ) ; final int maxThreads = maxThreadsCount . getScaledCount ( ) ; final int coreThreads = ( coreThreadsCount == null ) ? maxThreads : coreThreadsCount . getScaledCount ( ) ; final int queueLength = this . queueLength . getScaledCount ( ) ; final String name = getName ( ) ; final ServiceName serviceName = ThreadsServices . executorName ( name ) ; final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService ( coreThreads , maxThreads , queueLength , blocking , getKeepaliveTime ( ) , allowCoreTimeout ) ; final ServiceBuilder < Executor > serviceBuilder = builder . addService ( serviceName , service ) ; addThreadFactoryDependency ( serviceName , serviceBuilder , service . getThreadFactoryInjector ( ) , builder ) ; serviceBuilder . install ( ) ; } protected void applyUpdate ( final ThreadsSubsystemElement element ) throws UpdateFailedException { } public String getHandoffExecutor ( ) { } public void setHandoffExecutor ( final String handoffExecutor ) { } public boolean isBlocking ( ) { } public void setBlocking ( final boolean blocking ) { } public boolean isAllowCoreTimeout ( ) { } public void setAllowCoreTimeout ( final boolean allowCoreTimeout ) { } public ScaledCount getCoreThreads ( ) { } public void setCoreThreads ( final ScaledCount coreThreads ) { } public ScaledCount getQueueLength ( ) { } }

Fix:
final BatchBuilder builder = updateContext . getServiceTarget ( ) ;
Buggy code:
public class TextFieldHistory { private static Stack < String > history = new Stack < String > ( ) ; private static Stack < String > temp = new Stack < String > ( ) ; private static final String UNABLE_TO_OBTAIN_LAST_HISTORY = "invalid" ; public static void updateHistory ( String input ) { <START_BUG> if ( ! ( input . isEmpty ( ) ) ) { <END_BUG> while ( ! ( TextFieldHistory . temp . isEmpty ( ) ) ) { TextFieldHistory . history . push ( TextFieldHistory . temp . pop ( ) ) ; } TextFieldHistory . history . push ( input ) ; } } public static String getLastHistory ( ) { } public static String getForwardHistory ( ) { } }

Fix:
if ( ( ! ( input . trim ( ) . isEmpty ( ) ) ) || ( input == null ) ) {
Buggy code:
public class CardList { public List < Card > m_cardList ; private String jsonCardString ; public CardList ( String _jsonCardString ) { } public int GetLenght ( ) { } private void FillCardList ( String _jsonCardString ) { System . out . println ( ( "jsonString<seq2seq4repair_space>" + _jsonCardString ) ) ; try { JSONArray allCards = new JSONArray ( _jsonCardString ) ; for ( int index = 0 ; index < ( allCards . length ( ) ) ; index ++ ) { String curName = "" ; String curimage = "" ; String curId = "0" ; List < AttribValue > curAttrValueList = new ArrayList < > ( ) ; JSONObject curCardobj = new JSONObject ( allCards . get ( index ) . toString ( ) ) ; Iterator curCardKeysIt = curCardobj . keys ( ) ; while ( curCardKeysIt . hasNext ( ) ) { String curCat = ( ( String ) ( curCardKeysIt . next ( ) ) ) ; String curValue = curCardobj . getString ( curCat ) ; <START_BUG> if ( ( ( curValue . equals ( "" ) ) || ( curValue . equals ( 0 ) ) ) || ( curValue . equals ( "0" ) ) ) { <END_BUG> curValue = "no" ; } else { if ( ( ( curValue . equals ( 1 ) ) || ( curValue . equals ( "1" ) ) ) || ( curValue . equals ( "true" ) ) ) { curValue = "yes" ; } } if ( curCat . equals ( "name" ) ) { curName = curValue ; } else if ( curCat . equals ( "image" ) ) { curimage = curValue ; } else if ( curCat . equals ( "id" ) ) { curId = curValue ; } else { AttribValue curAttribValue = new AttribValue ( curCat , curValue ) ; curAttrValueList . add ( curAttribValue ) ; } } Card curCard = new Card ( curName , curimage , curAttrValueList ) ; m_cardList . add ( curCard ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } }

Fix:
if ( ( ( ( curValue . equals ( "" ) ) || ( curValue . equals ( 0 ) ) ) || ( curValue . equals ( "0" ) ) ) || ( curValue . equals ( "false" ) ) ) {
Buggy code:
public class OfflineLCATarjan_Include { public static void dfs ( int [ ] us , int [ ] vs , int [ ] lcas , int node , int parent , boolean [ ] visited , int [ ] ancestor , boolean [ ] [ ] adj , UnionFind uf ) { ancestor [ uf . find ( node ) ] = node ; for ( int next = 0 ; next < ( adj . length ) ; next ++ ) { if ( next == parent ) { continue ; } if ( ! ( adj [ node ] [ next ] ) ) { continue ; } OfflineLCATarjan_Include . dfs ( us , vs , lcas , next , node , visited , ancestor , adj , uf ) ; uf . union ( node , next ) ; ancestor [ uf . find ( node ) ] = node ; } visited [ node ] = true ; for ( int i = 0 ; i < ( us . length ) ; i ++ ) { int not_node = - 1 ; if ( ( us [ i ] ) == node ) { not_node = vs [ i ] ; } else if ( ( vs [ i ] ) == node ) { not_node = us [ i ] ; } if ( ( not_node >= 0 ) && ( visited [ not_node ] ) ) { <START_BUG> lcas [ i ] = ancestor [ i ] ; <END_BUG> } } } public static int [ ] offlineLCA ( int [ ] us , int [ ] vs , boolean [ ] [ ] adj ) { } }

Fix:
lcas [ i ] = ancestor [ uf . find ( not_node ) ] ;
Buggy code:
if ( userIdByLAS2PeerId == null ) { int userId = dalFacade . createUser ( User . geBuilder ( agent . getEmail ( ) ) . admin ( false ) . las2peerId ( agent . getId ( ) ) . userName ( agent . getLoginName ( ) ) . profileImage ( profileImage ) . build ( ) ) ; <START_BUG> dalFacade . addUserToRole ( userId , "LoggedInUser" , null ) ; <END_BUG>

Fix:
dalFacade . addUserToRole ( userId , "SystemAdmin" , null ) ;
Buggy code:
public class GainAbilitySourceEffect extends ContinuousEffectImpl implements SourceEffect { protected Ability ability ; private boolean onCard ; public GainAbilitySourceEffect ( Ability ability ) { } public GainAbilitySourceEffect ( Ability ability , Duration duration ) { } public GainAbilitySourceEffect ( Ability ability , Duration duration , boolean onCard ) { } public GainAbilitySourceEffect ( Ability ability , Duration duration , boolean onCard , boolean noStaticText ) { } public GainAbilitySourceEffect ( final GainAbilitySourceEffect effect ) { } @ Override public GainAbilitySourceEffect copy ( ) { } @ Override public void init ( Ability source , Game game ) { } @ Override public boolean apply ( Game game , Ability source ) { if ( onCard ) { Card card ; if ( affectedObjectsSet ) { card = affectedObjectList . get ( 0 ) . getCard ( game ) ; } else { card = game . getCard ( source . getSourceId ( ) ) ; } if ( card != null ) { card . addAbility ( ability ) ; discard ( ) ; return true ; } } else { Permanent permanent ; if ( affectedObjectsSet ) { permanent = affectedObjectList . get ( 0 ) . getPermanent ( game ) ; } else { permanent = game . getPermanent ( source . getSourceId ( ) ) ; } if ( permanent != null ) { <START_BUG> permanent . addAbility ( ability , source . getSourceId ( ) , game ) ; <END_BUG> return true ; } } if ( duration . equals ( Custom ) ) { this . discard ( ) ; } return true ; } }

Fix:
permanent . addAbility ( ability , source . getSourceId ( ) , game , false ) ;
Buggy code:
public class DurationAssertion extends AbstractScopedAssertion implements Serializable , Assertion { private static final long serialVersionUID = 240L ; public static final String DURATION_KEY = "DurationAssertion.duration" ; public AssertionResult getResult ( SampleResult response ) { AssertionResult result = new AssertionResult ( getName ( ) ) ; result . setFailure ( false ) ; long duration = getAllowedDuration ( ) ; if ( duration > 0 ) { long responseTime = response . getTime ( ) ; if ( responseTime > duration ) { result . setFailure ( true ) ; <START_BUG> Object [ ] arguments = new Object [ ] { new Long ( responseTime ) , new Long ( duration ) } ; <END_BUG> String message = MessageFormat . format ( JMeterUtils . getResString ( "duration_assertion_failure" ) , arguments ) ; result . setFailureMessage ( message ) ; } } return result ; } private long getAllowedDuration ( ) { } }

Fix:
Object [ ] arguments = new Object [ ] { Long . valueOf ( responseTime ) , Long . valueOf ( duration ) } ;