nus-yam/ex-repair huggingface dataset:
Buggy code:
@ Controller public class EventsController { @ Autowired EventService eventService ; @ Autowired UserService userService ; @ Autowired CityService cityService ; @ Autowired CountryService countryService ; @ Autowired GameService gameService ; @ RequestMapping ( "//allEventsDTO" ) @ ResponseBody public List < EventsDTO > getAllEvents ( ) { } @ RequestMapping ( "//allEvents" ) @ ResponseBody public List < Event > findAllEvents ( ) { } @ RequestMapping ( value = { "//getEventDTO" } , method = RequestMethod . GET ) @ ResponseBody public EventsDTO getEventDTO ( @ RequestParam ( "id" ) Integer id ) { } <START_BUG> @ RequestMapping ( value = "//deleteUserGame//{id}" , method = RequestMethod . DELETE ) <END_BUG> public void deleteEvent ( @ PathVariable Integer id ) { eventService . deleteEvent ( id ) ; } }

Fix:
@ RequestMapping ( value = "//cancelEvent//{id}" , method = RequestMethod . DELETE )
Buggy code:
public class TableTest extends CleanupHelper { private static final String KEY2 = "key2" ; private static final String TEST_KEY = "key1" ; interface Runner { public void run ( ) throws Exception { } } private void reTest ( ColumnFamilyStore cfs , TableTest . Runner verify ) throws Exception { } @ Test public void testOpen ( ) throws Throwable { } @ Test public void testGetRowNoColumns ( ) throws Throwable { } @ Test public void testGetRowSingleColumn ( ) throws Throwable { } @ Test public void testGetRowSliceByRange ( ) throws Throwable { } @ Test public void testGetSliceNoMatch ( ) throws Throwable { } private void validateGetSliceNoMatch ( Table table ) throws IOException { } @ Test public void testGetSliceFromBasic ( ) throws Throwable { } @ Test public void testGetSliceFromAdvanced ( ) throws Throwable { } @ Test public void testGetSliceFromLarge ( ) throws Throwable { Table table = Table . open ( "Keyspace1" ) ; ColumnFamilyStore cfStore = table . getColumnFamilyStore ( "Standard1" ) ; String key = "row3" ; RowMutation rm = new RowMutation ( "Keyspace1" , key ) ; ColumnFamily cf = ColumnFamily . create ( "Keyspace1" , "Standard1" ) ; for ( int i = 1000 ; i < 2000 ; i ++ ) cf . addColumn ( Util . column ( ( "col" + i ) , ( "v" + i ) , 1L ) ) ; rm . add ( cf ) ; rm . apply ( ) ; cfStore . forceBlockingFlush ( ) ; validateSliceLarge ( cfStore ) ; if ( ( cfStore . getSSTables ( ) . size ( ) ) > 1 ) { <START_BUG> cfStore . doCompaction ( cfStore . getSSTables ( ) . size ( ) ) ; <END_BUG> } SSTableReader sstable = cfStore . getSSTables ( ) . iterator ( ) . next ( ) ; long position = sstable . getPosition ( key ) ; BufferedRandomAccessFile file = new BufferedRandomAccessFile ( sstable . getFilename ( ) , "r" ) ; file . seek ( position ) ; assert file . readUTF ( ) . equals ( key ) ; file . readInt ( ) ; IndexHelper . skipBloomFilter ( file ) ; ArrayList < IndexHelper . IndexInfo > indexes = IndexHelper . deserializeIndex ( file ) ; assert ( indexes . size ( ) ) > 2 ; validateSliceLarge ( cfStore ) ; } private void validateSliceLarge ( ColumnFamilyStore cfStore ) throws IOException { } @ Test public void testGetSliceFromSuperBasic ( ) throws Throwable { } public static void assertColumns ( ColumnFamily cf , String ... columnNames ) { } }

Fix:
cfStore . doCompaction ( 2 , cfStore . getSSTables ( ) . size ( ) ) ;
Buggy code:
public class WebRequestCycle extends RequestCycle { public static final String resourceReferencePrefix = "//resources//" ; private static final Log log = LogFactory . getLog ( WebRequestCycle . class ) ; public WebRequestCycle ( final WebSession session , final WebRequest request , final Response response ) { } public WebRequest getWebRequest ( ) { } public WebResponse getWebResponse ( ) { } protected final boolean parseRequest ( ) { } protected void redirectTo ( final Page page ) throws ServletException { } protected StringBuffer urlPrefix ( ) { } final void setFormComponentValuesFromCookies ( final Page page ) { } private boolean bookmarkablePage ( ) { } private boolean callDispatchedComponentListener ( ) { } private boolean callComponentListener ( ) { } private boolean homePage ( ) { } private void invokeInterface ( final Component component , final Method method ) { } private void invokeInterface ( final Page page , final String path , final String interfaceName ) { setInvokePage ( page ) ; <START_BUG> final Component component = page . get ( Strings . afterFirstPathComponent ( path , '.' ) ) ; <END_BUG> if ( component != null ) { Method method = getRequestInterfaceMethod ( interfaceName ) ; if ( method != null ) { setResponsePage ( page ) ; if ( ! ( interfaceName . equals ( "IRedirectListener" ) ) ) { page . getFeedbackMessages ( ) . clear ( ) ; ApplicationSettings . RenderStrategy strategy = getSession ( ) . getApplication ( ) . getSettings ( ) . getRenderStrategy ( ) ; boolean issueRedirect = ( strategy == ( ApplicationSettings . REDIRECT_TO_RENDER ) ) || ( strategy == ( ApplicationSettings . REDIRECT_TO_BUFFER ) ) ; setRedirect ( issueRedirect ) ; } invokeInterface ( component , method ) ; setFormComponentValuesFromCookies ( page ) ; } else { throw new WicketRuntimeException ( ( "Attempt<seq2seq4repair_space>to<seq2seq4repair_space>access<seq2seq4repair_space>unknown<seq2seq4repair_space>interface<seq2seq4repair_space>" + interfaceName ) ) ; } } else { WebRequestCycle . log . error ( ( "No<seq2seq4repair_space>component<seq2seq4repair_space>found<seq2seq4repair_space>for<seq2seq4repair_space>" + path ) ) ; setResponsePage ( newPage ( application . getPages ( ) . getInternalErrorPage ( ) ) ) ; } } private final Page newPage ( final Class pageClass ) { } private void onExpiredPage ( ) { } private boolean resourceReference ( ) { } private boolean staticContent ( ) { } }

Fix:
final Component component = page . get ( Strings . afterFirstPathComponent ( path , ':' ) ) ;
Buggy code:
public class RespawnTestCase { private static final int TIMEOUT = 15000 ; private static final String HOST_CONTROLLER = "host-controller" ; private static final String PROCESS_CONTROLLER = "process" ; private static final String SERVER_ONE = "respawn-one" ; private static final String SERVER_TWO = "respawn-two" ; private static final int HC_PORT = 9999 ; static ProcessController processController ; static RespawnTestCase . ProcessUtil processUtil ; @ BeforeClass public static void createProcessController ( ) throws IOException , URISyntaxException { } @ AfterClass public static void destroyProcessController ( ) { } @ Test public void testDomainRespawn ( ) throws Exception { } private void readHostControllerServers ( ) throws Exception { } private boolean lookupServerInModel ( String host , String server ) throws Exception { } private ModelNode getHostControllerServerAddress ( String host , String server ) { } private List < RespawnTestCase . RunningProcess > waitForAllProcesses ( ) throws Exception { } private abstract static class ProcessUtil { List < String > initialProcessIds ; ProcessUtil ( ) { } List < String > getInitialProcessIds ( ) { } String parseProcessId ( String proc ) { } List < RespawnTestCase . RunningProcess > getRunningProcesses ( ) { } List < String > listProcesses ( ) { } void killProcess ( RespawnTestCase . RunningProcess process ) { } abstract String getJpsCommand ( ) { } abstract String getJavaCommand ( ) { } abstract String getKillCommand ( RespawnTestCase . RunningProcess process ) ; private boolean containsProcesses ( List < RespawnTestCase . RunningProcess > runningProcesses , String ... names ) { } private RespawnTestCase . RunningProcess getProcess ( List < RespawnTestCase . RunningProcess > runningProcesses , String name ) { } private RespawnTestCase . RunningProcess getProcessById ( List < RespawnTestCase . RunningProcess > runningProcesses , String id ) { } } private static class UnixProcessUtil extends RespawnTestCase . ProcessUtil { @ Override String getJpsCommand ( ) { } @ Override String getJavaCommand ( ) { } @ Override String getKillCommand ( RespawnTestCase . RunningProcess process ) { return "kill<seq2seq4repair_space>-9<seq2seq4repair_space>" + ( process . getProcessId ( ) ) ; } } private static class WindowsProcessUtil extends RespawnTestCase . ProcessUtil { @ Override String getJpsCommand ( ) { } @ Override String getJavaCommand ( ) { } @ Override String getKillCommand ( RespawnTestCase . RunningProcess process ) { <START_BUG> return "taskkill<seq2seq4repair_space>//pid<seq2seq4repair_space>" + ( process . getProcessId ( ) ) ; <END_BUG> } } private static class RunningProcess { final String processId ; final String process ; private RunningProcess ( String processId , String process ) { } public String getProcessId ( ) { } public String getProcess ( ) { } @ Override public String toString ( ) { } } }

Fix:
return "taskkill<seq2seq4repair_space>//f<seq2seq4repair_space>//pid<seq2seq4repair_space>" + ( process . getProcessId ( ) ) ;
Buggy code:
public class TestRollingUpdates extends LuceneTestCase { @ Test public void testRollingUpdates ( ) throws Exception { } public void testUpdateSameDoc ( ) throws Exception { } static class IndexingThread extends Thread { final LineFileDocs docs ; final IndexWriter writer ; final int num ; public IndexingThread ( LineFileDocs docs , IndexWriter writer , int num ) { } public void run ( ) { try { DirectoryReader open = null ; for ( int i = 0 ; i < ( num ) ; i ++ ) { Document doc = new Document ( ) ; <START_BUG> doc . add ( newField ( "id" , "test" , TYPE_UNSTORED ) ) ; <END_BUG> writer . updateDocument ( new Term ( "id" , "test" ) , doc ) ; if ( ( random ( ) . nextInt ( 3 ) ) == 0 ) { if ( open == null ) { open = DirectoryReader . open ( writer , true ) ; } DirectoryReader reader = DirectoryReader . openIfChanged ( open ) ; if ( reader != null ) { open . close ( ) ; open = reader ; } assertEquals ( ( ( ( ( ( ( ( "iter:<seq2seq4repair_space>" + i ) + "<seq2seq4repair_space>numDocs:<seq2seq4repair_space>" ) + ( open . numDocs ( ) ) ) + "<seq2seq4repair_space>del:<seq2seq4repair_space>" ) + ( open . numDeletedDocs ( ) ) ) + "<seq2seq4repair_space>max:<seq2seq4repair_space>" ) + ( open . maxDoc ( ) ) ) , 1 , open . numDocs ( ) ) ; } } if ( open != null ) { open . close ( ) ; } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } } }

Fix:
doc . add ( newStringField ( "id" , "test" , NO ) ) ;
Buggy code:
public class UserGet extends BaseRequestHandler { @ Inject public UserGet ( final UserRepository userRepository , final WorkspaceRepository workspaceRepository , final Configuration configuration ) { } @ Override public void handle ( HttpServletRequest request , HttpServletResponse response , HandlerChain chain ) throws Exception { String userName = getRequiredParameter ( request , "user-name" ) ; User user = this . getUserRepository ( ) . findByUsername ( userName ) ; if ( user == null ) { respondWithNotFound ( response ) ; return ; } <START_BUG> Authorizations authorizations = getAuthorizations ( request , user ) ; <END_BUG> ClientApiUser clientApiUser = getUserRepository ( ) . toClientApiPrivate ( user ) ; Iterable < Workspace > workspaces = getWorkspaceRepository ( ) . findAllForUser ( user ) ; for ( Workspace workspace : workspaces ) { clientApiUser . getWorkspaces ( ) . add ( getWorkspaceRepository ( ) . toClientApi ( workspace , user , false , authorizations ) ) ; } respondWithClientApiObject ( response , clientApiUser ) ; } }

Fix:
Authorizations authorizations = getUserRepository ( ) . getAuthorizations ( user ) ;
Buggy code:
public class TestPlan extends AbstractTestElement implements Serializable { public static final String THREAD_GROUPS = "TestPlan.thread_groups" ; public static final String FUNCTIONAL_MODE = "TestPlan.functional_mode" ; public static final String USER_DEFINED_VARIABLES = "TestPlan.user_defined_variables" ; private List threadGroups = new LinkedList ( ) ; private List configs = new LinkedList ( ) ; private static List itemsCanAdd = new LinkedList ( ) ; private static TestPlan plan ; private Map userDefinedVariables = new HashMap ( ) ; public TestPlan ( ) { } public boolean isFunctionalMode ( ) { } public void setUserDefinedVariables ( Arguments vars ) { } public Map getUserDefinedVariables ( ) { } private Arguments getVariables ( ) { } public void setFunctionalMode ( boolean funcMode ) { } public TestPlan ( String name ) { } public void addParameter ( String name , String value ) { } public static TestPlan createTestPlan ( String name ) { } public void addTestElement ( TestElement tg ) { super . addTestElement ( tg ) ; <START_BUG> if ( tg instanceof ThreadGroup ) { <END_BUG> addThreadGroup ( ( ( ThreadGroup ) ( tg ) ) ) ; } } public void addJMeterComponent ( TestElement child ) { } public Collection getThreadGroups ( ) { } public void addConfigElement ( ConfigElement c ) { } public void addThreadGroup ( ThreadGroup group ) { } }

Fix:
if ( ( tg instanceof ThreadGroup ) && ( ! ( isRunningVersion ( ) ) ) ) {
Buggy code:
public class MockServletContextTests { private final MockServletContext sc = new MockServletContext ( "org//springframework//mock" ) ; @ Test public void listFiles ( ) { } @ Test public void listSubdirectories ( ) { } @ Test public void listNonDirectory ( ) { } @ Test public void listInvalidPath ( ) { } @ Test public void registerContextAndGetContext ( ) { } @ Test public void getMimeType ( ) { } @ Test public void getMimeTypeWithCustomConfiguredType ( ) { <START_BUG> FileTypeMap defaultFileTypeMap = MimetypesFileTypeMap . getDefaultFileTypeMap ( ) ; <END_BUG> assertThat ( defaultFileTypeMap , instanceOf ( MimetypesFileTypeMap . class ) ) ; MimetypesFileTypeMap mimetypesFileTypeMap = ( ( MimetypesFileTypeMap ) ( defaultFileTypeMap ) ) ; mimetypesFileTypeMap . addMimeTypes ( "text//enigma<seq2seq4repair_space>enigma" ) ; assertEquals ( "text//enigma" , sc . getMimeType ( "filename.enigma" ) ) ; } @ Test public void servletVersion ( ) { } @ Test public void registerAndUnregisterNamedDispatcher ( ) throws Exception { } @ Test public void getNamedDispatcherForDefaultServlet ( ) throws Exception { } @ Test public void setDefaultServletName ( ) throws Exception { } }

Fix:
FileTypeMap defaultFileTypeMap = FileTypeMap . getDefaultFileTypeMap ( ) ;
Buggy code:
public class SharedResourceRequestTarget implements ISharedResourceRequestTarget { private final String resourceKey ; public SharedResourceRequestTarget ( String resourceKey ) { } public void respond ( RequestCycle requestCycle ) { } public void cleanUp ( RequestCycle requestCycle ) { } public final String getResourceKey ( ) { } public boolean equals ( Object obj ) { } public int hashCode ( ) { } public String toString ( ) { <START_BUG> return resourceKey ; <END_BUG> } }

Fix:
return ( ( ( "SharedResourceRequestTarget@" + ( hashCode ( ) ) ) + "{" ) + ( resourceKey ) ) + "}" ;
Buggy code:
public class BossWave extends AbstractWave { private MACreature boss ; private LivingEntity bossCreature ; private List < BossAbility > abilities ; private Set < Creature > adds ; private BossHealth bossHealth ; private int healthAmount ; private int abilityTask ; private int abilityInterval ; private boolean lowHealthAnnounced = false ; private boolean abilityAnnounce ; public BossWave ( Arena arena , String name , int wave , int frequency , int priority , Configuration config , String path ) { } public BossWave ( Arena arena , String name , int wave , Configuration config , String path ) { } private void load ( Configuration config , String path ) { } public void spawn ( int wave ) { MAUtils . tellAll ( getArena ( ) , WAVE_BOSS , ( "" + wave ) ) ; bossCreature = boss . spawn ( getArena ( ) , getWorld ( ) , getArena ( ) . getBossSpawnpoint ( ) ) ; if ( ( bossCreature ) instanceof Creature ) ( ( Creature ) ( bossCreature ) ) . setTarget ( MAUtils . getClosestPlayer ( bossCreature , getArena ( ) ) ) ; getArena ( ) . addMonster ( bossCreature ) ; getArena ( ) . setBossWave ( this ) ; <START_BUG> bossCreature . setHealth ( 200 ) ; <END_BUG> healthAmount = bossHealth . getAmount ( getArena ( ) . getPlayerCount ( ) ) ; startAbilityTasks ( ) ; } private void startAbilityTasks ( ) { } public void cancelAbilityTask ( ) { } public void clear ( ) { } public void addAbility ( BossAbility ability ) { } public void addAdds ( Creature creature ) { } public LivingEntity getEntity ( ) { } public int getHealth ( ) { } public void setHealth ( int healthAmount ) { } public void subtractHealth ( int amount ) { } public boolean isLowHealthAnnounced ( ) { } public void setLowHealthAnnounced ( boolean value ) { } }

Fix:
bossCreature . setHealth ( bossCreature . getMaxHealth ( ) ) ;
Buggy code:
public class AnnotationParser { Scanner scanner ; Parser sourceParser ; Annotation annotation ; int startPosition ; int currentPosition ; char currentCharacter ; AnnotationParser ( Parser sourceParser ) { } public boolean checkDeprecation ( int annotationStart , int annotationEnd ) { char [ ] source = this . scanner . source ; boolean foundDeprecated = false ; <START_BUG> if ( this . sourceParser . checkAnnotation ) { <END_BUG> this . annotation = new Annotation ( annotationStart , annotationEnd ) ; } else { this . annotation = null ; } int firstLineNumber = this . scanner . getLineNumber ( annotationStart ) ; int lastLineNumber = this . scanner . getLineNumber ( annotationEnd ) ; int [ ] index = new int [ ] { 0 } ; nextLine : for ( int line = firstLineNumber ; line <= lastLineNumber ; line ++ ) { int lineStart = this . scanner . getLineStart ( line ) ; if ( line == firstLineNumber ) lineStart = annotationStart + 3 ; int lineEnd = this . scanner . getLineEnd ( line ) ; if ( line == lastLineNumber ) lineEnd = annotationEnd - 2 ; index [ 0 ] = lineStart ; boolean foundStar = false ; while ( ( index [ 0 ] ) < lineEnd ) { char nextCharacter = getNextCharacter ( source , index ) ; switch ( nextCharacter ) { case '@' : if ( ( this . annotation ) == null ) { if ( ( ( ( ( ( ( ( ( ( ( getNextCharacter ( source , index ) ) == 'd' ) && ( ( getNextCharacter ( source , index ) ) == 'e' ) ) && ( ( getNextCharacter ( source , index ) ) == 'p' ) ) && ( ( getNextCharacter ( source , index ) ) == 'r' ) ) && ( ( getNextCharacter ( source , index ) ) == 'e' ) ) && ( ( getNextCharacter ( source , index ) ) == 'c' ) ) && ( ( getNextCharacter ( source , index ) ) == 'a' ) ) && ( ( getNextCharacter ( source , index ) ) == 't' ) ) && ( ( getNextCharacter ( source , index ) ) == 'e' ) ) && ( ( getNextCharacter ( source , index ) ) == 'd' ) ) { nextCharacter = getNextCharacter ( source , index ) ; if ( ( Character . isWhitespace ( nextCharacter ) ) || ( nextCharacter == '*' ) ) { foundDeprecated = true ; break nextLine ; } } continue nextLine ; } continue nextLine ; case '*' : if ( foundStar ) continue nextLine ; foundStar = true ; break ; default : if ( ! ( CharOperation . isWhitespace ( nextCharacter ) ) ) continue nextLine ; } } } return foundDeprecated ; } protected char getNextCharacter ( char [ ] source , int [ ] index ) { } char [ ] readIdentifier ( ) { } void saveScannerState ( ) { } void loadScannerState ( ) { } }

Fix:
if ( false ) {
Buggy code:
class RemoveFromIndex extends IndexRequest { String resourceName ; public RemoveFromIndex ( String resourceName , IPath containerPath , IndexManager manager ) { } public boolean execute ( IProgressMonitor progressMonitor ) { if ( ( this . isCancelled ) || ( ( progressMonitor != null ) && ( progressMonitor . isCanceled ( ) ) ) ) return true ; <START_BUG> Index index = manager . getIndex ( this . containerPath , true , false ) ; <END_BUG> if ( index == null ) return true ; ReadWriteMonitor monitor = index . monitor ; if ( monitor == null ) return true ; try { monitor . enterWrite ( ) ; index . remove ( resourceName ) ; } finally { monitor . exitWrite ( ) ; } return true ; } public String toString ( ) { } }

Fix:
Index index = this . manager . getIndex ( this . containerPath , true , false ) ;
Buggy code:
public class AjState { AjBuildManager buildManager ; long lastSuccessfulBuildTime = - 1 ; long currentBuildTime = - 1 ; AjBuildConfig buildConfig ; AjBuildConfig newBuildConfig ; Map resultsFromFile = new HashMap ( ) ; Map references = new HashMap ( ) ; Map binarySourceFiles = new HashMap ( ) ; Map classesFromName = new HashMap ( ) ; List compiledSourceFiles = new ArrayList ( ) ; List resources = new ArrayList ( ) ; ArrayList qualifiedStrings ; ArrayList simpleStrings ; Set addedFiles ; Set deletedFiles ; List addedClassFiles ; public AjState ( AjBuildManager buildManager ) { } void successfulCompile ( AjBuildConfig config ) { } boolean prepareForNextBuild ( AjBuildConfig newBuildConfig ) { } private Collection getModifiedFiles ( ) { } Collection getModifiedFiles ( long lastBuildTime ) { } public List getFilesToCompile ( boolean firstPass ) { } private void deleteClassFiles ( ) { } private void deleteResources ( ) { List oldResources = new ArrayList ( ) ; oldResources . addAll ( resources ) ; for ( Iterator i = buildConfig . getInpath ( ) . iterator ( ) ; i . hasNext ( ) ; ) { File inPathElement = ( ( File ) ( i . next ( ) ) ) ; <START_BUG> if ( inPathElement . isDirectory ( ) ) { <END_BUG> deleteResourcesFromDirectory ( inPathElement , oldResources ) ; } } if ( ( buildConfig . getSourcePathResources ( ) ) != null ) { for ( Iterator i = buildConfig . getSourcePathResources ( ) . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String resource = ( ( String ) ( i . next ( ) ) ) ; maybeDeleteResource ( resource , oldResources ) ; } } for ( Iterator iter = oldResources . iterator ( ) ; iter . hasNext ( ) ; ) { String victim = ( ( String ) ( iter . next ( ) ) ) ; File f = new File ( buildConfig . getOutputDir ( ) , victim ) ; if ( f . exists ( ) ) { f . delete ( ) ; } resources . remove ( victim ) ; } } private void maybeDeleteResource ( String resName , List oldResources ) { } private void deleteResourcesFromDirectory ( File dir , List oldResources ) { } private void deleteClassFile ( UnwovenClassFile classFile ) { } public void noteResult ( InterimCompilationResult result ) { } private UnwovenClassFile removeFromPreviousIfPresent ( UnwovenClassFile cf , InterimCompilationResult previous ) { } private void recordClassFile ( UnwovenClassFile thisTime , UnwovenClassFile lastTime ) { } private static StringSet makeStringSet ( List strings ) { } protected void addAffectedSourceFiles ( List addTo , List lastTimeSources ) { } protected void addDependentsOf ( String qualifiedTypeName ) { } protected void addDependentsOf ( File sourceFile ) { } }

Fix:
if ( ( inPathElement . isDirectory ( ) ) && ( AjBuildManager . COPY_INPATH_DIR_RESOURCES ) ) {
Buggy code:
public class AggregateNotificationTest { private AggregateNotification tested = new AggregateNotification ( ) ; private List < ProjectJson > projects = Lists . newArrayList ( ) ; private Multimap < String , CollectorNotificationJson > projectNameToItems = HashMultimap . create ( ) ; @ Test public void testNoItems ( ) { } @ Test public void testNoItemsWithConfiguredProject_shouldNotSend ( ) { } @ Test public void testOneItems ( ) { } @ Test public void testOneItemsButWillNotSend_ScopeIsHourly ( ) { } @ Test public void testOneItemsWillSend_ScopeIsDaily ( ) { } @ Test public void testWillNotSendImmediatlyWhenDailyCalled ( ) { } @ Test public void testTwoItemsForTwoProjects ( ) { } private MailPolicyJson createPolicy ( ProjectJson projectJson , String user ) { } private MailPolicyJson createPolicy ( ProjectJson projectJson , String user , AlertsCollectionType intensity ) { } private CollectorNotificationJson createNotification ( ProjectJson projectJson ) { <START_BUG> CollectorNotificationJson value = new CollectorNotificationJson ( null , projectJson . name ( ) , null , null , null , null , 0 , null , false , 1 ) ; <END_BUG> projectNameToItems . put ( projectJson . name ( ) , value ) ; return value ; } private ProjectJson createProject ( String projectName ) { } }

Fix:
CollectorNotificationJson value = new CollectorNotificationJson ( null , projectJson . name ( ) , "node" , "node" , null , null , null , 0 , null , false , 1 ) ;
Buggy code:
@ RunWith ( Arquillian . class ) public class NonTransactionalEmTestCase { private static final String persistence_xml = "<?xml<seq2seq4repair_space>version=\"1.0\"<seq2seq4repair_space>encoding=\"UTF-8\"?><seq2seq4repair_space>" + ( ( ( ( ( ( ( ( "<persistence<seq2seq4repair_space>xmlns=\"http:////java.sun.com//xml//ns//persistence\"<seq2seq4repair_space>version=\"1.0\">" + "<seq2seq4repair_space><persistence-unit<seq2seq4repair_space>name=\"mypc\">" ) + "<seq2seq4repair_space><description>Persistence<seq2seq4repair_space>Unit." ) + "<seq2seq4repair_space><//description>" ) + "<seq2seq4repair_space><jta-data-source>java://H2DS<//jta-data-source>" ) + "<properties><seq2seq4repair_space><property<seq2seq4repair_space>name=\"hibernate.hbm2ddl.auto\"<seq2seq4repair_space>value=\"create-drop\"//>" ) + "<//properties>" ) + "<seq2seq4repair_space><//persistence-unit>" ) + "<//persistence>" ) ; @ Deployment public static WebArchive deployment ( ) { WebArchive war = ShrinkWrap . create ( WebArchive . class , "NonTransactionalEmTestCase.war" ) ; war . addClasses ( HttpRequest . class , SimpleServlet . class , Employee . class ) ; <START_BUG> war . addAsResource ( new StringAsset ( NonTransactionalEmTestCase . persistence_xml ) , "WEB-INF//classes//META-INF//persistence.xml" ) ; <END_BUG> return war ; } private static String performCall ( String urlPattern , String param ) throws Exception { } @ Test public void testEcho ( ) throws Exception { } }

Fix:
war . addAsResource ( new StringAsset ( NonTransactionalEmTestCase . persistence_xml ) , "META-INF//persistence.xml" ) ;
Buggy code:
public class TagInvocationLineParser { public Tag parse ( String line ) { Tag tag = new Tag ( ) ; for ( int i = 0 ; i < ( line . length ( ) ) ; i ++ ) { char c = line . charAt ( i ) ; if ( ( ( Character . isJavaIdentifierPart ( c ) ) || ( c == '.' ) ) || ( c == '//' ) ) { continue ; } else { if ( ( ( Character . isWhitespace ( c ) ) || ( c == '(' ) ) || ( c == '|' ) ) { tag . tagName = line . substring ( 0 , i ) . replace ( '//' , '.' ) ; if ( tag . tagName . startsWith ( ".." ) ) tag . tagName = tag . tagName . substring ( 1 ) ; line = line . substring ( i ) . trim ( ) ; break ; } else { throw new RuntimeException ( ( ( ( ( "invalid<seq2seq4repair_space>character<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>tag<seq2seq4repair_space>invocation<seq2seq4repair_space>line<seq2seq4repair_space>" + line ) + ":<seq2seq4repair_space>[" ) + c ) + "]" ) ) ; } } } if ( ( tag . tagName ) == null ) { tag . tagName = line . replace ( '//' , '.' ) ; return tag ; } if ( tag . tagName . equals ( "def" ) ) { tag = new Tag . TagDef ( ) ; if ( ! ( line . endsWith ( ")" ) ) ) line += "()" ; <START_BUG> JavaSyntaxTool . isValidMeth ( line ) ; <END_BUG> tag . args = line ; return tag ; } else if ( tag . tagName . equals ( "set" ) ) { tag = new Tag . TagSet ( ) ; tag . args = line ; return tag ; } else if ( tag . tagName . equals ( "get" ) ) { tag . args = line ; return tag ; } try { List < String > args = JavaSyntaxTool . parseArgs ( line ) ; tag . args = StringUtils . join ( args , "," ) ; parseNamedArgs ( tag ) ; } catch ( RuntimeException e ) { int vertline = line . lastIndexOf ( '|' ) ; if ( vertline >= 0 ) { String closureArgs = line . substring ( ( vertline + 1 ) ) . trim ( ) ; JavaSyntaxTool . parseParams ( closureArgs ) ; tag . callbackArgs = closureArgs ; tag . hasBody = true ; line = line . substring ( 0 , vertline ) . trim ( ) ; if ( ( line . length ( ) ) == 0 ) return tag ; else { char firstC = line . charAt ( 0 ) ; char lastC = line . charAt ( ( ( line . length ( ) ) - 1 ) ) ; if ( '(' == firstC ) { if ( ')' != lastC ) { throw new RuntimeException ( "The<seq2seq4repair_space>tag<seq2seq4repair_space>argument<seq2seq4repair_space>part<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>valid:<seq2seq4repair_space>parenthesis<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>paired." ) ; } else { tag . args = line . substring ( 1 , ( ( line . length ( ) ) - 1 ) ) ; } } else { tag . args = line ; } parseNamedArgs ( tag ) ; } } else throw new RuntimeException ( ( "tag<seq2seq4repair_space>args<seq2seq4repair_space>not<seq2seq4repair_space>valid:<seq2seq4repair_space>" + line ) ) ; } return tag ; } private void parseNamedArgs ( Tag tag ) { } }

Fix:
JavaSyntaxTool . isValidMethDecl ( line ) ;
Buggy code:
public class WebComponentPropertyHandler implements IPropertyHandler { private static final Map < IPropertyType < ? > , IPropertyConverter < ? extends Object > > jsonConverters = new HashMap < IPropertyType < ? > , IPropertyConverter < ? extends Object > > ( ) ; private final PropertyDescription propertyDescription ; public WebComponentPropertyHandler ( PropertyDescription propertyDescription ) { } @ Override public String getName ( ) { } @ Override public boolean isProperty ( ) { } @ Override public PropertyDescription getPropertyDescription ( Object obj , IPropertySource propertySource , PersistContext persistContext ) { } @ Override public String getDisplayName ( ) { } @ Override public boolean hasSupportForClientType ( Object obj , ClientSupport csp ) { } @ Override public Object getValue ( Object obj , PersistContext persistContext ) { Object value = null ; Bean bean = ( ( Bean ) ( obj ) ) ; try { String json = bean . getBeanXML ( ) ; if ( json != null ) { value = new ServoyJSONObject ( json , false ) . opt ( getName ( ) ) ; } } catch ( JSONException e ) { ServoyLog . logError ( e ) ; } IPropertyType < ? > type = propertyDescription . getType ( ) ; if ( type == ( FoundsetPropertyType . INSTANCE ) ) { return value ; } if ( ( ( ( type == ( FunctionPropertyType . INSTANCE ) ) || ( type == ( ServoyFunctionPropertyType . INSTANCE ) ) ) || ( type == ( ValueListPropertyType . INSTANCE ) ) ) || ( type == ( FormPropertyType . INSTANCE ) ) ) { if ( value == null ) return Integer . valueOf ( 0 ) ; if ( value instanceof Integer ) return value ; IPersist persist = ModelUtils . getEditingFlattenedSolution ( bean , persistContext . getContext ( ) ) . searchPersist ( UUID . fromString ( ( ( String ) ( value ) ) ) ) ; if ( persist instanceof AbstractBase ) { return new Integer ( persist . getID ( ) ) ; } return Integer . valueOf ( ( - 1 ) ) ; } if ( value == null ) { if ( ( propertyDescription . getDefaultValue ( ) ) != null ) { return propertyDescription . getDefaultValue ( ) ; } <START_BUG> return type . defaultValue ( ) ; <END_BUG> } else { IPropertyConverter < Object > converter = ( ( IPropertyConverter < Object > ) ( WebComponentPropertyHandler . jsonConverters . get ( type ) ) ) ; if ( converter != null ) { if ( ( value instanceof String ) && ( ( ( String ) ( value ) ) . startsWith ( "{" ) ) ) { try { value = converter . fromJSON ( new JSONObject ( ( ( String ) ( value ) ) ) , null , null ) ; } catch ( Exception e ) { Debug . error ( ( ( ( "can't<seq2seq4repair_space>parse<seq2seq4repair_space>'" + value ) + "'<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>real<seq2seq4repair_space>type<seq2seq4repair_space>for<seq2seq4repair_space>property<seq2seq4repair_space>converter:<seq2seq4repair_space>" ) + type ) , e ) ; } } else { value = converter . fromJSON ( value , null , null ) ; } } } return value ; } @ Override public void setValue ( Object obj , Object value , PersistContext persistContext ) { } public boolean shouldShow ( Object obj ) { } }

Fix:
return type . defaultValue ( propertyDescription ) ;
Buggy code:
public class HtmlHeaderContainer extends TransparentWebMarkupContainer { private static final long serialVersionUID = 1L ; private transient Map < String , List < String > > renderedComponentsPerScope ; private transient IHeaderResponse headerResponse = null ; public HtmlHeaderContainer ( final String id ) { } @ Override protected final void onComponentTagBody ( MarkupStream markupStream , ComponentTag openTag ) { } protected boolean renderOpenAndCloseTags ( ) { } public boolean okToRenderComponent ( final String scope , final String id ) { } @ Override protected void onDetach ( ) { } protected IHeaderResponse newHeaderResponse ( ) { } public IHeaderResponse getHeaderResponse ( ) { if ( ( headerResponse ) == null ) { <START_BUG> headerResponse = newHeaderResponse ( ) ; <END_BUG> } return headerResponse ; } @ Override public IMarkupFragment getMarkup ( ) { } }

Fix:
headerResponse = getApplication ( ) . decorateHeaderResponse ( newHeaderResponse ( ) ) ;
Buggy code:
public class TestAuthManager extends JMeterTestCase { public TestAuthManager ( String name ) { } public void testHttp ( ) throws Exception { } public void testHttps ( ) throws Exception { } public void testFile ( ) throws Exception { AuthManager am = new AuthManager ( ) ; CollectionProperty ao = am . getAuthObjects ( ) ; assertEquals ( 0 , ao . size ( ) ) ; <START_BUG> am . addFile ( "testfiles//TestAuth.txt" ) ; <END_BUG> assertEquals ( 9 , ao . size ( ) ) ; Authorization at ; at = am . getAuthForURL ( new URL ( "http:////a.b.c//" ) ) ; assertEquals ( "login" , at . getUser ( ) ) ; assertEquals ( "password" , at . getPass ( ) ) ; at = am . getAuthForURL ( new URL ( "http:////a.b.c:80//" ) ) ; assertEquals ( "login" , at . getUser ( ) ) ; assertEquals ( "password" , at . getPass ( ) ) ; at = am . getAuthForURL ( new URL ( "http:////a.b.c:443//" ) ) ; assertNull ( at ) ; at = am . getAuthForURL ( new URL ( "http:////a.b.c//1" ) ) ; assertEquals ( "login1" , at . getUser ( ) ) ; assertEquals ( "password1" , at . getPass ( ) ) ; assertEquals ( "" , at . getDomain ( ) ) ; assertEquals ( "" , at . getRealm ( ) ) ; at = am . getAuthForURL ( new URL ( "http:////d.e.f//" ) ) ; assertEquals ( "user" , at . getUser ( ) ) ; assertEquals ( "pass" , at . getPass ( ) ) ; assertEquals ( "domain" , at . getDomain ( ) ) ; assertEquals ( "realm" , at . getRealm ( ) ) ; at = am . getAuthForURL ( new URL ( "https:////j.k.l//" ) ) ; assertEquals ( "jkl" , at . getUser ( ) ) ; assertEquals ( "pass" , at . getPass ( ) ) ; at = am . getAuthForURL ( new URL ( "https:////j.k.l:443//" ) ) ; assertEquals ( "jkl" , at . getUser ( ) ) ; assertEquals ( "pass" , at . getPass ( ) ) ; at = am . getAuthForURL ( new URL ( "https:////l.m.n//" ) ) ; assertEquals ( "lmn443" , at . getUser ( ) ) ; assertEquals ( "pass" , at . getPass ( ) ) ; at = am . getAuthForURL ( new URL ( "https:////l.m.n:443//" ) ) ; assertEquals ( "lmn443" , at . getUser ( ) ) ; assertEquals ( "pass" , at . getPass ( ) ) ; at = am . getAuthForURL ( new URL ( "https:////l.m.n:8443//" ) ) ; assertEquals ( "lmn8443" , at . getUser ( ) ) ; assertEquals ( "pass" , at . getPass ( ) ) ; } }

Fix:
am . addFile ( findTestPath ( "testfiles//TestAuth.txt" ) ) ;
Buggy code:
final class HandlerChainRemove extends AbstractRemoveStepHandler { static final HandlerChainRemove INSTANCE = new HandlerChainRemove ( ) ; private HandlerChainRemove ( ) { } @ Override protected void performRuntime ( final OperationContext context , final ModelNode operation , final ModelNode model ) throws OperationFailedException { final ServerConfig config = PackageUtils . getServerConfig ( context ) ; if ( config != null ) { final PathAddress address = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) ; final PathElement confElem = address . getElement ( ( ( address . size ( ) ) - 2 ) ) ; final String configType = confElem . getKey ( ) ; final String configName = confElem . getValue ( ) ; final String handlerChainType = address . getElement ( ( ( address . size ( ) ) - 1 ) ) . getKey ( ) ; final String handlerChainId = address . getElement ( ( ( address . size ( ) ) - 1 ) ) . getValue ( ) ; for ( final CommonConfig commonConfig : PackageUtils . getConfigs ( config , configType ) ) { if ( configName . equals ( commonConfig . getConfigName ( ) ) ) { final List < UnifiedHandlerChainMetaData > handlerChains ; if ( Constants . PRE_HANDLER_CHAIN . equals ( handlerChainType ) ) { handlerChains = commonConfig . getPreHandlerChains ( ) ; } else if ( Constants . POST_HANDLER_CHAIN . equals ( handlerChainType ) ) { handlerChains = commonConfig . getPostHandlerChains ( ) ; } else { throw WSMessages . MESSAGES . wrongHandlerChainType ( handlerChainType , Constants . PRE_HANDLER_CHAIN , Constants . POST_HANDLER_CHAIN ) ; } final UnifiedHandlerChainMetaData handlerChain = HandlerChainRemove . getChain ( handlerChains , handlerChainId ) ; if ( handlerChain == null ) { throw WSMessages . MESSAGES . missingHandlerChain ( configName , handlerChainType , handlerChainId ) ; } handlerChains . remove ( handlerChain ) ; <START_BUG> context . restartRequired ( ) ; <END_BUG> return ; } } throw WSMessages . MESSAGES . missingConfig ( configName ) ; } } private static UnifiedHandlerChainMetaData getChain ( final List < UnifiedHandlerChainMetaData > handlerChains , final String handlerChainId ) { } }

Fix:
context . reloadRequired ( ) ;
Buggy code:
public class EditorController implements VerifyKeyListener , FocusListener , ModifyListener , MouseListener , VerifyListener { private EditorView editorframe ; private Editor editor ; public EditorController ( Editor editor , EditorView editorframe ) { } public Editor getEditor ( ) { } public EditorView getEditorView ( ) { } @ Override public void modifyText ( ModifyEvent e ) { } @ Override public void verifyText ( VerifyEvent e ) { } @ Override public void verifyKey ( VerifyEvent e ) { } @ Override public void focusGained ( FocusEvent e ) { } @ Override public void mouseDoubleClick ( MouseEvent e ) { if ( ( e . getSource ( ) ) == ( this . editorframe . getLineNumbers ( ) ) ) { int offset = this . editorframe . getLineNumbers ( ) . getCaretOffset ( ) ; int lineCount = this . editorframe . getTextField ( ) . getLineCount ( ) ; <START_BUG> if ( ( ( offset > ( lineCount - 1 ) ) || ( ( this . editorframe . getTextField ( ) . getLine ( offset ) ) == null ) ) || ( ( this . editorframe . getTextField ( ) . getLine ( offset ) . length ( ) ) == 0 ) ) { <END_BUG> this . editorframe . getTextField ( ) . setFocus ( ) ; return ; } this . editorframe . getLineNumbers ( ) . getLineBullet ( this . editorframe . getLineNumbers ( ) . getCaretOffset ( ) ) . style . background = new org . eclipse . swt . graphics . Color ( this . editorframe . getLineNumbers ( ) . getDisplay ( ) , 142 , 189 , 247 ) ; this . editorframe . getLineNumbers ( ) . redraw ( ) ; this . editorframe . getTextField ( ) . setFocus ( ) ; this . editor . addBreakpoint ( ( offset + 1 ) ) ; } } @ Override public void focusLost ( FocusEvent e ) { } @ Override public void mouseDown ( MouseEvent arg0 ) { } @ Override public void mouseUp ( MouseEvent arg0 ) { } }

Fix:
if ( ( ( offset > ( lineCount - 1 ) ) || ( ( this . editorframe . getTextField ( ) . getLine ( offset ) ) == null ) ) || ( ! ( this . editorframe . getTextField ( ) . getLine ( offset ) . contains ( ";" ) ) ) ) {
Buggy code:
public class MailingListIssuesTest extends DummyServerTest { @ Test public void testThatInterceptorIsCalled ( ) throws IOException , InterruptedException { } @ Test public void testThatInterceptorCanCaptureCallingIpAddress ( ) throws IOException , InterruptedException { } @ Test public void testThatWeCanChangeTheUserAgent ( ) throws IOException , InterruptedException { } @ Test public void testThatInterceptorsCanRewriteUrls ( ) throws IOException , InterruptedException { } @ Test public void testThatInterceptorsCanReadResponseBodies ( ) throws IOException , InterruptedException { } @ Test public void testThatProxyCanCaptureBodyInHar ( ) throws IOException , InterruptedException { } @ Test public void testThatProxyCanCaptureJsonRpc ( ) throws IOException , InterruptedException { } @ Test public void testThatTraditionalPostParamsAreCaptured ( ) throws IOException , InterruptedException { } @ Test public void testThatImagesAreCapturedAsBase64EncodedContent ( ) throws IOException , InterruptedException { } @ Test public void testThatUrlEncodedQueryStringIsParsedCorrecty ( ) throws IOException , InterruptedException { } @ Test public void testThatGzippedContentIsProperlyCapturedInHar ( ) throws IOException , InterruptedException { } @ Test @ Ignore public void testThatInterceptorsCanReadPostParamaters ( ) throws IOException , InterruptedException { } @ Test public void issue27 ( ) throws Exception { WebDriver driver = null ; ProxyServer server = new ProxyServer ( 4444 ) ; server . start ( ) ; try { server . setCaptureHeaders ( true ) ; server . setCaptureContent ( true ) ; Proxy proxy = server . seleniumProxy ( ) ; DesiredCapabilities capabilities = new DesiredCapabilities ( ) ; capabilities . setCapability ( PROXY , proxy ) ; driver = new org . openqa . selenium . firefox . FirefoxDriver ( capabilities ) ; server . newHar ( "assertselenium.com" ) ; driver . get ( "http:////whatsmyuseragent.com" ) ; Har har = server . getHar ( ) ; Assert . assertTrue ( ( ! ( har . getLog ( ) . getEntries ( ) . isEmpty ( ) ) ) ) ; String text = har . getLog ( ) . getEntries ( ) . get ( 0 ) . getResponse ( ) . getContent ( ) . getText ( ) ; <START_BUG> Assert . assertTrue ( text . contains ( "<title>\r\n\tWhat\'s<seq2seq4repair_space>My<seq2seq4repair_space>User<seq2seq4repair_space>Agent?\r\n<//title>" ) ) ; <END_BUG> } finally { server . stop ( ) ; if ( driver != null ) { driver . quit ( ) ; } } } @ Test public void googleCaSslNotWorkingInFirefox ( ) throws Exception { } @ Test public void testProxyConfigurationThroughFirefoxProfile ( ) { } }

Fix:
Assert . assertTrue ( text . contains ( "My<seq2seq4repair_space>User<seq2seq4repair_space>Agent?" ) ) ;
Buggy code:
public class EntityExplode extends NestedRoutine { private final DataRef < Entity > entityRef ; private final DynamicInteger strength ; public EntityExplode ( String configString , DataRef < Entity > entityRef , DynamicInteger strength ) { } static final EventInfo myInfo = new SimpleEventInfo ( IntRef . class , "strength" , "-default" ) ; @ Override public void run ( EventData data ) { Entity entity = entityRef . get ( data ) ; <START_BUG> EventData myData = EntityExplode . myInfo . makeChainedData ( data , 0 ) ; <END_BUG> entity . getWorld ( ) . createExplosion ( entity . getLocation ( ) , ( ( strength . getValue ( myData ) ) // 10.0F ) ) ; } public static void register ( ) { } protected static class RoutineBuilder extends NestedRoutine . RoutineBuilder { @ Override public EntityExplode getNew ( Matcher matcher , Object nestedContent , EventInfo info ) { } } }

Fix:
EventData myData = EntityExplode . myInfo . makeChainedData ( data , new IntRef ( 0 ) ) ;
Buggy code:
public class Base64BinaryDatatypeValidator extends AbstractStringValidator { public Base64BinaryDatatypeValidator ( ) throws InvalidDatatypeFacetException { } public Base64BinaryDatatypeValidator ( DatatypeValidator base , Hashtable facets , boolean derivedByList ) throws InvalidDatatypeFacetException { } protected void assignAdditionalFacets ( String key , Hashtable facets ) throws InvalidDatatypeFacetException { } protected void checkValueSpace ( String content ) throws InvalidDatatypeValueException { <START_BUG> if ( ( getLength ( content ) ) <= 0 ) { <END_BUG> throw new InvalidDatatypeValueException ( ( ( "Value<seq2seq4repair_space>'" + content ) + "'<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>encoded<seq2seq4repair_space>in<seq2seq4repair_space>Base64" ) ) ; } } protected int getLength ( String content ) { } }

Fix:
if ( ( getLength ( content ) ) < 0 ) {
Buggy code:
public class AssertionsTest extends BuildFileTest { public AssertionsTest ( String name ) { } protected void setUp ( ) throws Exception { } protected void tearDown ( ) throws Exception { } protected void expectAssertion ( String target ) { } public void testClassname ( ) { } public void testPackage ( ) { } public void testEmptyAssertions ( ) { } public void testDisable ( ) { } public void testOverride ( ) { } public void testOverride2 ( ) { } public void testReferences ( ) { } public void testMultipleAssertions ( ) { } public void testReferenceAbuse ( ) { <START_BUG> expectBuildExceptionContaining ( "test-reference-abuse" , "reference<seq2seq4repair_space>abuse<seq2seq4repair_space>rejected" , "You<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>specify<seq2seq4repair_space>more<seq2seq4repair_space>than<seq2seq4repair_space>one<seq2seq4repair_space>attribute<seq2seq4repair_space>when<seq2seq4repair_space>using<seq2seq4repair_space>refid" ) ; <END_BUG> } public void testNofork ( ) { } public void testJunit ( ) { } }

Fix:
expectBuildExceptionContaining ( "test-reference-abuse" , "reference<seq2seq4repair_space>abuse<seq2seq4repair_space>rejected" , "You<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>specify<seq2seq4repair_space>nested<seq2seq4repair_space>elements<seq2seq4repair_space>when<seq2seq4repair_space>using<seq2seq4repair_space>refid" ) ;
Buggy code:
public class Ex08Weekday { public static void main ( String [ ] args ) { } public static String getWeekday ( int day , int month , int year ) { int weekday ; String [ ] weekdays = new String [ ] { "Domingo" , "Segunda" , "Terça" , "Quarta" , "Quinta" , "Sexta" , "Sábado" } ; int [ ] daysInMonth = new int [ ] { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; weekday = ( year - 1900 ) * 365 ; weekday += ( year - 1900 ) // 4 ; if ( ( ( month == 1 ) || ( month == 2 ) ) && ( Ex08Weekday . isLeapYear ( year ) ) ) weekday -- ; <START_BUG> for ( int i = 0 ; i < month ; i ++ ) <END_BUG> weekday += daysInMonth [ i ] ; weekday += day ; weekday %= 7 ; return weekdays [ weekday ] ; } public static boolean isLeapYear ( int year ) { } }

Fix:
for ( int i = 0 ; i < ( month - 1 ) ; i ++ )
Buggy code:
public class RawText extends Sequence { public static final RawText EMPTY_TEXT = new RawText ( new byte [ 0 ] ) ; private static final int FIRST_FEW_BYTES = 8000 ; protected final byte [ ] content ; protected final IntList lines ; public RawText ( final byte [ ] input ) { } public RawText ( File file ) throws IOException { } public int size ( ) { } public void writeLine ( final OutputStream out , final int i ) throws IOException { } public boolean isMissingNewlineAtEnd ( ) { } public String getString ( int i ) { } public String getString ( int begin , int end , boolean dropLF ) { } protected String decode ( int start , int end ) { } private int getStart ( final int i ) { } private int getEnd ( final int i ) { } public static boolean isBinary ( byte [ ] raw ) { } public static boolean isBinary ( InputStream raw ) throws IOException { } public static boolean isBinary ( byte [ ] raw , int length ) { } public String getLineDelimiter ( ) { if ( ( size ( ) ) == 0 ) return null ; int e = getEnd ( 0 ) ; if ( ( content [ ( e - 1 ) ] ) != '\n' ) return null ; <START_BUG> if ( ( ( content . length ) > 1 ) && ( ( content [ ( e - 2 ) ] ) == '\r' ) ) <END_BUG> return "\r\n" ; else return "\n" ; } }

Fix:
if ( ( ( ( content . length ) > 1 ) && ( e > 1 ) ) && ( ( content [ ( e - 2 ) ] ) == '\r' ) )
Buggy code:
abstract class AbstractPatchingTask < T extends ContentItem > implements PatchingTask { protected final T contentItem ; protected final PatchingTaskDescription description ; private boolean ignoreApply ; private boolean skipExecution ; private byte [ ] backupHash = IoUtils . NO_CONTENT ; AbstractPatchingTask ( PatchingTaskDescription description , Class < T > expected ) { } @ Override public T getContentItem ( ) { } abstract byte [ ] backup ( PatchingTaskContext context ) throws IOException { } abstract byte [ ] apply ( final PatchingTaskContext context , final PatchContentLoader loader ) throws IOException { } abstract ContentModification createRollbackEntry ( ContentModification original , byte [ ] targetHash , byte [ ] itemHash ) { } protected boolean failOnContentMismatch ( PatchingTaskContext context ) { } protected ContentModification getOriginalModification ( byte [ ] targetHash , byte [ ] itemHash ) { } protected void setIgnoreApply ( ) { } @ Override public boolean prepare ( final PatchingTaskContext context ) throws IOException { backupHash = backup ( context ) ; final byte [ ] contentHash = contentItem . getContentHash ( ) ; if ( Arrays . equals ( backupHash , contentHash ) ) { <START_BUG> skipExecution = ( contentItem . getContentType ( ) ) == ( ContentType . MISC ) ; <END_BUG> return true ; } final byte [ ] expected = description . getModification ( ) . getTargetHash ( ) ; if ( Arrays . equals ( backupHash , expected ) ) { return ! ( description . hasConflicts ( ) ) ; } return false ; } @ Override public void execute ( final PatchingTaskContext context ) throws IOException { } }

Fix:
skipExecution = ( ( contentItem . getContentType ( ) ) == ( ContentType . MISC ) ) && ( ( backupHash ) != ( IoUtils . NO_CONTENT ) ) ;
Buggy code:
public interface IActionServiceListener { <START_BUG> void actionServiceChanged ( IActionServiceEvent actionServiceEvent ) ; <END_BUG> }

Fix:
void actionServiceChanged ( ActionServiceEvent actionServiceEvent ) ;