nus-yam/ex-repair huggingface dataset:
Buggy code:
public class PaintHelperComposite extends PaintHelperBasics { private static MainModel model = null ; private static LinearTransform linearTransform = null ; public static void paintRoute ( Graphics2D g2 , LinearTransform pLinearTransform ) { } public static void paintEverything ( Graphics2D g2 , BufferedImage image , LinearTransform pLinearTransform ) { } public static void paintStartEndNode ( Graphics2D g2 , LinearTransform pLinearTransform ) { PaintHelperBasics . setLinearTransform ( pLinearTransform ) ; <START_BUG> if ( ( pLinearTransform . getScale ( ) ) < ( SCALELOWWERBOUND_DRAWICON ) ) { <END_BUG> return ; } Node node = PaintHelperComposite . model . getStartNode ( ) ; if ( node != null ) { BufferedImage image = NodeIcon . getStartIcon ( ) ; PaintHelperBasics . paintIcon2 ( node , g2 , image ) ; } ArrayList < Node > endNodes = PaintHelperComposite . model . getEndNode ( ) ; if ( null != endNodes ) { BufferedImage image = NodeIcon . getEndIcon ( ) ; for ( Node endNode : endNodes ) { PaintHelperBasics . paintIcon2 ( endNode , g2 , image ) ; } } } public static void paintEdgeAndNodes ( List < Node > nodes , Graphics2D g2 ) { } public static void paintPath ( Path path , Graphics2D g2 , LinearTransform pLinearTransform ) { } public static void paintNodes ( List < Node > nodes , Graphics2D g2 , PaintHelperBasics . DrawStyleEnum style , LinearTransform pLinearTransform ) { } public static void paintNodes ( List < Node > nodes , Graphics2D g2 , LinearTransform pLinearTransform ) { } public static void paintEdges ( List < Edge > edges , Graphics2D g2 , LinearTransform pLinearTransform ) { } public static void paintEdges ( List < Edge > edges , Graphics2D g2 , PaintHelperBasics . DrawStyleEnum style , LinearTransform pLinearTransform ) { } public static void setModel ( MainModel model ) { } public static LinearTransform getLinearTransform ( ) { } public static void setLinearTransform ( LinearTransform linearTransform ) { } }

Fix:
if ( ( pLinearTransform . getScale ( ) ) < 0.5 ) {
Buggy code:
public class BSFJavaScriptEngine extends BSFEngineImpl { private Scriptable global ; public Object call ( Object object , String method , Object [ ] args ) throws BSFException { } @ Override public void declareBean ( BSFDeclaredBean bean ) throws BSFException { } public Object eval ( String source , int lineNo , int columnNo , Object oscript ) throws BSFException { } private void handleError ( Throwable t ) throws BSFException { } @ Override <START_BUG> public void initialize ( BSFManager mgr , String lang , @ SuppressWarnings ( "unchecked" ) <END_BUG> Vector declaredBeans ) throws BSFException { super . initialize ( mgr , lang , declaredBeans ) ; try { Context cx = Context . enter ( ) ; global = new org . mozilla . javascript . ImporterTopLevel ( cx ) ; Scriptable bsf = Context . toObject ( new org . apache . bsf . util . BSFFunctions ( mgr , this ) , global ) ; global . put ( "bsf" , global , bsf ) ; for ( @ SuppressWarnings ( "unchecked" ) Iterator < BSFDeclaredBean > it = declaredBeans . iterator ( ) ; it . hasNext ( ) ; ) { declareBean ( it . next ( ) ) ; } } catch ( Throwable t ) { } finally { Context . exit ( ) ; } } @ Override public void undeclareBean ( BSFDeclaredBean bean ) throws BSFException { } }

Fix:
public void initialize ( BSFManager mgr , String lang , @ SuppressWarnings ( "rawtypes" )
Buggy code:
public class CriteriaType implements Criteria { private AnimalType type ; public CriteriaType ( AnimalType type ) { } @ Override public List < Animal > meetCriteria ( List < Animal > animals ) { List < Animal > typeAnimals = new ArrayList < > ( ) ; <START_BUG> for ( Animal animal : typeAnimals ) { <END_BUG> if ( ( animal . getType ( ) ) == ( type ) ) { typeAnimals . add ( animal ) ; } } return typeAnimals ; } }

Fix:
for ( Animal animal : animals ) {
Buggy code:
@ Component public class AccessInterceptor extends HandlerInterceptorAdapter { @ Override public boolean preHandle ( HttpServletRequest request , HttpServletResponse response , Object handler ) throws Exception { if ( ! ( handler . getClass ( ) . equals ( HandlerMethod . class ) ) ) return super . preHandle ( request , response , handler ) ; HandlerMethod method = ( ( HandlerMethod ) ( handler ) ) ; Class < ? > cls = method . getBeanType ( ) ; Anonymous anonymous = method . getMethodAnnotation ( Anonymous . class ) ; if ( ApplicationConfig . isDevMod ( ) ) { response . setHeader ( "Access-Control-Allow-Origin" , "*" ) ; <START_BUG> response . setHeader ( "Access-Control-Allow-Methods" , "POST,<seq2seq4repair_space>GET,<seq2seq4repair_space>OPTIONS,<seq2seq4repair_space>DELETE" ) ; <END_BUG> } if ( anonymous != null ) return super . preHandle ( request , response , handler ) ; SecUser user = checkAuthorization ( response ) ; if ( ( user == null ) || ( ! ( checkAccesses ( cls , request , response , method , user ) ) ) ) { return false ; } return super . preHandle ( request , response , handler ) ; } private SecUser checkAuthorization ( HttpServletResponse response ) throws IOException { } private boolean checkAccesses ( Class < ? > cls , HttpServletRequest request , HttpServletResponse response , HandlerMethod method , SecUser user ) throws IOException { } private boolean checkAnyAccess ( Access [ ] accesses , SecUser user ) throws IOException { } private boolean checkAccess ( Access access , SecUser user ) throws IOException { } private boolean checkRole ( SecUser user , String [ ] permissionNames ) { } No newline ; at end ; of file ; }

Fix:
response . setHeader ( "Access-Control-Allow-Methods" , "POST,<seq2seq4repair_space>GET,<seq2seq4repair_space>OPTIONS,<seq2seq4repair_space>DELETE,<seq2seq4repair_space>PUT" ) ;
Buggy code:
public final class SlopeOneAverageDiffsJob extends AbstractJob { @ Override public int run ( String [ ] args ) throws IOException , ClassNotFoundException , InterruptedException { addInputOption ( ) ; addOutputOption ( ) ; Map < String , String > parsedArgs = parseArguments ( args ) ; if ( parsedArgs == null ) { return - 1 ; } Path prefsFile = getInputPath ( ) ; Path outputPath = getOutputPath ( ) ; Path averagesOutputPath = new Path ( parsedArgs . get ( "--tempDir" ) ) ; AtomicInteger currentPhase = new AtomicInteger ( ) ; if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { Job prefsToDiffsJob = prepareJob ( prefsFile , averagesOutputPath , TextInputFormat . class , ToItemPrefsMapper . class , VarLongWritable . class , EntityPrefWritable . class , SlopeOnePrefsToDiffsReducer . class , EntityEntityWritable . class , FloatWritable . class , SequenceFileOutputFormat . class ) ; prefsToDiffsJob . waitForCompletion ( true ) ; } if ( shouldRunNextPhase ( parsedArgs , currentPhase ) ) { <START_BUG> Job diffsToAveragesJob = prepareJob ( averagesOutputPath , outputPath , SequenceFileInputFormat . class , Mapper . class , EntityEntityWritable . class , FloatWritable . class , SlopeOneDiffsToAveragesReducer . class , EntityEntityWritable . class , FloatWritable . class , TextOutputFormat . class ) ; <END_BUG> FileOutputFormat . setOutputCompressorClass ( diffsToAveragesJob , GzipCodec . class ) ; diffsToAveragesJob . waitForCompletion ( true ) ; } return 0 ; } public static void main ( String [ ] args ) throws Exception { } }

Fix:
Job diffsToAveragesJob = prepareJob ( averagesOutputPath , outputPath , SequenceFileInputFormat . class , Mapper . class , EntityEntityWritable . class , FloatWritable . class , SlopeOneDiffsToAveragesReducer . class , EntityEntityWritable . class , FullRunningAverageAndStdDevWritable . class , TextOutputFormat . class ) ;
Buggy code:
public class WicketFilter implements Filter { private static final Log log = LogFactory . getLog ( WicketFilter . class ) ; public static final String APP_FACT_PARAM = "applicationFactoryClassName" ; public static final String FILTER_PATH_PARAM = "filterPath" ; private static final String RESOURCES_PATH_PREFIX = "//resources//" ; static final String SERVLET_PATH_HOLDER = "<servlet>" ; private FilterConfig filterConfig ; private String filterPath ; private String rootPath ; private WebApplication webApplication ; public void destroy ( ) { } public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } public final void doGet ( final HttpServletRequest servletRequest , final HttpServletResponse servletResponse ) throws IOException , ServletException { Application . set ( webApplication ) ; final WebRequest request = webApplication . newWebRequest ( servletRequest ) ; if ( ( webApplication . getRequestCycleSettings ( ) . getRenderStrategy ( ) ) == ( RenderStrategy . REDIRECT_TO_BUFFER ) ) { String queryString = servletRequest . getQueryString ( ) ; if ( ! ( Strings . isEmpty ( queryString ) ) ) { ISessionStore sessionStore = webApplication . getSessionStore ( ) ; String sessionId = sessionStore . getSessionId ( request , false ) ; if ( sessionId != null ) { BufferedHttpServletResponse bufferedResponse = webApplication . popBufferedResponse ( sessionId , queryString ) ; if ( bufferedResponse != null ) { bufferedResponse . writeTo ( servletResponse ) ; return ; } } } } if ( ( servletRequest . getCharacterEncoding ( ) ) == null ) { try { servletRequest . setCharacterEncoding ( webApplication . getRequestCycleSettings ( ) . getResponseRequestEncoding ( ) ) ; } catch ( UnsupportedEncodingException ex ) { throw new WicketRuntimeException ( ex . getMessage ( ) ) ; } } final WebSession session = webApplication . getSession ( request ) ; final WebResponse response = webApplication . newWebResponse ( servletResponse ) ; <START_BUG> response . setWebRequest ( request ) ; <END_BUG> response . setCharacterEncoding ( webApplication . getRequestCycleSettings ( ) . getResponseRequestEncoding ( ) ) ; try { RequestCycle cycle = session . newRequestCycle ( request , response ) ; try { cycle . request ( ) ; } catch ( AbortException e ) { } } finally { response . close ( ) ; Session . unset ( ) ; Application . unset ( ) ; } } public FilterConfig getFilterConfig ( ) { } public String getRootPath ( HttpServletRequest request ) { } public void init ( FilterConfig filterConfig ) throws ServletException { } protected IWebApplicationFactory getApplicationFactory ( ) { } long getLastModified ( final HttpServletRequest servletRequest ) { } private boolean isWicketRequest ( HttpServletRequest request ) { } private void maybeSetLastModified ( final HttpServletResponse resp , final long lastModified ) { } }

Fix:
response . setAjax ( request . isAjax ( ) ) ;
Buggy code:
String type = "" ; if ( hex . contains ( "#<seq2seq4repair_space>" ) ) { <START_BUG> dec = hex . substring ( ( ( hex . indexOf ( ",<seq2seq4repair_space>" ) ) + 2 ) ) ; <END_BUG>

Fix:
dec = hex . substring ( ( ( hex . indexOf ( "#<seq2seq4repair_space>" ) ) + 2 ) ) ;
Buggy code:
public abstract class AbstractStickyCursorAdapter extends AbstractCursorAdapter implements StickyListHeadersAdapter { private Map < Integer , Long > allItems = new HashMap < > ( ) ; private DataSetObserver mDataSetObserver = new DataSetObserver ( ) { public void onChanged ( ) { } public void onInvalidated ( ) { } } ; public AbstractStickyCursorAdapter ( Context context , Cursor c ) { } @ Override public Cursor swapCursor ( Cursor newCursor ) { } @ Override public int getCount ( ) { } @ Override public Object getItem ( int position ) { } @ Override public long getItemId ( int position ) { } @ Override public View getHeaderView ( int position , View convertView , ViewGroup parent ) { } @ Override public long getHeaderId ( int position ) { } protected abstract String getIndexColumnValue ( Cursor c ) { } protected abstract long getSectionUniqueId ( Cursor c ) { } protected abstract View newHeaderView ( Context context , Cursor c , ViewGroup root ) { } protected abstract void bindHeaderView ( View view , Context context , Cursor c ) { } private long getCursorPosition ( int position ) { <START_BUG> if ( ( allItems ) == null ) { <END_BUG> return 0 ; } return allItems . get ( position ) ; } private void prepareIndexer ( Cursor c ) { } }

Fix:
if ( ( ( allItems ) == null ) || ( ! ( allItems . containsKey ( position ) ) ) ) {
Buggy code:
public abstract class Directory implements Closeable { public abstract String [ ] listAll ( ) throws IOException { } public abstract boolean fileExists ( String name ) throws IOException { } public abstract void deleteFile ( String name ) throws IOException { } public abstract long fileLength ( String name ) throws IOException { } public abstract IndexOutput createOutput ( String name , IOContext context ) throws IOException { } public abstract void sync ( Collection < String > names ) throws IOException { } public abstract IndexInput openInput ( String name , IOContext context ) throws IOException { } public abstract Lock makeLock ( String name ) { } public abstract void clearLock ( String name ) throws IOException { } @ Override public abstract void close ( ) throws IOException { } public abstract void setLockFactory ( LockFactory lockFactory ) throws IOException { } public abstract LockFactory getLockFactory ( ) { } public String getLockID ( ) { } @ Override public String toString ( ) { <START_BUG> return ( ( super . toString ( ) ) + "<seq2seq4repair_space>lockFactory=" ) + ( getLockFactory ( ) ) ; <END_BUG> } public void copy ( Directory to , String src , String dest , IOContext context ) throws IOException { } public Directory . IndexInputSlicer createSlicer ( final String name , final IOContext context ) throws IOException { } protected void ensureOpen ( ) throws AlreadyClosedException { } public abstract class IndexInputSlicer implements Closeable { public abstract IndexInput openSlice ( String sliceDescription , long offset , long length ) throws IOException { } @ Deprecated public abstract IndexInput openFullSlice ( ) throws IOException { } } private static final class SlicedIndexInput extends BufferedIndexInput { IndexInput base ; long fileOffset ; long length ; SlicedIndexInput ( final String sliceDescription , final IndexInput base , final long fileOffset , final long length ) { } SlicedIndexInput ( final String sliceDescription , final IndexInput base , final long fileOffset , final long length , int readBufferSize ) { } @ Override public Directory . SlicedIndexInput clone ( ) { } @ Override protected void readInternal ( byte [ ] b , int offset , int len ) throws IOException { } @ Override protected void seekInternal ( long pos ) { } @ Override public void close ( ) throws IOException { } @ Override public long length ( ) { } } }

Fix:
return ( ( ( ( getClass ( ) . getSimpleName ( ) ) + '@' ) + ( Integer . toHexString ( hashCode ( ) ) ) ) + "<seq2seq4repair_space>lockFactory=" ) + ( getLockFactory ( ) ) ;
Buggy code:
public class CacheContainerWriteAttributeHandler implements OperationStepHandler { public static final CacheContainerWriteAttributeHandler INSTANCE = new CacheContainerWriteAttributeHandler ( ) ; private final ParametersValidator nameValidator = new ParametersValidator ( ) ; private final Map < String , AttributeDefinition > attributeDefinitions ; private CacheContainerWriteAttributeHandler ( ) { } private CacheContainerWriteAttributeHandler ( final AttributeDefinition ... definitions ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { } protected boolean requiresRuntime ( OperationContext context ) { <START_BUG> return ( ( context . getType ( ) ) == ( Type . SERVER ) ) && ( ! ( context . isBooting ( ) ) ) ; <END_BUG> } protected AttributeDefinition getAttributeDefinition ( final String attributeName ) { } public void registerAttributes ( final ManagementResourceRegistration registry ) { } }

Fix:
return ( context . getProcessType ( ) . isServer ( ) ) && ( ! ( context . isBooting ( ) ) ) ;
Buggy code:
public class ConnectorAdd extends AbstractAddStepHandler { static final ConnectorAdd INSTANCE = new ConnectorAdd ( ) ; protected void populateModel ( ModelNode operation , ModelNode model ) throws OperationFailedException { } protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model , ServiceVerificationHandler verificationHandler , List < ServiceController < ? > > newControllers ) throws OperationFailedException { final PathAddress address = PathAddress . pathAddress ( operation . get ( OP_ADDR ) ) ; final String connectorName = address . getLastElement ( ) . getValue ( ) ; <START_BUG> ServiceName tmpDirPath = JBOSS . append ( "server" , "path" , "jboss.home.dir" ) ; <END_BUG> RemotingServices . installSecurityServices ( context . getServiceTarget ( ) , connectorName , null , null , tmpDirPath , verificationHandler , newControllers ) ; launchServices ( context , address , connectorName , model , verificationHandler , newControllers ) ; } void launchServices ( OperationContext context , PathAddress pathAddress , String connectorName , ModelNode model , ServiceVerificationHandler verificationHandler , List < ServiceController < ? > > newControllers ) throws OperationFailedException { } private Resource findResource ( Resource rootResource , PathAddress address ) { } static OptionMap createOptionMap ( final ModelNode parameters ) { } static Collection < String > asStringSet ( final ModelNode node ) { } static Collection < SaslQop > asQopSet ( final ModelNode node ) { } }

Fix:
ServiceName tmpDirPath = JBOSS . append ( "server" , "path" , "jboss.controller.temp.dir" ) ;
Buggy code:
@ Controller public class UserController { @ POST ( "//professor//login" ) public static Result profLogin ( Request req ) throws SQLException { } @ POST ( "//student//login" ) public static Result stuLogin ( Request req ) throws SQLException { } @ POST ( "//professor//register" ) public static Result profRegister ( Request req ) throws SQLException { } @ POST ( "//student//register" ) public static Result stuRegister ( Request req ) throws SQLException { } private static int insertUserRow ( Request req , User record ) throws SQLException { record . passwd = record . passwd ; record . join_date = new Timestamp ( System . currentTimeMillis ( ) ) ; <START_BUG> return UserTable . getQuery ( ) . insertRetunningGenKey ( req . getDBConnection ( ) , new User [ ] { record } ) . get ( 0 ) ; <END_BUG> } private static Result userRegister ( Request req , User user , ConsumerThatThrow < Integer > other ) throws SQLException { } protected static boolean isStudentUser ( Request req ) { } protected static StudentUser getStuLoginData ( Request req ) { } protected static boolean isPrefessorUser ( Request req ) { } protected static ProfessorUser getProfLoginData ( Request req ) { } }

Fix:
return UserTable . getQuery ( ) . insertReturningGenKey ( req . getDBConnection ( ) , new User [ ] { record } ) . get ( 0 ) ;
Buggy code:
public class ResourceEntityResolver extends DelegatingEntityResolver { private static final Log logger = LogFactory . getLog ( ResourceEntityResolver . class ) ; private final ResourceLoader resourceLoader ; public ResourceEntityResolver ( ResourceLoader resourceLoader ) { } @ Override public InputSource resolveEntity ( String publicId , String systemId ) throws IOException , SAXException { InputSource source = super . resolveEntity ( publicId , systemId ) ; if ( ( source == null ) && ( systemId != null ) ) { String resourcePath = null ; try { <START_BUG> String decodedSystemId = URLDecoder . decode ( systemId ) ; <END_BUG> String givenUrl = new URL ( decodedSystemId ) . toString ( ) ; String systemRootUrl = new File ( "" ) . toURI ( ) . toURL ( ) . toString ( ) ; if ( givenUrl . startsWith ( systemRootUrl ) ) { resourcePath = givenUrl . substring ( systemRootUrl . length ( ) ) ; } } catch ( Exception ex ) { if ( ResourceEntityResolver . logger . isDebugEnabled ( ) ) { ResourceEntityResolver . logger . debug ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>resolve<seq2seq4repair_space>XML<seq2seq4repair_space>entity<seq2seq4repair_space>[" + systemId ) + "]<seq2seq4repair_space>against<seq2seq4repair_space>system<seq2seq4repair_space>root<seq2seq4repair_space>URL" ) , ex ) ; } resourcePath = systemId ; } if ( resourcePath != null ) { if ( ResourceEntityResolver . logger . isTraceEnabled ( ) ) { ResourceEntityResolver . logger . trace ( ( ( ( ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>locate<seq2seq4repair_space>XML<seq2seq4repair_space>entity<seq2seq4repair_space>[" + systemId ) + "]<seq2seq4repair_space>as<seq2seq4repair_space>resource<seq2seq4repair_space>[" ) + resourcePath ) + "]" ) ) ; } Resource resource = this . resourceLoader . getResource ( resourcePath ) ; source = new InputSource ( resource . getInputStream ( ) ) ; source . setPublicId ( publicId ) ; source . setSystemId ( systemId ) ; if ( ResourceEntityResolver . logger . isDebugEnabled ( ) ) { ResourceEntityResolver . logger . debug ( ( ( ( "Found<seq2seq4repair_space>XML<seq2seq4repair_space>entity<seq2seq4repair_space>[" + systemId ) + "]:<seq2seq4repair_space>" ) + resource ) ) ; } } } return source ; } }

Fix:
String decodedSystemId = URLDecoder . decode ( systemId , "UTF-8" ) ;
Buggy code:
public class JexlFunction extends AbstractFunction implements Serializable { private static final long serialVersionUID = 3546359539474968625L ; private static Logger log = LoggingManager . getLoggerForClass ( ) ; private static final String KEY = "__jexl" ; private static final List desc = new LinkedList ( ) ; private Object [ ] values ; public synchronized String execute ( SampleResult result , Sampler sampler ) throws InvalidVariableException { String str = "" ; CompoundVariable var = ( ( CompoundVariable ) ( values [ 0 ] ) ) ; <START_BUG> String exp = var . getRawParameters ( ) ; <END_BUG> try { Expression e = ExpressionFactory . createExpression ( exp ) ; JexlContext jc = JexlHelper . createContext ( ) ; jc . getVars ( ) . put ( "ctx" , sampler . getThreadContext ( ) ) ; jc . getVars ( ) . put ( "vars" , getVariables ( ) ) ; jc . getVars ( ) . put ( "theadName" , sampler . getThreadName ( ) ) ; jc . getVars ( ) . put ( "sampler" , sampler ) ; jc . getVars ( ) . put ( "sampleResult" , result ) ; Object o = e . evaluate ( jc ) ; if ( o != null ) { str = o . toString ( ) ; } } catch ( Exception e ) { JexlFunction . log . error ( ( ( "An<seq2seq4repair_space>error<seq2seq4repair_space>occurred<seq2seq4repair_space>while<seq2seq4repair_space>evaluating<seq2seq4repair_space>the<seq2seq4repair_space>expression<seq2seq4repair_space>\"" + exp ) + "\"" ) ) ; } return str ; } public List getArgumentDesc ( ) { } public String getReferenceKey ( ) { } public synchronized void setParameters ( Collection parameters ) throws InvalidVariableException { } }

Fix:
String exp = var . execute ( ) ;
Buggy code:
public abstract class AbstractSubsystemBaseTest extends AbstractSubsystemTest { public AbstractSubsystemBaseTest ( final String mainSubsystemName , final Extension mainExtension ) { } public AbstractSubsystemBaseTest ( final String mainSubsystemName , final Extension mainExtension , final Comparator < PathAddress > removeOrderComparator ) { } protected abstract String getSubsystemXml ( ) throws IOException { } protected String getSubsystemXml ( String configId ) throws IOException { } @ Test public void testSubsystem ( ) throws Exception { } protected void standardSubsystemTest ( final String configId ) throws Exception { } protected void standardSubsystemTest ( final String configId , boolean compareXml ) throws Exception { final AdditionalInitialization additionalInit = createAdditionalInitialization ( ) ; final String subsystemXml = ( configId == null ) ? getSubsystemXml ( ) : getSubsystemXml ( configId ) ; final KernelServices servicesA = super . installInController ( additionalInit , subsystemXml ) ; Assert . assertNotNull ( servicesA ) ; final ModelNode modelA = servicesA . readWholeModel ( ) ; validateModel ( modelA ) ; final String marshalled = servicesA . getPersistedSubsystemXml ( ) ; servicesA . shutdown ( ) ; String normalizedSubsystem = normalizeXML ( subsystemXml ) ; if ( compareXml ) { compareXml ( configId , normalizedSubsystem , normalizeXML ( marshalled ) ) ; } final KernelServices servicesB = super . installInController ( additionalInit , marshalled ) ; final ModelNode modelB = servicesB . readWholeModel ( ) ; compare ( modelA , modelB ) ; final ModelNode operation = createDescribeOperation ( ) ; final ModelNode result = servicesB . executeOperation ( operation ) ; Assert . assertTrue ( "the<seq2seq4repair_space>subsystem<seq2seq4repair_space>describe<seq2seq4repair_space>operation<seq2seq4repair_space>has<seq2seq4repair_space>to<seq2seq4repair_space>generate<seq2seq4repair_space>a<seq2seq4repair_space>list<seq2seq4repair_space>of<seq2seq4repair_space>operations<seq2seq4repair_space>to<seq2seq4repair_space>recreate<seq2seq4repair_space>the<seq2seq4repair_space>subsystem" , ( ! ( result . hasDefined ( FAILURE_DESCRIPTION ) ) ) ) ; final List < ModelNode > operations = result . get ( RESULT ) . asList ( ) ; servicesB . shutdown ( ) ; final KernelServices servicesC = super . installInController ( additionalInit , operations ) ; final ModelNode modelC = servicesC . readWholeModel ( ) ; compare ( modelA , modelC ) ; <START_BUG> assertRemoveSubsystemResources ( servicesA , getIgnoredChildResourcesForRemovalTest ( ) ) ; <END_BUG> } protected void validateModel ( ModelNode model ) { } protected ModelNode createDescribeOperation ( ) { } protected AdditionalInitialization createAdditionalInitialization ( ) { } protected Set < PathAddress > getIgnoredChildResourcesForRemovalTest ( ) { } }

Fix:
assertRemoveSubsystemResources ( servicesC , getIgnoredChildResourcesForRemovalTest ( ) ) ;
Buggy code:
public class ForArrayQuestionCreator extends QuestionCreator { private List < Integer > numbers ; private int steps ; private int startingValue ; public ForArrayQuestionCreator ( ) { } @ Override protected void randomizeParameters ( ) { } @ Override protected HashMap < String , Object > setUpScope ( ) { } @ Override protected Question setUpQuestionAndAnswers ( ) { } @ Override protected String determineRightAnswer ( ) { <START_BUG> if ( ( ( steps ) + ( startingValue ) ) < ( ( numbers . size ( ) ) - 1 ) ) { <END_BUG> return "" + ( numbers . get ( ( ( steps ) + ( startingValue ) ) ) ) ; } else { return "Ohjelma<seq2seq4repair_space>ei<seq2seq4repair_space>printtaa<seq2seq4repair_space>mitään" ; } } private Set < String > buildAnswers ( ) { } }

Fix:
if ( ( ( steps ) + ( startingValue ) ) < ( numbers . size ( ) ) ) {
Buggy code:
public class RegisterTasklet extends AbstractResourceRegisterer { protected void registerResource ( final String name , final String classname , final URL url ) throws AntException , RegistryException { if ( null == classname ) { try { <START_BUG> m_tskDeployer . deployTasklet ( name , url . toString ( ) , url ) ; <END_BUG> } catch ( final DeploymentException de ) { throw new AntException ( ( ( ( "Failed<seq2seq4repair_space>deploying<seq2seq4repair_space>" + name ) + "<seq2seq4repair_space>from<seq2seq4repair_space>" ) + url ) , de ) ; } } else { final DefaultLocator locator = new DefaultLocator ( classname , url ) ; m_engine . getRegistry ( ) . register ( name , locator ) ; } } }

Fix:
m_tskDeployer . deployTask ( name , url . toString ( ) , url ) ;
Buggy code:
public class Property extends Task { protected String name ; protected String value ; protected File file ; protected String resource ; protected Path classpath ; protected String env ; protected Reference ref = null ; protected boolean userProperty = false ; public void setName ( String name ) { } public String getName ( ) { } public void setLocation ( File location ) { } public void setValue ( String value ) { } public String getValue ( ) { } public void setFile ( File file ) { } public File getFile ( ) { } public void setRefid ( Reference ref ) { } public Reference getRefid ( ) { } public void setResource ( String resource ) { } public String getResource ( ) { } public void setEnvironment ( String env ) { } public String getEnvironment ( ) { } public void setClasspath ( Path classpath ) { } public Path createClasspath ( ) { } public void setClasspathRef ( Reference r ) { } public void setUserProperty ( boolean userProperty ) { } public String toString ( ) { } public void execute ( ) throws BuildException { } protected void loadFile ( File file ) throws BuildException { Properties props = new Properties ( ) ; log ( ( "Loading<seq2seq4repair_space>" + ( file . getAbsolutePath ( ) ) ) , MSG_VERBOSE ) ; try { if ( file . exists ( ) ) { FileInputStream fis = new FileInputStream ( file ) ; try { props . load ( fis ) ; } finally { if ( fis != null ) { fis . close ( ) ; } } addProperties ( props ) ; } else { <START_BUG> log ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>property<seq2seq4repair_space>file:<seq2seq4repair_space>" + ( file . getAbsolutePath ( ) ) ) , MSG_WARN ) ; <END_BUG> } } catch ( Exception ex ) { throw new BuildException ( ex . getMessage ( ) , ex , location ) ; } } protected void loadResource ( String name ) { } protected void loadEnvironment ( String prefix ) { } protected void addProperties ( Properties props ) { } protected void addProperty ( String n , String v ) { } private void resolveAllProperties ( Hashtable props ) { } private boolean extractProperties ( String source , Vector properties ) { } }

Fix:
log ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>property<seq2seq4repair_space>file:<seq2seq4repair_space>" + ( file . getAbsolutePath ( ) ) ) , MSG_VERBOSE ) ;
Buggy code:
public class TestEnglishMinimalStemFilter extends BaseTokenStreamTestCase { private Analyzer analyzer = new Analyzer ( ) { @ Override protected TokenStreamComponents createComponents ( String fieldName , Reader reader ) { } } ; public void testExamples ( ) throws IOException { } public void testRandomStrings ( ) throws Exception { <START_BUG> checkRandomData ( random ( ) , analyzer , ( 10000 * ( RANDOM_MULTIPLIER ) ) ) ; <END_BUG> } public void testEmptyTerm ( ) throws IOException { } }

Fix:
checkRandomData ( random ( ) , analyzer , ( 1000 * ( RANDOM_MULTIPLIER ) ) ) ;
Buggy code:
public class P4Change extends P4Base { protected String emptyChangeList = null ; protected String description = "AutoSubmit<seq2seq4repair_space>By<seq2seq4repair_space>Ant" ; public void setDescription ( String desc ) { } public String getEmptyChangeList ( ) throws TaskException { } public void execute ( ) throws TaskException { if ( ( emptyChangeList ) == null ) emptyChangeList = getEmptyChangeList ( ) ; <START_BUG> final Project myProj = project ; <END_BUG> P4Handler handler = new P4HandlerAdapter ( ) { public void process ( String line ) { if ( util . match ( "//Change//" , line ) ) { line = util . substitute ( "s//[^0-9]////g" , line ) ; int changenumber = Integer . parseInt ( line ) ; log ( ( "Change<seq2seq4repair_space>Number<seq2seq4repair_space>is<seq2seq4repair_space>" + changenumber ) , MSG_INFO ) ; setProperty ( "p4.change" , ( "" + changenumber ) ) ; } else if ( util . match ( "//error//" , line ) ) { throw new TaskException ( "Perforce<seq2seq4repair_space>Error,<seq2seq4repair_space>check<seq2seq4repair_space>client<seq2seq4repair_space>settings<seq2seq4repair_space>and//or<seq2seq4repair_space>server" ) ; } } } ; handler . setOutput ( emptyChangeList ) ; execP4Command ( "change<seq2seq4repair_space>-i" , handler ) ; } protected String backslash ( String value ) { } }

Fix:
final Project myProj = getProject ( ) ;
Buggy code:
public class SmartFridgePlugin implements KubiPlugin { private Technology currentTechnology ; private KubiKernel kubiKernel ; private String fileToLoad = "CSV_Cuisine_9-14_Avril.csv" ; private static final String csvSplitter = ";" ; @ Override public void start ( KubiKernel kernel ) { } @ Override public void stop ( ) { } private void initData ( KubiUniverse universe , long [ ] keys , InputStream stream ) { BufferedReader bufferedReader = null ; String line ; try { bufferedReader = new BufferedReader ( new InputStreamReader ( stream ) ) ; while ( ( line = bufferedReader . readLine ( ) ) != null ) { String [ ] data = line . split ( SmartFridgePlugin . csvSplitter ) ; if ( ( ( ( data . length ) > 2 ) && ( ( data [ 1 ] ) != null ) ) && ( ( data [ 2 ] ) != null ) ) { long recordTime = Long . parseLong ( data [ 0 ] ) ; universe . time ( recordTime ) . lookupAll ( keys ) . then ( new org . kevoree . modeling . api . Callback < KObject [ ] > ( ) { @ Override public void on ( KObject [ ] kObjects ) { if ( "3" . equals ( data [ 1 ] ) ) { final double temp = Double . parseDouble ( data [ 2 ] ) ; if ( ( kObjects [ 0 ] ) != null ) { ( ( StateParameter ) ( kObjects [ 0 ] ) ) . setValue ( ( temp + "" ) ) ; } } else if ( "2" . equals ( data [ 1 ] ) ) { float openRawState = Float . parseFloat ( data [ 2 ] ) ; boolean openState = false ; if ( openRawState == 255 ) { openState = true ; } if ( ( kObjects [ 1 ] ) != null ) { <START_BUG> ( ( StateParameter ) ( kObjects [ 1 ] ) ) . setValue ( ( openState + "" ) ) ; <END_BUG> } } kubiKernel . model ( ) . save ( ) ; } } ) ; } } } catch ( Exception e1 ) { e1 . printStackTrace ( ) ; } finally { if ( bufferedReader != null ) { try { bufferedReader . close ( ) ; stream . close ( ) ; } catch ( IOException e1 ) { e1 . printStackTrace ( ) ; } } } } private void readData ( ) { } }

Fix:
( ( StateParameter ) ( kObjects [ 1 ] ) ) . setValue ( ( ( openState ? 0.2 : 0 ) + "" ) ) ;
Buggy code:
public class ItemUpdateFactory { private static final String AGED_BRIE = "Aged<seq2seq4repair_space>Brie" ; private static final String SULFURAS = "Sulfuras" ; private static final String BACKSTAGE_PASSES = "Backstage<seq2seq4repair_space>Passes" ; private static final String ORGANIC_BANANAS = "Organic<seq2seq4repair_space>Bananas" ; public static ItemAbstract getItemStrategy ( String name ) { ItemAbstract itemStrategy ; if ( ItemUpdateFactory . AGED_BRIE . equals ( name ) ) { itemStrategy = new AgedBrie ( ) ; } else { if ( ItemUpdateFactory . BACKSTAGE_PASSES . equals ( name ) ) { itemStrategy = new BackstagePasses ( ) ; } else { <START_BUG> if ( ! ( ItemUpdateFactory . SULFURAS . equals ( name ) ) ) { <END_BUG> itemStrategy = new Sulfuras ( ) ; } else { if ( ItemUpdateFactory . ORGANIC_BANANAS . equals ( name ) ) { itemStrategy = new OrganicBananas ( ) ; } else { itemStrategy = new CommonItem ( ) ; } } } } return itemStrategy ; } }

Fix:
if ( ItemUpdateFactory . SULFURAS . equals ( name ) ) {
Buggy code:
public class TableDropTargetEffect extends DropTargetEffect { static final int SCROLL_HYSTERESIS = 150 ; TableItem scrollItem ; long scrollBeginTime ; DataBrowserCallbacks callbacks = null ; static Callback AcceptDragProc ; static int AcceptDragProc ( int theControl , int itemID , int property , int theRect , int theDrag ) { } static DropTarget FindDropTarget ( int theControl , int theDrag ) { if ( theControl == 0 ) return null ; Display display = Display . findDisplay ( Thread . currentThread ( ) ) ; if ( ( display == null ) || ( display . isDisposed ( ) ) ) return null ; Widget widget = display . findWidget ( theControl ) ; if ( widget == null ) return null ; <START_BUG> return ( ( DropTarget ) ( widget . getData ( DROPTARGETID ) ) ) ; <END_BUG> } public TableDropTargetEffect ( Table table ) { } int checkEffect ( int effect ) { } public void dragEnter ( DropTargetEvent event ) { } public void dragLeave ( DropTargetEvent event ) { } public void dragOver ( DropTargetEvent event ) { } }

Fix:
return ( ( DropTarget ) ( widget . getData ( DROP_TARGET_KEY ) ) ) ;
Buggy code:
int size = C . PTR_SIZEOF ; <START_BUG> int align = 2 ; <END_BUG>

Fix:
int align = ( ( C . PTR_SIZEOF ) == 4 ) ? 2 : 8 ;
Buggy code:
public class LocalizedFormatsTest { @ Test public void testMessageNumber ( ) { <START_BUG> Assert . assertEquals ( 313 , LocalizedFormats . values ( ) . length ) ; <END_BUG> } @ Test public void testAllKeysPresentInPropertiesFiles ( ) { } @ Test public void testAllPropertiesCorrespondToKeys ( ) { } @ Test public void testNoMissingFrenchTranslation ( ) { } @ Test public void testNoOpEnglishTranslation ( ) { } @ Test public void testVariablePartsConsistency ( ) { } }

Fix:
Assert . assertEquals ( 314 , LocalizedFormats . values ( ) . length ) ;
Buggy code:
public class Entity implements Renderable { public static final int SIZE = 2 ; private static final double SP = 1.0 ; public static final int COLOR_OBJECTIVE = - 32897 ; public static final int COLOR_PLAYER = - 1 ; public static final int COLOR_ENEMY_COM = - 33024 ; private static final double NONE = - 1 ; private static final double E = ( 0 * ( Math . PI ) ) // 4 ; private static final double SE = ( 1 * ( Math . PI ) ) // 4 ; private static final double S = ( 2 * ( Math . PI ) ) // 4 ; private static final double SW = ( 3 * ( Math . PI ) ) // 4 ; private static final double W = ( 4 * ( Math . PI ) ) // 4 ; private static final double NW = ( 5 * ( Math . PI ) ) // 4 ; private static final double N = ( 6 * ( Math . PI ) ) // 4 ; private static final double NE = ( 7 * ( Math . PI ) ) // 4 ; private static final double [ ] DIRECTION = new double [ ] { Entity . NONE , Entity . E , Entity . W , Entity . NONE , Entity . S , Entity . SE , Entity . SW , Entity . S , Entity . N , Entity . NE , Entity . NW , Entity . N , Entity . NONE , Entity . E , Entity . W , Entity . NONE } ; protected final LD31 context ; protected final Level level ; protected double speedMultiplier = 1.0 ; private Vector2 pos = new Vector2 ( ) ; public int color ; public Entity ( Level level , int color ) { } private boolean validPosition ( int x , int y ) { } public boolean move ( boolean w , boolean s , boolean a , boolean d ) { } public boolean move ( double angle ) { } private boolean move0 ( Vector2 offset , boolean tryBop ) { } private boolean checkOffset ( Vector2 offset ) { } public void setPos ( Vector2 pos ) { } public int x ( ) { } public int y ( ) { } public int screenX ( ) { } public int screenY ( ) { } public Vector2 pos ( ) { } public Node toNode ( ) { } public void rayTrace ( final int [ ] array , final int viewDistance , final int lightColor ) { int cx = screenX ( ) ; int cy = screenY ( ) ; if ( context . contains ( cx , cy ) ) { Trace . circle ( cx , cy , viewDistance , true , ( x0 , y0 ) -> { <START_BUG> Trace . line ( cx , cy , PApplet . min ( ( context . width - 1 ) , PApplet . max ( 0 , x0 ) ) , PApplet . min ( ( context . height - 1 ) , PApplet . max ( 0 , y0 ) ) , ( x , y ) -> { <END_BUG> int i = ( y * context . lastWidth ) + x ; if ( ( array [ i ] ) == Level . FLOOR_NONE ) return false ; array [ i ] |= lightColor ; return true ; } ) ; return true ; } ) ; } else { Trace . circle ( cx , cy , viewDistance , true , ( x0 , y0 ) -> { if ( context . contains ( x0 , y0 ) ) { Trace . line ( cx , cy , x0 , y0 , ( x , y ) -> { if ( ! ( context . contains ( x , y ) ) ) return true ; int i = ( y * context . lastWidth ) + x ; if ( ( array [ i ] ) == Level . FLOOR_NONE ) return false ; array [ i ] |= lightColor ; return true ; } ) ; } return true ; } ) ; } } @ Override public void render ( ) { } }

Fix:
Trace . line ( cx , cy , PApplet . min ( ( context . lastWidth - 1 ) , PApplet . max ( 0 , x0 ) ) , PApplet . min ( ( context . lastHeight - 1 ) , PApplet . max ( 0 , y0 ) ) , ( x , y ) -> {
Buggy code:
public class XMIParser { public static XMIParser SINGLETON = new XMIParser ( ) ; protected MModel _curModel = null ; protected Project _proj = null ; protected HashMap _UUIDRefs = null ; protected XMIParser ( ) { } public MModel getCurModel ( ) { } public void setProject ( Project p ) { } public HashMap getUUIDRefs ( ) { } public synchronized void readModels ( Project p , URL url ) throws IOException { _proj = p ; log . info ( "=======================================" ) ; log . info ( ( "==<seq2seq4repair_space>READING<seq2seq4repair_space>MODEL<seq2seq4repair_space>" + url ) ) ; try { XMIReader reader = new XMIReader ( ) ; InputSource source = new InputSource ( url . openStream ( ) ) ; source . setSystemId ( url . toString ( ) ) ; _curModel = reader . parseToModel ( source ) ; if ( reader . getErrors ( ) ) { throw new IOException ( ( ( "XMI<seq2seq4repair_space>file<seq2seq4repair_space>" + ( url . toString ( ) ) ) + "<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>parsed." ) ) ; } _UUIDRefs = new HashMap ( reader . getXMIUUIDToObjectMap ( ) ) ; } catch ( SAXException saxEx ) { Exception ex = saxEx . getException ( ) ; if ( ex == null ) { saxEx . printStackTrace ( ) ; } else { ex . printStackTrace ( ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } log . info ( "=======================================" ) ; _proj . addModel ( ( ( MNamespace ) ( _curModel ) ) ) ; Collection ownedElements = _curModel . getOwnedElements ( ) ; Iterator oeIterator = ownedElements . iterator ( ) ; while ( oeIterator . hasNext ( ) ) { MModelElement me = ( ( MModelElement ) ( oeIterator . next ( ) ) ) ; if ( ( me . getName ( ) ) == null ) <START_BUG> me . setName ( "anon" ) ; <END_BUG> } } }

Fix:
me . setName ( "" ) ;
Buggy code:
public class IDFactory implements IIDFactory { public static final String SECURITY_PROPERTY = ( IDFactory . class . getName ( ) ) + ".security" ; private static final int IDENTITY_CREATION_ERRORCODE = 2001 ; private static Hashtable namespaces = new Hashtable ( ) ; private static boolean securityEnabled = false ; protected static IIDFactory instance = null ; protected IDFactory ( ) { } public static IIDFactory getDefault ( ) { } public Namespace addNamespace ( Namespace namespace ) throws SecurityException { } protected static final Namespace addNamespace0 ( Namespace namespace ) { } protected static final void checkPermission ( NamespacePermission namespacepermission ) throws SecurityException { } public boolean containsNamespace ( Namespace namespace ) throws SecurityException { } public List getNamespaces ( ) { } protected static final boolean containsNamespace0 ( Namespace n ) { } public Namespace getNamespace ( Namespace namespace ) throws SecurityException { } public Namespace getNamespaceByName ( String name ) throws SecurityException { } protected static final Namespace getNamespace0 ( Namespace n ) { } protected static final Namespace getNamespace0 ( String name ) { } public ID createGUID ( ) throws IDCreateException { } public ID createGUID ( int length ) throws IDCreateException { } protected static void logAndThrow ( String s , Throwable t ) throws IDCreateException { } public ID createID ( Namespace n , Object [ ] args ) throws IDCreateException { } public ID createID ( String namespacename , Object [ ] args ) throws IDCreateException { } public ID createID ( Namespace namespace , String uri ) throws IDCreateException { } public ID createID ( String namespace , String uri ) throws IDCreateException { } public ID createStringID ( String idstring ) throws IDCreateException { } public ID createLongID ( long l ) throws IDCreateException { } public Namespace removeNamespace ( Namespace n ) throws SecurityException { } protected static final Namespace removeNamespace0 ( Namespace n ) { if ( n == null ) return null ; <START_BUG> return ( ( Namespace ) ( IDFactory . namespaces . remove ( n ) ) ) ; <END_BUG> } }

Fix:
return ( ( Namespace ) ( IDFactory . namespaces . remove ( n . getName ( ) ) ) ) ;
Buggy code:
public class Multicast { MessagePasser mp ; HashMap < String , int [ ] > vectorMap = new HashMap < > ( ) ; HashMap < String , LinkedList < Message > > holdBackQueueList = new HashMap < String , LinkedList < Message > > ( ) ; public Multicast ( MessagePasser messagePasser ) { } public void send ( Message message ) throws FileNotFoundException { } public synchronized void receive ( Message mes ) throws FileNotFoundException { int [ ] recVec = mes . multicastVector ; int length = mes . groupSize ; int [ ] curVec = new int [ length ] ; <START_BUG> System . out . print ( ( ( "rec:<seq2seq4repair_space>" + ( mes . getMultiVector ( ) ) ) + "<seq2seq4repair_space>\now:<seq2seq4repair_space>" ) ) ; <END_BUG> for ( int i = 0 ; i < length ; i ++ ) { curVec [ i ] = vectorMap . get ( mes . groupName ) [ i ] ; System . out . print ( ( ( curVec [ i ] ) + "<seq2seq4repair_space>" ) ) ; } String check = judge ( mp . u2i . get ( mes . src ) , curVec , recVec ) ; System . out . println ( ( "\n" + check ) ) ; switch ( check ) { case "rec" : System . out . println ( "receive<seq2seq4repair_space>multicast" ) ; mp . messageRec . offer ( mes ) ; forward ( mes ) ; int len = this . holdBackQueueList . get ( mes . groupName ) . size ( ) ; int j = 0 ; int flag = 0 ; while ( j < len ) { Message tmp = this . holdBackQueueList . get ( mes . groupName ) . get ( j ) ; for ( int k = 0 ; k < ( tmp . multicastVector . length ) ; k ++ ) { if ( k != ( mp . u2i . get ( mes . src ) ) ) { if ( ( tmp . multicastVector [ k ] ) > ( curVec [ k ] ) ) { flag = 1 ; break ; } } else { if ( ( tmp . multicastVector [ k ] ) != ( ( curVec [ k ] ) + 1 ) ) { flag = 1 ; break ; } } } if ( flag == 1 ) { break ; } else { System . out . println ( "accept<seq2seq4repair_space>message<seq2seq4repair_space>from<seq2seq4repair_space>buffer" ) ; mp . messageRec . offer ( tmp ) ; forward ( mes ) ; this . holdBackQueueList . get ( mes . groupName ) . removeFirst ( ) ; } j ++ ; } break ; case "drop" : System . out . println ( "drop<seq2seq4repair_space>multicast" ) ; break ; case "hold" : System . out . println ( "holdback<seq2seq4repair_space>multicast" ) ; insert ( this . holdBackQueueList . get ( mes . groupName ) , mes ) ; break ; } } private void forward ( Message mes ) throws FileNotFoundException { } private void insert ( LinkedList < Message > linkedList , Message mes ) { } private String judge ( int index , int [ ] curVec , int [ ] recVec ) { } }

Fix:
System . out . print ( ( ( "rec:<seq2seq4repair_space>" + ( mes . getMultiVector ( ) ) ) + "<seq2seq4repair_space>\nnow:<seq2seq4repair_space>" ) ) ;