nus-yam/ex-repair huggingface dataset:
Buggy code:
public class XSWildcardDecl implements XSWildcard { public static final String ABSENT = null ; public short fType = NSCONSTRAINT_ANY ; public short fProcessContents = PC_STRICT ; public String [ ] fNamespaceList ; public XSAnnotationImpl fAnnotation = null ; public boolean allowNamespace ( String namespace ) { } public boolean isSubsetOf ( XSWildcardDecl superWildcard ) { } public boolean weakerProcessContents ( XSWildcardDecl superWildcard ) { } public XSWildcardDecl performUnionWith ( XSWildcardDecl wildcard , short processContents ) { } public XSWildcardDecl performIntersectionWith ( XSWildcardDecl wildcard , short processContents ) { } private boolean areSame ( XSWildcardDecl wildcard ) { } String [ ] intersect2sets ( String [ ] one , String [ ] theOther ) { } String [ ] union2sets ( String [ ] one , String [ ] theOther ) { } boolean subset2sets ( String [ ] subSet , String [ ] superSet ) { } boolean elementInSet ( String ele , String [ ] set ) { } private String fDescription = null ; public String toString ( ) { } public short getType ( ) { } public String getName ( ) { } public String getNamespace ( ) { } public short getConstraintType ( ) { } public StringList getNsConstraintList ( ) { <START_BUG> return new StringListImpl ( fNamespaceList , fNamespaceList . length ) ; <END_BUG> } public short getProcessContents ( ) { } public String getProcessContentsAsString ( ) { } public XSAnnotation getAnnotation ( ) { } public XSNamespaceItem getNamespaceItem ( ) { } }

Fix:
return new StringListImpl ( fNamespaceList , ( ( fNamespaceList ) == null ? 0 : fNamespaceList . length ) ) ;
Buggy code:
public interface ResourceTransformationDescriptionBuilder extends TransformationDescriptionBuilder { <START_BUG> AttributeTransformationDescriptionBuilder getAttributeBuilder ( ) ; <END_BUG> OperationTransformationOverrideBuilder addOperationTransformationOverride ( String operationName ) { } ResourceTransformationDescriptionBuilder addRawOperationTransformationOverride ( String operationName , OperationTransformer operationTransformer ) { } ResourceTransformationDescriptionBuilder setCustomResourceTransformer ( ResourceTransformer resourceTransformer ) { } ResourceTransformationDescriptionBuilder addChildResource ( PathElement pathElement ) { } ResourceTransformationDescriptionBuilder addChildResource ( ResourceDefinition definition ) { } DiscardTransformationDescriptionBuilder discardChildResource ( PathElement pathElement ) { } ResourceTransformationDescriptionBuilder addChildRedirection ( PathElement current , PathElement legacy ) { } ResourceTransformationDescriptionBuilder addChildRedirection ( PathElement pathElement , PathAddressTransformer pathAddressTransformer ) { } }

Fix:
ConcreteAttributeTransformationDescriptionBuilder getAttributeBuilder ( ) ;
Buggy code:
public class CreateACity { public static void main ( String [ ] args ) { CityApplication app = new CityApplication ( ) ; AppSettings settings = new AppSettings ( true ) ; <START_BUG> settings . setTitle ( "Create<seq2seq4repair_space>a<seq2seq4repair_space>City<seq2seq4repair_space>2015-03-13" ) ; <END_BUG> settings . setWidth ( 800 ) ; settings . setHeight ( 600 ) ; settings . setUseJoysticks ( true ) ; app . setSettings ( settings ) ; app . start ( ) ; } No newline ; at end ; of file ; }

Fix:
settings . setTitle ( "Create<seq2seq4repair_space>a<seq2seq4repair_space>City<seq2seq4repair_space>2016-03-13" ) ;
Buggy code:
public enum DiceValue { CROWN , ANCHOR , HEART , DIAMOND , CLUB , SPADE ; private static Random RANDOM = new Random ( ) ; private static final Map < DiceValue , String > VALUE_REPR_MAP = new HashMap < DiceValue , String > ( ) ; public String toString ( DiceValue value ) { } public static DiceValue getRandom ( ) { <START_BUG> int random = DiceValue . RANDOM . nextInt ( DiceValue . SPADE . ordinal ( ) ) ; <END_BUG> return DiceValue . values ( ) [ random ] ; } }

Fix:
int random = DiceValue . RANDOM . nextInt ( ( ( DiceValue . SPADE . ordinal ( ) ) + 1 ) ) ;
Buggy code:
public class Facility extends AbstractContainerTask implements Configurable { private static final Resources REZ = ResourceManager . getPackageResources ( Facility . class ) ; private String m_namespace ; private AspectHandler m_aspectHandler ; public void configure ( final Configuration configuration ) throws ConfigurationException { final String [ ] attributes = configuration . getAttributeNames ( ) ; for ( int i = 0 ; i < ( attributes . length ) ; i ++ ) { final String name = attributes [ i ] ; final String value = configuration . getAttribute ( name ) ; configure ( this , name , value ) ; } final Configuration [ ] children = configuration . getChildren ( ) ; if ( 1 == ( children . length ) ) { try { <START_BUG> final TypeFactory typeFactory = getTypeFactory ( ROLE ) ; <END_BUG> m_aspectHandler = ( ( AspectHandler ) ( typeFactory . create ( children [ 0 ] . getName ( ) ) ) ) ; } catch ( final Exception e ) { final String message = Facility . REZ . getString ( "facility.no-create.error" , children [ 0 ] . getName ( ) ) ; throw new ConfigurationException ( message , e ) ; } configure ( m_aspectHandler , children [ 0 ] ) ; } else { final String message = Facility . REZ . getString ( "facility.multi-element.error" ) ; throw new ConfigurationException ( message ) ; } } public void setNamespace ( final String namespace ) { } public void execute ( ) throws TaskException { } }

Fix:
final TypeFactory typeFactory = getTypeFactory ( AspectHandler . class ) ;
Buggy code:
public class PackageResourceReference extends ResourceReference { public PackageResourceReference ( Application application , Class scope , String name ) { } public PackageResourceReference ( Application application , String name ) { } public PackageResourceReference ( Class scope , String name ) { } protected Resource newResource ( ) { <START_BUG> return PackageResource . get ( getScope ( ) . getPackage ( ) , getName ( ) , getLocale ( ) , getStyle ( ) ) ; <END_BUG> } }

Fix:
return PackageResource . get ( getScope ( ) , getName ( ) , getLocale ( ) , getStyle ( ) ) ;
Buggy code:
public abstract class AbstractMetamataTask extends Task { protected Path classPath = null ; protected Path sourcePath = null ; protected File metamataHome = null ; protected CommandlineJava cmdl = new CommandlineJava ( ) ; protected Vector fileSets = new Vector ( ) ; protected File optionsFile = null ; protected Hashtable includedFiles = null ; public AbstractMetamataTask ( ) { } protected AbstractMetamataTask ( String className ) { } public void setHome ( final File value ) { } public void setMetamatahome ( final File value ) { } public Path createClasspath ( ) { } public Path createSourcepath ( ) { } public Argument createJvmarg ( ) { } public void setMaxmemory ( String max ) { } public void addFileSet ( FileSet fs ) { } public void execute ( ) throws BuildException { } protected void setUp ( ) throws BuildException { } protected abstract ExecuteStreamHandler createStreamHandler ( ) { } protected void execute0 ( ExecuteStreamHandler handler ) throws BuildException { final Execute process = new Execute ( handler ) ; <START_BUG> log ( cmdl . toString ( ) , MSG_VERBOSE ) ; <END_BUG> process . setCommandline ( cmdl . getCommandline ( ) ) ; try { if ( ( process . execute ( ) ) != 0 ) { throw new BuildException ( "Metamata<seq2seq4repair_space>task<seq2seq4repair_space>failed." ) ; } } catch ( IOException e ) { throw new BuildException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>launch<seq2seq4repair_space>Metamata<seq2seq4repair_space>task" , e ) ; } } protected void cleanUp ( ) { } protected final File getMetamataJar ( File home ) { } protected void checkOptions ( ) throws BuildException { } protected abstract Vector getOptions ( ) { } protected void generateOptionsFile ( File tofile , Vector options ) throws BuildException { } protected Hashtable getFileMapping ( ) { } protected static final void addAllVector ( Vector dest , Enumeration files ) { } protected final File createTmpFile ( ) { } protected Hashtable scanSources ( Hashtable map ) { } protected Hashtable scanSources ( final Hashtable mapping , final String [ ] entries ) { } }

Fix:
log ( cmdl . describeCommand ( ) , MSG_VERBOSE ) ;
Buggy code:
public class TestListOrderedMap < K , V > extends AbstractTestOrderedMap < K , V > { public TestListOrderedMap ( String testName ) { } public static Test suite ( ) { } @ Override public ListOrderedMap < K , V > makeObject ( ) { <START_BUG> return ( ( ListOrderedMap < K , V > ) ( ListOrderedMap . decorate ( new HashMap < K , V > ( ) ) ) ) ; <END_BUG> } @ Override public ListOrderedMap < K , V > makeFullMap ( ) { } public void testGetByIndex ( ) { } public void testGetValueByIndex ( ) { } public void testIndexOf ( ) { } @ SuppressWarnings ( "unchecked" ) public void testSetValueByIndex ( ) { } public void testRemoveByIndex ( ) { } @ SuppressWarnings ( "unchecked" ) public void testPut_intObjectObject ( ) { } public void testPutAllWithIndex ( ) { } public void testValueList_getByIndex ( ) { } @ SuppressWarnings ( "unchecked" ) public void testValueList_setByIndex ( ) { } public void testValueList_removeByIndex ( ) { } public BulkTest bulkTestKeyListView ( ) { } public BulkTest bulkTestValueListView ( ) { } public class TestKeyListView extends AbstractTestList < K > { TestKeyListView ( ) { } @ Override public List < K > makeObject ( ) { return TestListOrderedMap . this . makeObject ( ) . keyList ( ) ; } @ Override public List < K > makeFullCollection ( ) { } @ Override public K [ ] getFullElements ( ) { } @ Override public boolean isAddSupported ( ) { } @ Override public boolean isRemoveSupported ( ) { } @ Override public boolean isSetSupported ( ) { } @ Override public boolean isNullSupported ( ) { } @ Override public boolean isTestSerialization ( ) { } } public class TestValueListView extends AbstractTestList < V > { TestValueListView ( ) { } @ Override public List < V > makeObject ( ) { return TestListOrderedMap . this . makeObject ( ) . valueList ( ) ; } @ Override public List < V > makeFullCollection ( ) { } @ Override public V [ ] getFullElements ( ) { } @ Override public boolean isAddSupported ( ) { } @ Override public boolean isRemoveSupported ( ) { } @ Override public boolean isSetSupported ( ) { } @ Override public boolean isNullSupported ( ) { } @ Override public boolean isTestSerialization ( ) { } } @ Override public String getCompatibilityVersion ( ) { } @ Override public ListOrderedMap < K , V > getMap ( ) { } }

Fix:
return ( ( ListOrderedMap < K , V > ) ( ListOrderedMap . listOrderedMap ( new HashMap < K , V > ( ) ) ) ) ;
Buggy code:
public class AntCall extends AntBase { public void execute ( ) throws AntException { setProperty ( BASEDIR , getExecService ( ) . getBaseDir ( ) . getAbsolutePath ( ) ) ; <START_BUG> Object key = getExecService ( ) . setupBuild ( getProperties ( ) , true ) ; <END_BUG> setSubBuildKey ( key ) ; getExecService ( ) . runBuild ( key , getTargets ( ) ) ; setSubBuildKey ( null ) ; } public void addParam ( Property param ) { } }

Fix:
Object key = getExecService ( ) . setupBuild ( getDataValues ( ) , true ) ;
Buggy code:
public final class RemoveConnectorUpdate extends AbstractRemotingSubsystemUpdate < Void > { private static final long serialVersionUID = - 8965990593053845956L ; private final String name ; public RemoveConnectorUpdate ( final String name ) { } protected < P > void applyUpdate ( UpdateContext updateContext , UpdateResultHandler < ? super Void , P > resultHandler , P param ) { <START_BUG> final ServiceController < ? > controller = updateContext . getServiceContainer ( ) . getService ( ConnectorElement . connectorName ( name ) ) ; <END_BUG> if ( controller == null ) { resultHandler . handleSuccess ( null , param ) ; } else { controller . addListener ( new UpdateResultHandler . ServiceRemoveListener < P > ( resultHandler , param ) ) ; controller . setMode ( REMOVE ) ; } } public AbstractSubsystemUpdate < RemotingSubsystemElement , ? > getCompensatingUpdate ( RemotingSubsystemElement subSystem ) { } protected void applyUpdate ( RemotingSubsystemElement element ) throws UpdateFailedException { } }

Fix:
final ServiceController < ? > controller = updateContext . getServiceRegistry ( ) . getService ( ConnectorElement . connectorName ( name ) ) ;
Buggy code:
public class DateFormatTransformer extends Transformer { private Map < String , SimpleDateFormat > fmtCache = new HashMap < String , SimpleDateFormat > ( ) ; private static final Logger LOG = LoggerFactory . getLogger ( DateFormatTransformer . class ) ; @ Override @ SuppressWarnings ( "unchecked" ) public Object transformRow ( Map < String , Object > aRow , Context context ) { for ( Map < String , String > map : context . getAllEntityFields ( ) ) { <START_BUG> Locale locale = Locale . getDefault ( ) ; <END_BUG> String customLocale = map . get ( "locale" ) ; if ( customLocale != null ) { locale = new Locale ( customLocale ) ; } String fmt = map . get ( DateFormatTransformer . DATE_TIME_FMT ) ; if ( fmt == null ) continue ; String column = map . get ( COLUMN ) ; String srcCol = map . get ( SRC_COL_NAME ) ; if ( srcCol == null ) srcCol = column ; try { Object o = aRow . get ( srcCol ) ; if ( o instanceof List ) { List inputs = ( ( List ) ( o ) ) ; List < Date > results = new ArrayList < Date > ( ) ; for ( Object input : inputs ) { results . add ( process ( input , fmt , locale ) ) ; } aRow . put ( column , results ) ; } else { if ( o != null ) { aRow . put ( column , process ( o , fmt , locale ) ) ; } } } catch ( ParseException e ) { DateFormatTransformer . LOG . warn ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>parse<seq2seq4repair_space>a<seq2seq4repair_space>Date<seq2seq4repair_space>field<seq2seq4repair_space>" , e ) ; } } return aRow ; } private Date process ( Object value , String format , Locale locale ) throws ParseException { } public static final String DATE_TIME_FMT = "dateTimeFormat" ; }

Fix:
Locale locale = Locale . ROOT ;
Buggy code:
public class DefaultConnectableDeviceStore implements ConnectableDeviceStore { public static final String KEY_VERSION = "version" ; public static final String KEY_CREATED = "created" ; public static final String KEY_UPDATED = "updated" ; public static final String KEY_DEVICES = "devices" ; static final int CURRENT_VERSION = 0 ; static final String DIRPATH = "//android//data//connect_sdk//" ; static final String FILENAME = "StoredDevices" ; static final String IP_ADDRESS = "ipAddress" ; static final String FRIENDLY_NAME = "friendlyName" ; static final String MODEL_NAME = "modelName" ; static final String MODEL_NUMBER = "modelNumber" ; static final String SERVICES = "services" ; static final String DESCRIPTION = "description" ; static final String CONFIG = "config" ; static final String FILTER = "filter" ; static final String UUID = "uuid" ; static final String PORT = "port" ; static final String SERVICE_UUID = "serviceUUID" ; static final String CLIENT_KEY = "clientKey" ; static final String SERVER_CERTIFICATE = "serverCertificate" ; static final String PAIRING_KEY = "pairingKey" ; static final String DEFAULT_SERVICE_WEBOSTV = "WebOSTVService" ; static final String DEFAULT_SERVICE_NETCASTTV = "NetcastTVService" ; public long created ; public long updated ; public int version ; public long maxStoreDuration = TimeUnit . DAYS . toSeconds ( 3 ) ; private String fileFullPath ; private JSONObject deviceStore ; private JSONObject storedDevices ; private Map < String , ConnectableDevice > activeDevices = new HashMap < String , ConnectableDevice > ( ) ; private boolean waitToWrite = false ; public DefaultConnectableDeviceStore ( Context context ) { } @ Override public void addDevice ( ConnectableDevice device ) { } @ Override public void removeDevice ( ConnectableDevice device ) { } @ Override public void updateDevice ( ConnectableDevice device ) { } @ Override public void removeAll ( ) { } @ Override public JSONObject getStoredDevices ( ) { } @ Override public ConnectableDevice getDevice ( String uuid ) { } private ConnectableDevice getActiveDevice ( String uuid ) { } private JSONObject getStoredDevice ( String uuid ) { } @ Override public ServiceConfig getServiceConfig ( ServiceDescription serviceDescription ) { if ( serviceDescription == null ) { return null ; } String uuid = serviceDescription . getUUID ( ) ; if ( ( uuid == null ) || ( ( uuid . length ( ) ) == 0 ) ) { return null ; } JSONObject device = getStoredDevice ( uuid ) ; if ( device != null ) { JSONObject services = device . optJSONObject ( KEY_SERVICES ) ; if ( services != null ) { <START_BUG> JSONObject service = services . optJSONObject ( serviceDescription . getServiceID ( ) ) ; <END_BUG> if ( service != null ) { JSONObject serviceConfigInfo = service . optJSONObject ( KEY_CONFIG ) ; if ( serviceConfigInfo != null ) { return ServiceConfig . getConfig ( serviceConfigInfo ) ; } } } } return null ; } private void load ( ) { } private void store ( ) { } private void writeStoreToDisk ( ) { } }

Fix:
JSONObject service = services . optJSONObject ( uuid ) ;
Buggy code:
public class OSGiFrameworkPropertyRemove extends AbstractRemoveStepHandler { static final OSGiFrameworkPropertyRemove INSTANCE = new OSGiFrameworkPropertyRemove ( ) ; private OSGiFrameworkPropertyRemove ( ) { } @ Override protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model ) throws OperationFailedException { <START_BUG> String propName = operation . get ( OP_ADDR ) . asObject ( ) . get ( FRAMEWORK_PROPERTY ) . asString ( ) ; <END_BUG> SubsystemState subsystemState = SubsystemState . getSubsystemState ( context ) ; if ( ( subsystemState != null ) && ( ( context . completeStep ( ) ) == ( ResultAction . KEEP ) ) ) { subsystemState . setProperty ( propName , null ) ; } } static DescriptionProvider DESCRIPTION = new DescriptionProvider ( ) { @ Override public ModelNode getModelDescription ( Locale locale ) { } } ; }

Fix:
String propName = operation . get ( OP_ADDR ) . asObject ( ) . get ( PROPERTY ) . asString ( ) ;
Buggy code:
public final class EmpiricalDistributionTest { protected EmpiricalDistributionImpl empiricalDistribution = null ; protected EmpiricalDistributionImpl empiricalDistribution2 = null ; protected File file = null ; protected URL url = null ; protected double [ ] dataArray = null ; @ Before public void setUp ( ) throws IOException { } @ Test public void testLoad ( ) throws Exception { } @ Test public void testDoubleLoad ( ) throws Exception { empiricalDistribution2 . load ( dataArray ) ; Assert . assertEquals ( empiricalDistribution2 . getSampleStats ( ) . getN ( ) , 1000 , 1.0E-6 ) ; Assert . assertEquals ( empiricalDistribution2 . getSampleStats ( ) . getMean ( ) , 5.069831575018909 , 1.0E-6 ) ; Assert . assertEquals ( empiricalDistribution2 . getSampleStats ( ) . getStandardDeviation ( ) , 1.0173699343977738 , 1.0E-6 ) ; <START_BUG> double [ ] bounds = ( ( EmpiricalDistributionImpl ) ( empiricalDistribution2 ) ) . getGeneratorUpperBounds ( ) ; <END_BUG> Assert . assertEquals ( bounds . length , 100 ) ; Assert . assertEquals ( bounds [ 99 ] , 1.0 , 1.0E-11 ) ; } @ Test public void testNext ( ) throws Exception { } @ Test public void testNexFail ( ) { } @ Test public void testGridTooFine ( ) throws Exception { } @ Test public void testGridTooFat ( ) throws Exception { } @ Test public void testBinIndexOverflow ( ) throws Exception { } @ Test public void testSerialization ( ) { } @ Test ( expected = NullArgumentException . class ) public void testLoadNullDoubleArray ( ) { } @ Test ( expected = NullArgumentException . class ) public void testLoadNullURL ( ) throws Exception { } @ Test ( expected = NullArgumentException . class ) public void testLoadNullFile ( ) throws Exception { } @ Test public void testGetBinUpperBounds ( ) { } @ Test public void testGeneratorConfig ( ) { } @ Test public void testReSeed ( ) throws Exception { } private void verifySame ( EmpiricalDistribution d1 , EmpiricalDistribution d2 ) { } private void tstGen ( double tolerance ) throws Exception { } private void tstDoubleGen ( double tolerance ) throws Exception { } }

Fix:
double [ ] bounds = empiricalDistribution2 . getGeneratorUpperBounds ( ) ;
Buggy code:
public class HeaderTest extends WicketTestCase { public HeaderTest ( String name ) { } public void test_1 ( ) throws Exception { executeTest ( TestPage . class , "TestPage_ExpectedResult-1.html" ) ; <START_BUG> TestPage page = ( ( TestPage ) ( application . getLastRenderedPage ( ) ) ) ; <END_BUG> executedListener ( TestPage . class , page . get ( "link" ) , "TestPage_ExpectedResult-2.html" ) ; } }

Fix:
TestPage page = ( ( TestPage ) ( tester . getLastRenderedPage ( ) ) ) ;
Buggy code:
public class ReloadSchemasTest extends AbstractTestCase { private final URI Ns1_A = uri ( "//Ns1-A.xsd" ) ; private final URI Ns1_B = uri ( "//Ns1-B.xsd" ) ; private final URI Ns1_C_AB = uri ( "//Ns1-C-AB.xsd" ) ; private final URI Ns2_K_C = uri ( "//Ns2-K-C.xsd" ) ; private final URI Ns2_L_K = uri ( "//Ns2-L-K.xsd" ) ; private final URI Ns3_M_C = uri ( "//Ns3-M-C.xsd" ) ; private void assertNoReferencesToPackage ( XSDManager rs , EPackage p ) { } private void assertNoReferencesToPackage ( Set < EPackage > allowedPackages , EObject obj ) { for ( EReference ref : obj . eClass ( ) . getEAllReferences ( ) ) { Object o = obj . eGet ( ref ) ; <START_BUG> if ( ( obj instanceof EPackage ) && ( ! ( allowedPackages . contains ( ( ( EPackage ) ( obj ) ) ) ) ) ) <END_BUG> fail2 ( Msg . create ( "Supplied<seq2seq4repair_space>object<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>forbidden<seq2seq4repair_space>package:" ) . pkg ( ( ( EPackage ) ( obj ) ) ) ) ; if ( o instanceof EClassifier ) { EClassifier cc = ( ( EClassifier ) ( o ) ) ; if ( ! ( allowedPackages . contains ( cc . getEPackage ( ) ) ) ) fail2 ( Msg . create ( "Reference<seq2seq4repair_space>to<seq2seq4repair_space>" ) . pkg ( cc . getEPackage ( ) ) . txt ( "<seq2seq4repair_space>found:" ) . path ( obj ) . txt ( "->" ) . txt ( ref . getName ( ) ) ) ; } } } private void assertNoReferencesToSchema ( EObject obj , EReference ref , Object o , XSDSchema schema ) { } private void assertNoReferencesToSchema ( OawXSDResourceSet rs , XSDSchema schema ) { } private void assertNoReferencesToSchemaFromFeature ( EObject obj , XSDSchema schema ) { } private void assertSchemaLoaded ( OawXSDResourceSet rs , URI uri , boolean expectEcore ) { } private void fail2 ( Msg msg ) { } private void reloadPackage ( URI uri ) { } public void testLoadAll ( ) { } public void testReloadPackageA ( ) { } public void testReloadPackageB ( ) { } public void testReloadPackageCAB ( ) { } public void testReloadPackageKC ( ) { } public void testReloadPackageLK ( ) { } public void testRemove ( ) { } public void testUnloadRootPackage ( ) { } public void testUnloadRootSchema ( ) { } private URI uri ( String file ) { } public void testLoadIncludes ( ) { } }

Fix:
if ( ( obj instanceof EPackage ) && ( ! ( allowedPackages . contains ( obj ) ) ) )
Buggy code:
public class PacketParser { private GUI gui ; private Client client ; private Level level ; public PacketParser ( GUI gui , Client client , Level level ) { } public void parsePacket ( byte [ ] data , InetAddress address , int port ) { String message = new String ( data ) . trim ( ) ; PacketType type = Packet . lookupPacket ( message . substring ( 0 , 2 ) ) ; switch ( type ) { case INVALID : break ; case LOGIN : Packet00Login packet = new Packet00Login ( data ) ; gui . addMessage ( ( ( packet . getUsername ( ) ) + "<seq2seq4repair_space>has<seq2seq4repair_space>joined<seq2seq4repair_space>the<seq2seq4repair_space>game." ) ) ; NetPlayer player = new NetPlayer ( null , packet . getUsername ( ) , null , ( - 1 ) , level ) ; client . addConnection ( player , packet ) ; break ; case DISCONNECT : Packet01Disconnect disconnectPacket = new Packet01Disconnect ( data ) ; gui . addMessage ( ( ( disconnectPacket . getUsername ( ) ) + "<seq2seq4repair_space>has<seq2seq4repair_space>left<seq2seq4repair_space>the<seq2seq4repair_space>game." ) ) ; client . removeConnection ( disconnectPacket ) ; break ; case MOVE : Packet02Move movePacket = new Packet02Move ( data ) ; client . handleMove ( movePacket ) ; break ; case CHAT : Packet03Chat chatPacket = new Packet03Chat ( data ) ; gui . addMessage ( ( ( ( chatPacket . getUsername ( ) ) + ":<seq2seq4repair_space>" ) + ( chatPacket . getMessage ( ) ) ) ) ; break ; case Q : Packet04Q qPacket = new Packet04Q ( data ) ; <START_BUG> level . addEntity ( new QSpell ( level . getPlayer ( qPacket . getUsername ( ) ) . getPosition ( ) , qPacket . getDirection ( ) , level ) ) ; <END_BUG> default : break ; } } }

Fix:
level . addEntity ( new SonicWave ( level . getPlayer ( qPacket . getUsername ( ) ) . getPosition ( ) , qPacket . getDirection ( ) , level ) ) ;
Buggy code:
public class ConstructorDeclaration extends AbstractMethodDeclaration { public ExplicitConstructorCall constructorCall ; public boolean isDefaultConstructor = false ; public TypeParameter [ ] typeParameters ; public ConstructorDeclaration ( CompilationResult compilationResult ) { } public void analyseCode ( ClassScope classScope , InitializationFlowContext initializerFlowContext , FlowInfo flowInfo ) { } public void generateCode ( ClassScope classScope , ClassFile classFile ) { } public void generateSyntheticFieldInitializationsIfNecessary ( MethodScope methodScope , CodeStream codeStream , ReferenceBinding declaringClass ) { } private void internalGenerateCode ( ClassScope classScope , ClassFile classFile ) { } public boolean isConstructor ( ) { } public boolean isDefaultConstructor ( ) { } public boolean isInitializationMethod ( ) { } public boolean isRecursive ( ArrayList visited ) { } public void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) { } public StringBuffer printBody ( int indent , StringBuffer output ) { } public void resolveJavadoc ( ) { } public void resolveStatements ( ) { if ( ! ( CharOperation . equals ( this . scope . enclosingSourceType ( ) . sourceName , selector ) ) ) { this . scope . problemReporter ( ) . missingReturnType ( this ) ; } if ( ( this . typeParameters ) != null ) { for ( int i = 0 , length = this . typeParameters . length ; i < length ; i ++ ) { this . typeParameters [ i ] . resolve ( this . scope ) ; } } if ( ( this . constructorCall ) != null ) { if ( ( ( ( this . binding ) != null ) && ( ( this . binding . declaringClass . id ) == ( TypeIds . T_JavaLangObject ) ) ) && ( ( this . constructorCall . accessMode ) != ( ExplicitConstructorCall . This ) ) ) { if ( ( this . constructorCall . accessMode ) == ( ExplicitConstructorCall . Super ) ) { this . scope . problemReporter ( ) . cannotUseSuperInJavaLangObject ( this . constructorCall ) ; } this . constructorCall = null ; } else { this . constructorCall . resolve ( this . scope ) ; } } <START_BUG> if ( ( ( modifiers ) & ( AccSemicolonBody ) ) != 0 ) { <END_BUG> this . scope . problemReporter ( ) . methodNeedBody ( this ) ; } super . resolveStatements ( ) ; } public void traverse ( ASTVisitor visitor , ClassScope classScope ) { } public TypeParameter [ ] typeParameters ( ) { } }

Fix:
if ( ( ( this . modifiers ) & ( ExtraCompilerModifiers . AccSemicolonBody ) ) != 0 ) {
Buggy code:
public abstract class SimpleTemplateDocTestCase extends SQLRepositoryTestCase { protected abstract Blob getTemplateBlob ( ) { } @ Override public void setUp ( ) throws Exception { } protected TemplateBasedDocument setupTestDocs ( ) throws Exception { } protected List < TemplateInput > getTestParams ( ) { List < TemplateInput > params = new ArrayList < TemplateInput > ( ) ; TemplateInput input1 = new TemplateInput ( "StringVar" , "John<seq2seq4repair_space>Smith" ) ; TemplateInput input2 = new TemplateInput ( "DateVar" , new Date ( ) ) ; TemplateInput input3 = new TemplateInput ( "Description" ) ; <START_BUG> input3 . setType ( StringValue ) ; <END_BUG> input3 . setSource ( "dc:description" ) ; TemplateInput input4 = new TemplateInput ( "BooleanVar" , new Boolean ( false ) ) ; TemplateInput input5 = new TemplateInput ( "picture" ) ; input5 . setType ( PictureProperty ) ; input5 . setSource ( "files:files//0//file" ) ; params . add ( input1 ) ; params . add ( input2 ) ; params . add ( input3 ) ; params . add ( input4 ) ; params . add ( input5 ) ; return params ; } @ Override public void tearDown ( ) { } }

Fix:
input3 . setType ( PictureProperty ) ;
Buggy code:
public class Memtable implements Comparable < Memtable > , IFlushable { private static final Logger logger = LoggerFactory . getLogger ( Memtable . class ) ; private boolean isFrozen ; private final AtomicLong currentThroughput = new AtomicLong ( 0 ) ; private final AtomicLong currentOperations = new AtomicLong ( 0 ) ; private final long creationTime ; private final ConcurrentNavigableMap < DecoratedKey , ColumnFamily > columnFamilies = new ConcurrentSkipListMap < DecoratedKey , ColumnFamily > ( ) ; public final ColumnFamilyStore cfs ; private final long THRESHOLD ; private final long THRESHOLD_COUNT ; public Memtable ( ColumnFamilyStore cfs ) { } public int compareTo ( Memtable rhs ) { } public long getCurrentThroughput ( ) { } public long getCurrentOperations ( ) { } boolean isThresholdViolated ( ) { } boolean isFrozen ( ) { } void freeze ( ) { } void put ( DecoratedKey key , ColumnFamily columnFamily ) { } private void resolve ( DecoratedKey key , ColumnFamily cf ) { } public String contents ( ) { } private SSTableReader writeSortedContents ( ) throws IOException { Memtable . logger . info ( ( "Writing<seq2seq4repair_space>" + ( this ) ) ) ; <START_BUG> SSTableWriter writer = cfs . createFlushWriter ( columnFamilies . size ( ) ) ; <END_BUG> for ( Map . Entry < DecoratedKey , ColumnFamily > entry : columnFamilies . entrySet ( ) ) writer . append ( entry . getKey ( ) , entry . getValue ( ) ) ; SSTableReader ssTable = writer . closeAndOpenReader ( ) ; Memtable . logger . info ( String . format ( "Completed<seq2seq4repair_space>flushing<seq2seq4repair_space>%s<seq2seq4repair_space>(%d<seq2seq4repair_space>bytes)" , ssTable . getFilename ( ) , new File ( ssTable . getFilename ( ) ) . length ( ) ) ) ; return ssTable ; } public void flushAndSignal ( final CountDownLatch latch , ExecutorService sorter , final ExecutorService writer ) { } public String toString ( ) { } public Iterator < Map . Entry < DecoratedKey , ColumnFamily > > getEntryIterator ( DecoratedKey startWith ) { } public boolean isClean ( ) { } public String getTableName ( ) { } public static IColumnIterator getSliceIterator ( final DecoratedKey key , final ColumnFamily cf , SliceQueryFilter filter , AbstractType typeComparator ) { } public static IColumnIterator getNamesIterator ( final DecoratedKey key , final ColumnFamily cf , final NamesQueryFilter filter ) { } public ColumnFamily getColumnFamily ( DecoratedKey key ) { } void clearUnsafe ( ) { } public boolean isExpired ( ) { } }

Fix:
SSTableWriter writer = new SSTableWriter ( cfs . getFlushPath ( ) , columnFamilies . size ( ) , cfs . metadata , cfs . partitioner ) ;
Buggy code:
public class SpecialSemanticChecks { public static void validateMainFunction ( Program program ) throws SemanticError { int mainMethodCount = 0 ; for ( ICClass icClass : program . getClasses ( ) ) { Symbol mainSymbol = ( ( IC . Symbols . ClassSymbolTable ) ( icClass . getEnclosingScopeSymTable ( ) ) ) . getMethods ( ) . get ( "main" ) ; if ( mainSymbol != null ) { if ( ( mainSymbol . getKind ( ) ) == ( Kind . MemberVariable ) ) { continue ; } else if ( ( mainSymbol . getKind ( ) ) == ( Kind . Method ) ) { <START_BUG> throw new SemanticError ( SpecialSemanticChecks . getMethodFromClass ( icClass , "main" ) . getLine ( ) , String . format ( "invalid<seq2seq4repair_space>main<seq2seq4repair_space>method<seq2seq4repair_space>signeture" ) ) ; <END_BUG> } else if ( ( mainSymbol . getKind ( ) ) == ( Kind . StaticMethod ) ) { MethodType mainType = ( ( MethodType ) ( mainSymbol . getType ( ) ) ) ; if ( ( ( mainType . getMethod ( ) . getRetType ( ) . equals ( voidType ) ) && ( ( mainType . getMethod ( ) . getParams ( ) . length ) == 1 ) ) && ( mainType . getMethod ( ) . getParams ( ) [ 0 ] . equals ( uniqueArrayTypes . get ( strType ) ) ) ) { mainMethodCount ++ ; if ( mainMethodCount > 1 ) { throw new SemanticError ( SpecialSemanticChecks . getMethodFromClass ( icClass , "main" ) . getLine ( ) , String . format ( "more<seq2seq4repair_space>than<seq2seq4repair_space>one<seq2seq4repair_space>main<seq2seq4repair_space>function<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>allowed" ) ) ; } } else { throw new SemanticError ( SpecialSemanticChecks . getMethodFromClass ( icClass , "main" ) . getLine ( ) , String . format ( "invalid<seq2seq4repair_space>main<seq2seq4repair_space>method<seq2seq4repair_space>signeture" ) ) ; } } } } if ( mainMethodCount < 1 ) { throw new SemanticError ( program . getLine ( ) , String . format ( "program<seq2seq4repair_space>miss<seq2seq4repair_space>main<seq2seq4repair_space>method" ) ) ; } } private static Method getMethodFromClass ( ICClass icClass , String methodName ) { } public static void checkLibraryNameCorrectness ( ICClass libraryClass ) throws SemanticError { } public static void allNoneVoidMethodReturnsNoneVoidType ( Program program ) throws SemanticError { } private static boolean allPathsReturnNoneVoidValue ( List < Statement > statementlist ) { } private static boolean allPathsReturnNoneVoidValue ( Statement operation ) { } public static void allLocalVarsInit ( Program program ) throws SemanticError { } private static int allMethodLocalVarsInit ( List < Statement > statements ) throws SemanticError { } private static List < Statement > collectStmtsForSpecificLocalVar ( List < Statement > statements , int startStmtIndex ) { } private static int isVarInit ( List < Statement > statements , String varName ) { } private static boolean isExpContainsVar ( Expression expression , String id ) { } }

Fix:
throw new SemanticError ( SpecialSemanticChecks . getMethodFromClass ( icClass , "main" ) . getLine ( ) , String . format ( "invalid<seq2seq4repair_space>main<seq2seq4repair_space>method<seq2seq4repair_space>signature" ) ) ;
Buggy code:
public class SubmitLink extends Button { private static final long serialVersionUID = 1L ; private Form form ; public SubmitLink ( String id ) { } public SubmitLink ( String id , IModel model ) { } public SubmitLink ( String id , Form form ) { } public SubmitLink ( String id , IModel model , Form form ) { } protected void onComponentTag ( ComponentTag tag ) { } private String getTriggerJavaScript ( ) { Form form = getForm ( ) ; StringBuffer sb = new StringBuffer ( 100 ) ; sb . append ( "document.getElementById('" ) ; <START_BUG> sb . append ( form . getHiddenFieldId ( ) ) ; <END_BUG> sb . append ( "\').name=\'" ) ; sb . append ( getInputName ( ) ) ; sb . append ( "';" ) ; sb . append ( "var<seq2seq4repair_space>f=document.getElementById('" ) ; sb . append ( form . getJavascriptId ( ) ) ; sb . append ( "');" ) ; if ( shouldInvokeJavascriptFormOnsubmit ( ) ) { sb . append ( "if<seq2seq4repair_space>(f.onsubmit<seq2seq4repair_space>!=<seq2seq4repair_space>undefined)<seq2seq4repair_space>{<seq2seq4repair_space>if<seq2seq4repair_space>(f.onsubmit()==false)<seq2seq4repair_space>return<seq2seq4repair_space>false;<seq2seq4repair_space>}" ) ; } sb . append ( "f.submit();return<seq2seq4repair_space>false;" ) ; return sb . toString ( ) ; } public final Form getForm ( ) { } protected boolean shouldInvokeJavascriptFormOnsubmit ( ) { } }

Fix:
sb . append ( form . getHiddenFieldId ( HIDDEN_FIELD_FAKE_SUBMIT ) ) ;
Buggy code:
public class StreamingTransferTest extends CleanupHelper { public static final InetAddress LOCAL = FBUtilities . getLocalAddress ( ) ; @ BeforeClass public static void setup ( ) throws Exception { } @ Test public void testTransferTable ( ) throws Exception { } @ Test public void testTransferTableMultiple ( ) throws Exception { } @ Test public void testTransferOfMultipleColumnFamilies ( ) throws Exception { String keyspace = "Keyspace1" ; IPartitioner p = StorageService . getPartitioner ( ) ; String [ ] columnFamilies = new String [ ] { "Standard1" , "Standard2" , "Standard3" } ; List < SSTableReader > ssTableReaders = new ArrayList < SSTableReader > ( ) ; List < Range > ranges = new ArrayList < Range > ( ) ; for ( String cf : columnFamilies ) { Set < String > content = new HashSet < String > ( ) ; content . add ( ( ( "data-" + cf ) + "-1" ) ) ; content . add ( ( ( "data-" + cf ) + "-2" ) ) ; content . add ( ( ( "data-" + cf ) + "-3" ) ) ; SSTableUtils . Context context = SSTableUtils . prepare ( ) . ks ( keyspace ) . cf ( cf ) ; ssTableReaders . add ( context . write ( content ) ) ; ranges . add ( new Range ( p . getMinimumToken ( ) , p . getToken ( ByteBufferUtil . bytes ( ( ( "data-" + cf ) + "-3" ) ) ) ) ) ; } StreamOutSession session = StreamOutSession . create ( keyspace , StreamingTransferTest . LOCAL , null ) ; <START_BUG> StreamOut . transferSSTables ( session , ssTableReaders , ranges ) ; <END_BUG> session . await ( ) ; for ( String cf : columnFamilies ) { ColumnFamilyStore store = Table . open ( keyspace ) . getColumnFamilyStore ( cf ) ; List < Row > rows = Util . getRangeSlice ( store ) ; assert ( rows . size ( ) ) >= 3 ; for ( int i = 0 ; i < 3 ; i ++ ) { String expectedKey = ( ( "data-" + cf ) + "-" ) + ( i + 1 ) ; Assert . assertEquals ( p . decorateKey ( ByteBufferUtil . bytes ( expectedKey ) ) , rows . get ( i ) . key ) ; } } } }

Fix:
StreamOut . transferSSTables ( session , ssTableReaders , ranges , BOOTSTRAP ) ;
Buggy code:
public class RefPubDAOTest extends TestCase { private static String FIGIS_SCHEMA = "FIGIS" ; private static String FIGIS_TEST_TABLE = "FIC_ITEM" ; private static PersistenceServiceInterface ps ; public RefPubDAOTest ( String testName ) { } public static Test suite ( ) { <START_BUG> RefPubDAOTest . ps = new PersistenceServiceImplementation ( ) ; <END_BUG> return new TestSuite ( RefPubDAOTest . class ) ; } public void testGetTableInfo ( ) { } public void testGetConcepts ( ) { } public void testGetConcept ( ) { } public void testGetCodelistForConcept ( ) { } public void testGetDefaultCodelistFromConcept ( ) { } public void testGetCodeList ( ) { } public void testGetObject ( ) { } public void testGetObjectById ( ) { } public void testGetAttributeForSingleObject ( ) { } public void testGetObjectsByCodeList ( ) { } public void testGetCodeList_list ( ) { } public void testGetCodeList_listByConcept ( ) { } public void testGetTableColumns ( ) { } public void testGetParentHierarchy ( ) { } public void testGhildrenHierarchy ( ) { } }

Fix:
RefPubDAOTest . ps = new PersistenceServiceImplementation ( "//work//FIGIS//refpub_data//conf//mybatis//mybatis-config.xml" ) ;
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 { } protected void loadResource ( String name ) { } protected void loadEnvironment ( String prefix ) { } protected void addProperties ( Properties props ) { resolveAllProperties ( props ) ; Enumeration e = props . keys ( ) ; while ( e . hasMoreElements ( ) ) { String name = ( ( String ) ( e . nextElement ( ) ) ) ; String value = ( ( String ) ( props . getProperty ( name ) ) ) ; <START_BUG> String v = ProjectHelper . replaceProperties ( project , value , project . getProperties ( ) ) ; <END_BUG> addProperty ( name , v ) ; } } protected void addProperty ( String n , String v ) { } private void resolveAllProperties ( Properties props ) throws BuildException { } }

Fix:
String v = ProjectHelper . replaceProperties ( project , value ) ;
Buggy code:
public class TypeVariableBinding extends ReferenceBinding { public Binding declaringElement ; public int rank ; public ReferenceBinding firstBound ; public ReferenceBinding superclass ; public ReferenceBinding [ ] superInterfaces ; public char [ ] genericTypeSignature ; public TypeVariableBinding ( char [ ] sourceName , Binding declaringElement , int rank ) { } public int kind ( ) { } public boolean boundCheck ( Substitution substitution , TypeBinding argumentType ) { } public boolean canBeInstantiated ( ) { } public void collectSubstitutes ( Scope scope , TypeBinding otherType , Map substitutes , int constraint ) { } public char [ ] constantPoolName ( ) { } public char [ ] computeUniqueKey ( ) { } public String debugName ( ) { } public TypeBinding erasure ( ) { } public ReferenceBinding findSuperTypeErasingTo ( int erasureId , boolean erasureIsClass ) { } public ReferenceBinding findSuperTypeErasingTo ( ReferenceBinding erasure ) { if ( ( this ) == erasure ) return this ; ReferenceBinding currentType = this ; <START_BUG> if ( ( ( erasure . modifiers ) & ( AccInterface ) ) == 0 ) { <END_BUG> while ( ( currentType = currentType . superclass ( ) ) != null ) { if ( ( currentType == erasure ) || ( ( currentType . erasure ( ) ) == erasure ) ) return currentType ; } return null ; } ReferenceBinding [ ] [ ] interfacesToVisit = new ReferenceBinding [ 5 ] [ ] ; int lastPosition = - 1 ; do { ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != ( NoSuperInterfaces ) ) { if ( ( ++ lastPosition ) == ( interfacesToVisit . length ) ) System . arraycopy ( interfacesToVisit , 0 , ( interfacesToVisit = new ReferenceBinding [ lastPosition * 2 ] [ ] ) , 0 , lastPosition ) ; interfacesToVisit [ lastPosition ] = itsInterfaces ; } } while ( ( currentType = currentType . superclass ( ) ) != null ) ; for ( int i = 0 ; i <= lastPosition ; i ++ ) { ReferenceBinding [ ] interfaces = interfacesToVisit [ i ] ; for ( int j = 0 , length = interfaces . length ; j < length ; j ++ ) { if ( ( ( currentType = interfaces [ j ] ) == erasure ) || ( ( currentType . erasure ( ) ) == erasure ) ) return currentType ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != ( NoSuperInterfaces ) ) { if ( ( ++ lastPosition ) == ( interfacesToVisit . length ) ) System . arraycopy ( interfacesToVisit , 0 , ( interfacesToVisit = new ReferenceBinding [ lastPosition * 2 ] [ ] ) , 0 , lastPosition ) ; interfacesToVisit [ lastPosition ] = itsInterfaces ; } } } return null ; } public char [ ] genericSignature ( ) { } public char [ ] genericTypeSignature ( ) { } public boolean isErasureBoundTo ( TypeBinding type ) { } public boolean isTypeVariable ( ) { } public TypeVariableBinding original ( ) { } public char [ ] readableName ( ) { } ReferenceBinding resolve ( LookupEnvironment environment ) { } public char [ ] shortReadableName ( ) { } public ReferenceBinding superclass ( ) { } public ReferenceBinding [ ] superInterfaces ( ) { } public String toString ( ) { } }

Fix:
if ( ! ( erasure . isInterface ( ) ) ) {
Buggy code:
public class ModClusterRemoveProxy implements OperationStepHandler , DescriptionProvider { static final ModClusterRemoveProxy INSTANCE = new ModClusterRemoveProxy ( ) ; @ Override public ModelNode getModelDescription ( Locale locale ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { <START_BUG> if ( ( context . getType ( ) ) == ( Type . SERVER ) ) { <END_BUG> context . addStep ( new OperationStepHandler ( ) { @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { ServiceController < ? > controller = context . getServiceRegistry ( false ) . getService ( NAME ) ; ModCluster modcluster = ( ( ModCluster ) ( controller . getValue ( ) ) ) ; ModClusterLogger . ROOT_LOGGER . debugf ( "remove-proxy:<seq2seq4repair_space>%s" , operation ) ; Proxy proxy = new Proxy ( operation ) ; modcluster . removeProxy ( proxy . host , proxy . port ) ; context . completeStep ( ) ; } } , RUNTIME ) ; } context . completeStep ( ) ; } }

Fix:
if ( context . getProcessType ( ) . isServer ( ) ) {
Buggy code:
public class SearchRequestHandler { private static final int RESPOND_CODE_SEARCH_UNREACHABLE = 9999 ; private static final int RESPOND_CODE_SEARCH_ERROR = 9998 ; private static final int RESPOND_CODE_SEARCH_SUCCESS = 0 ; private static final int SEARCH_REQUEST_PORT = 1055 ; private static final int MAX_NUMBER_OF_HOPS = 10 ; private static final int Number_OF_FORWARDS = 3 ; private static final int TIME_TO_FORGET_REQUEST = 3000 ; private SearchResponse response ; private final Logger log = Logger . getLogger ( APP_LOGGER_NAME ) ; private final Logger networkLog = Logger . getLogger ( NETWORK_LOGGER_NAME ) ; public synchronized void handle ( SearchRequest request ) { } private void forwardSearchRequest ( SearchRequest request ) { } public void initiateSearch ( String searchQuery ) { SearchRequest ser = new SearchRequest ( GlobalState . getLocalServerNode ( ) , GlobalState . getLocalServerNode ( ) , searchQuery , 0 ) ; ser . setSenderNode ( GlobalState . getLocalServerNode ( ) ) ; ser . setTimestamp ( new Date ( ) . getTime ( ) ) ; System . out . println ( "\nLocal<seq2seq4repair_space>search<seq2seq4repair_space>result\n----------------------" ) ; List < String > localResult = getLocalResult ( ser ) ; if ( localResult . isEmpty ( ) ) { System . out . println ( "no<seq2seq4repair_space>matching<seq2seq4repair_space>result<seq2seq4repair_space>found" ) ; } else { for ( String aLocalResult : localResult ) { System . out . println ( aLocalResult ) ; } } System . out . printf ( "\n\n\nsearching<seq2seq4repair_space>for<seq2seq4repair_space>file<seq2seq4repair_space>in<seq2seq4repair_space>network<seq2seq4repair_space>......\n\n" ) ; GlobalState . setCurrentSearchingRequest ( ser ) ; forwardSearchRequest ( ser ) ; try { <START_BUG> Thread . sleep ( 1000 ) ; <END_BUG> } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } TimerTask printTask = new PrintResponseTask ( ) ; printTask . run ( ) ; } public SearchResponse getResponse ( ) { } public void setResponse ( SearchResponse response ) { } public List < String > getLocalResult ( SearchRequest request ) { } private void sendLocalResult ( SearchRequest request ) { } private static Map < Node , Integer > sortByValues ( Map < Node , Integer > map ) { } }

Fix:
Thread . sleep ( 2000 ) ;