nus-yam/ex-repair huggingface dataset:
Buggy code:
public class StandaloneServer { private static final String STANDALONE_XML = "standalone.xml" ; private final StandardElementReaderRegistrar extensionRegistrar ; static final Logger log = Logger . getLogger ( "org.jboss.as.server" ) ; private final ServerEnvironment environment ; public StandaloneServer ( ServerEnvironment environment ) { } public void start ( ) throws ServerStartException { } public void start ( List < ServiceActivator > serviceActivators ) throws ServerStartException { final File standalone = new File ( environment . getServerConfigurationDir ( ) , StandaloneServer . STANDALONE_XML ) ; if ( ! ( standalone . isFile ( ) ) ) { throw new ServerStartException ( ( ( "File<seq2seq4repair_space>" + ( standalone . getAbsolutePath ( ) ) ) + "<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist." ) ) ; } if ( ! ( standalone . canWrite ( ) ) ) { throw new ServerStartException ( ( ( "File<seq2seq4repair_space>" + ( standalone . getAbsolutePath ( ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>writable." ) ) ; } final List < AbstractServerModelUpdate < ? > > updates = new ArrayList < AbstractServerModelUpdate < ? > > ( ) ; try { final XMLMapper mapper = Factory . create ( ) ; extensionRegistrar . registerStandardStandaloneReaders ( mapper ) ; mapper . parseDocument ( updates , XMLInputFactory . newInstance ( ) . createXMLStreamReader ( new BufferedReader ( new FileReader ( standalone ) ) ) ) ; } catch ( Exception e ) { throw new ServerStartException ( "Caught<seq2seq4repair_space>exception<seq2seq4repair_space>during<seq2seq4repair_space>processing<seq2seq4repair_space>of<seq2seq4repair_space>standalone.xml" , e ) ; } <START_BUG> final ServerStartTask startTask = new ServerStartTask ( "server<seq2seq4repair_space>name" , 0 , serviceActivators , updates , environment ) ; <END_BUG> startTask . run ( Collections . < ServiceActivator > emptyList ( ) ) ; new Thread ( ) { @ Override public void run ( ) { for ( ; ; ) try { Thread . sleep ( 1000000L ) ; } catch ( InterruptedException ignore ) { } } } . start ( ) ; } }

Fix:
final ServerStartTask startTask = new ServerStartTask ( 0 , serviceActivators , updates , environment ) ;
Buggy code:
public class WorkingSet implements IAdaptable , IWorkingSet { static final String FACTORY_ID = "org.eclipse.ui.internal.WorkingSetFactory" ; private String name ; private ArrayList elements ; private String editPageId ; private IMemento workingSetMemento ; private IWorkingSetManager manager ; public WorkingSet ( String name , IAdaptable [ ] elements ) { } WorkingSet ( String name , IMemento memento ) { } public boolean equals ( Object object ) { } public boolean isEditable ( ) { WorkingSetRegistry registry = WorkbenchPlugin . getDefault ( ) . getWorkingSetRegistry ( ) ; String id = getId ( ) ; if ( id == null ) return false ; WorkingSetDescriptor descriptor = registry . getWorkingSetDescriptor ( id ) ; if ( descriptor == null ) return false ; <START_BUG> return ( descriptor . getPageClassName ( ) ) != null ; <END_BUG> } public Object getAdapter ( Class adapter ) { } public IAdaptable [ ] getElements ( ) { } private ArrayList getElementsArray ( ) { } public String getFactoryId ( ) { } public String getId ( ) { } public ImageDescriptor getImage ( ) { } public String getName ( ) { } public int hashCode ( ) { } private void restoreWorkingSet ( ) { } public void saveState ( IMemento memento ) { } public void setElements ( IAdaptable [ ] newElements ) { } private void internalSetElements ( IAdaptable [ ] newElements ) { } public void setId ( String pageId ) { } public void setName ( String newName ) { } public void connect ( IWorkingSetManager manager ) { } public void disconnect ( ) { } private void fireWorkingSetChanged ( String property , Object oldValue ) { } }

Fix:
return descriptor . isEditable ( ) ;
Buggy code:
public class OrderReader { private static final String [ ] FILE_HEADER_MAPPING_TRAIN = new String [ ] { "user" , "sku" , "cat" , "query" , "qtime" , "ctime" } ; private static final String [ ] FILE_HEADER_MAPPING_TEST = new String [ ] { "user" , "cat" , "query" , "qtime" , "ctime" } ; public static List < Order > ReadTrainOrders ( String filename ) { FileReader fileReader = null ; CSVParser csvFileParser = null ; CSVFormat csvFileFormat = DEFAULT . withHeader ( OrderReader . FILE_HEADER_MAPPING_TRAIN ) ; List orders = new ArrayList < Order > ( ) ; try { fileReader = new FileReader ( filename ) ; csvFileParser = new CSVParser ( fileReader , csvFileFormat ) ; List csvRecords = csvFileParser . getRecords ( ) ; <START_BUG> for ( int i = 1 ; i < ( csvRecords . size ( ) ) ; i ++ ) { <END_BUG> CSVRecord record = ( ( CSVRecord ) ( csvRecords . get ( i ) ) ) ; long entered = new SimpleDateFormat ( "yyyy-MM-dd<seq2seq4repair_space>hh:mm:ss" ) . parse ( record . get ( "qtime" ) . substring ( 0 , 19 ) ) . getTime ( ) ; orders . add ( new Order ( record . get ( "sku" ) , record . get ( "user" ) , entered , record . get ( "query" ) ) ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { try { fileReader . close ( ) ; csvFileParser . close ( ) ; } catch ( IOException e ) { System . out . println ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>closing<seq2seq4repair_space>fileReader//csvFileParser<seq2seq4repair_space>!!!" ) ; e . printStackTrace ( ) ; } } return orders ; } public static List < Order > ReadTestOrders ( String filename ) { } public static void main ( String [ ] argv ) { } }

Fix:
for ( int i = 0 ; i < ( csvRecords . size ( ) ) ; i ++ ) {
Buggy code:
public class BasicRule implements Comparable < Rule > , Rule { protected String name ; protected String description ; private int priority ; public BasicRule ( ) { } public BasicRule ( final String name ) { } public BasicRule ( final String name , final String description ) { } public BasicRule ( final String name , final String description , final int priority ) { } public boolean evaluateConditions ( ) { } public void performActions ( ) throws Exception { } public String getName ( ) { } public String getDescription ( ) { } public void setDescription ( String description ) { } public int getPriority ( ) { } public void setPriority ( int priority ) { } @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } @ Override public int compareTo ( final Rule rule ) { if ( ( priority ) < ( rule . getPriority ( ) ) ) { return - 1 ; } else if ( ( priority ) == ( rule . getPriority ( ) ) ) { <START_BUG> return 0 ; <END_BUG> } else { return 1 ; } } }

Fix:
return name . compareTo ( rule . getName ( ) ) ;
Buggy code:
@ Component public class TamaSchedulerService { public static final String IS_RETRY = "isRetry" ; @ Autowired private MotechSchedulerService motechSchedulerService ; @ Qualifier ( "ivrProperties" ) @ Autowired private Properties properties ; @ Autowired private AllPatients allPatients ; public TamaSchedulerService ( ) { } public TamaSchedulerService ( MotechSchedulerService motechSchedulerService , Properties properties , AllPatients allPatients ) { } public void scheduleJobsForFourDayRecall ( Patient patient , TreatmentAdvice treatmentAdvice ) { } private DayOfWeek dayOfWeek ( DayOfWeek dayOfWeek , int count ) { } public void scheduleRepeatingJobsForFourDayRecall ( String patientDocId , String treatmentAdviceId , LocalDate treatmentAdviceStartDate ) { } public void scheduleJobForAdherenceTrendFeedback ( TreatmentAdvice treatmentAdvice ) { } private Date getJobStartDate ( LocalDate startDate ) { } public void unscheduleJobForAdherenceTrendFeedback ( TreatmentAdvice treatmentAdvice ) { } public void scheduleJobForOutboxCall ( Patient patient ) { } public void unscheduleJobForOutboxCall ( Patient patient ) { } public void scheduleRepeatingJobForOutBoxCall ( Patient patient ) { if ( patient . getPatientPreferences ( ) . getCallPreference ( ) . equals ( DailyPillReminder ) ) { Map < String , Object > eventParams = new SchedulerPayloadBuilder ( ) . withJobId ( patient . getId ( ) ) . withExternalId ( patient . getId ( ) ) . payload ( ) ; eventParams . put ( TamaSchedulerService . IS_RETRY , "true" ) ; MotechEvent outboxCallEvent = new MotechEvent ( TAMAConstants . OUTBOX_CALL_SCHEDULER_SUBJECT , eventParams ) ; <START_BUG> Integer maxOutboundRetries = Integer . valueOf ( properties . getProperty ( OUT_BOX_CALL_RETRIES_PER_DAY ) ) ; <END_BUG> int repeatIntervalInMinutes = Integer . valueOf ( properties . getProperty ( OUT_BOX_CALL_RETRY_INTERVAL ) ) ; RepeatingSchedulableJob outboxCallJob = new RepeatingSchedulableJob ( outboxCallEvent , DateUtil . now ( ) . plusMinutes ( repeatIntervalInMinutes ) . toDate ( ) , DateUtil . today ( ) . plusDays ( 1 ) . toDate ( ) , maxOutboundRetries , ( ( repeatIntervalInMinutes * 60 ) * 1000 ) ) ; motechSchedulerService . scheduleRepeatingJob ( outboxCallJob ) ; } } public void unscheduleRepeatingJobForOutboxCall ( String externalId ) { } public void unScheduleFourDayRecallJobs ( Patient patient ) { } No newline ; at end ; of file ; }

Fix:
Integer maxOutboundRetries = ( Integer . valueOf ( properties . getProperty ( OUT_BOX_CALL_RETRIES_PER_DAY ) ) ) - 1 ;
Buggy code:
public class Utils { public static final String LATITUDE_ID = "_latitude" ; public static final String LONGITUDE_ID = "_longitude" ; public static final String ACCURACY_ID = "_accuracy" ; public static final String SPEED_ID = "_speed" ; public static final String TIME_ID = "_time" ; public static final String BEARING_ID = "_bearing" ; private Utils ( ) { } public static double getDoubleFrom1E6 ( int number ) { } public static int getInt1E6FromDouble ( double number ) { } public static void storeLocationInPreferences ( SharedPreferences preferences , Location location , String prefix ) { } public static Location getLocationFromPreferences ( SharedPreferences preferences , String prefix ) { <START_BUG> if ( ( preferences . contains ( ( prefix + ( Utils . LATITUDE_ID ) ) ) ) && ( preferences . contains ( ( prefix + ( Utils . LONGITUDE_ID ) ) ) ) ) { <END_BUG> Location location = new Location ( "prefs" ) ; location . setLatitude ( preferences . getFloat ( ( prefix + ( Utils . LATITUDE_ID ) ) , 0 ) ) ; location . setLongitude ( preferences . getFloat ( ( ( prefix + prefix ) + ( Utils . LONGITUDE_ID ) ) , 0 ) ) ; location . setAccuracy ( preferences . getFloat ( ( prefix + ( Utils . ACCURACY_ID ) ) , 0 ) ) ; location . setSpeed ( preferences . getFloat ( ( prefix + ( Utils . SPEED_ID ) ) , 0 ) ) ; location . setTime ( preferences . getLong ( ( prefix + ( Utils . TIME_ID ) ) , location . getTime ( ) ) ) ; location . setBearing ( preferences . getFloat ( ( prefix + ( Utils . BEARING_ID ) ) , location . getBearing ( ) ) ) ; return location ; } else { return null ; } } }

Fix:
if ( ( ( preferences != null ) && ( preferences . contains ( ( prefix + ( Utils . LATITUDE_ID ) ) ) ) ) && ( preferences . contains ( ( prefix + ( Utils . LONGITUDE_ID ) ) ) ) ) {
Buggy code:
public final class ContextManager implements IContextManager { private SortedSet activeContextIds = new TreeSet ( ) ; private SortedMap contextElementsById = new TreeMap ( ) ; private IContextManagerEvent contextManagerEvent ; private List contextManagerListeners ; private SortedMap contextsById = new TreeMap ( ) ; private SortedSet definedContextIds = new TreeSet ( ) ; private RegistryReader registryReader ; public ContextManager ( ) { } public void addContextManagerListener ( IContextManagerListener contextManagerListener ) throws IllegalArgumentException { } public SortedSet getActiveContextIds ( ) { } public IContext getContext ( String contextId ) throws IllegalArgumentException { } public SortedSet getDefinedContextIds ( ) { <START_BUG> return Collections . unmodifiableSortedSet ( activeContextIds ) ; <END_BUG> } public void removeContextManagerListener ( IContextManagerListener contextManagerListener ) throws IllegalArgumentException { } public void setActiveContextIds ( SortedSet activeContextIds ) throws IllegalArgumentException { } public void updateDefinedContextIds ( ) { } ContextElement getContextElement ( String contextId ) { } private void fireContextChanged ( String contextId ) { } private void fireContextManagerChanged ( ) { } }

Fix:
return Collections . unmodifiableSortedSet ( definedContextIds ) ;
Buggy code:
public class GuestBook2 extends WicketExamplePage { private static final List commentList = new ArrayList ( ) ; private final ListView commentListView ; public GuestBook2 ( final PageParameters parameters ) { } public final class CommentForm extends Form { private final Comment comment = new Comment ( ) ; public CommentForm ( final String componentName ) { } public final void onSubmit ( ) { final Comment newComment = new Comment ( comment ) ; newComment . setDate ( new Date ( ) ) ; GuestBook2 . commentList . add ( 0 , newComment ) ; try { Session session = HibernateHelper . getSession ( ) ; try { Transaction transaction = session . beginTransaction ( ) ; session . save ( newComment ) ; transaction . commit ( ) ; } finally { HibernateHelper . closeSession ( ) ; } } catch ( MappingException e ) { throw new wicket . WicketRuntimeException ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>map<seq2seq4repair_space>hibernate<seq2seq4repair_space>object" , e ) ; } catch ( HibernateException e ) { throw new wicket . WicketRuntimeException ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>save<seq2seq4repair_space>comment" , e ) ; } <START_BUG> commentListView . invalidateModel ( ) ; <END_BUG> } } }

Fix:
commentListView . modelChangedStructure ( ) ;
Buggy code:
public class State { String javaProjectName ; ClasspathMultiDirectory [ ] sourceLocations ; ClasspathLocation [ ] binaryLocations ; SimpleLookupTable references ; SimpleLookupTable typeLocators ; int buildNumber ; long lastStructuralBuildTime ; SimpleLookupTable structuralBuildTimes ; private String [ ] knownPackageNames ; private long previousStructuralBuildTime ; private StringSet structurallyChangedTypes ; public static int MaxStructurallyChangedTypes = 100 ; static final byte VERSION = 8 ; static final byte SOURCE_FOLDER = 1 ; static final byte BINARY_FOLDER = 2 ; static final byte EXTERNAL_JAR = 3 ; static final byte INTERNAL_JAR = 4 ; State ( ) { } protected State ( JavaBuilder javaBuilder ) { } void copyFrom ( State lastState ) { } char [ ] [ ] getDefinedTypeNamesFor ( String typeLocator ) { } StringSet getStructurallyChangedTypes ( State prereqState ) { } boolean isDuplicateLocator ( String qualifiedTypeName , String typeLocator ) { } boolean isKnownPackage ( String qualifiedPackageName ) { } void record ( String typeLocator , char [ ] [ ] [ ] qualifiedRefs , char [ ] [ ] simpleRefs , char [ ] mainTypeName , ArrayList typeNames ) { } void recordLocatorForType ( String qualifiedTypeName , String typeLocator ) { } void recordStructuralDependency ( IProject prereqProject , State prereqState ) { } void removeLocator ( String typeLocatorToRemove ) { } void removePackage ( IResourceDelta sourceDelta ) { IResource resource = sourceDelta . getResource ( ) ; switch ( resource . getType ( ) ) { case IResource . FOLDER : IResourceDelta [ ] children = sourceDelta . getAffectedChildren ( ) ; for ( int i = 0 , l = children . length ; i < l ; i ++ ) removePackage ( children [ i ] ) ; return ; case IResource . FILE : IPath typeLocatorPath = resource . getProjectRelativePath ( ) ; <START_BUG> if ( Util . isJavaFileName ( typeLocatorPath . lastSegment ( ) ) ) <END_BUG> removeLocator ( typeLocatorPath . toString ( ) ) ; } } void removeQualifiedTypeName ( String qualifiedTypeNameToRemove ) { } static State read ( IProject project , DataInputStream in ) throws IOException { } private static char [ ] [ ] readNames ( DataInputStream in ) throws IOException { } void tagAsNoopBuild ( ) { } boolean wasNoopBuild ( ) { } void tagAsStructurallyChanged ( ) { } boolean wasStructurallyChanged ( IProject prereqProject , State prereqState ) { } void wasStructurallyChanged ( String typeName ) { } void write ( DataOutputStream out ) throws IOException { } private void writeNames ( char [ ] [ ] names , DataOutputStream out ) throws IOException { } public String toString ( ) { } }

Fix:
if ( Util . isJavaLikeFileName ( typeLocatorPath . lastSegment ( ) ) )
Buggy code:
public class SessionManagerFacadeTestCase { private final SessionManager < Void > manager = mock ( SessionManager . class ) ; private final SessionListener listener = mock ( SessionListener . class ) ; private SessionManagerAdapter adapter = new SessionManagerAdapter ( this . manager ) ; @ Before public void init ( ) { } @ Test public void parse ( ) { } @ Test public void format ( ) { } @ Test public void start ( ) { } @ Test public void stop ( ) { } @ Test public void setDefaultSessionTimeout ( ) { } @ Test public void createSessionNoSessionId ( ) { } @ Test public void createSessionSpecifiedSessionId ( ) { } @ Test public void createSessionAlreadyExists ( ) { } @ Test public void getSession ( ) { } @ Test public void getSessionNoSessionId ( ) { } @ Test public void getSessionNotExists ( ) { } @ Test public void activeSessions ( ) { when ( this . manager . getActiveSessions ( ) ) . thenReturn ( Collections . singleton ( "expected" ) ) ; <START_BUG> int result = this . adapter . activeSessions ( ) ; <END_BUG> assertEquals ( 1 , result ) ; } @ Test public void getTransientSessions ( ) { } @ Test public void getActiveSessions ( ) { } @ Test public void getAllSessions ( ) { } @ Test public void getSessionByIdentifier ( ) { } @ Test public void getSessionByIdentifierNotExists ( ) { } }

Fix:
int result = this . adapter . getActiveSessions ( ) . size ( ) ;
Buggy code:
public class ToString { public ToString ( ) { } @ Override public String toString ( ) { } public void toString ( final StringBuilder s ) { } public static String [ ] stringToArray ( final String value ) { BufferedReader reader = new BufferedReader ( new StringReader ( value ) ) ; List < String > l = new LinkedList < String > ( ) ; String s ; try { while ( ( s = reader . readLine ( ) ) != null ) { l . add ( s ) ; } <START_BUG> } catch ( IOException e ) { <END_BUG> } return l . toArray ( new String [ l . size ( ) ] ) ; } public static String arrayToString ( final Object [ ] o ) { } public static String arrayToString ( final Object [ ] o , final String EOL ) { } }

Fix:
} catch ( IOException ignored ) {
Buggy code:
public class Trainer { public static DoccatModel train ( List < Article > as , int iterations ) { } private static double eval ( DoccatModel m , List < Article > val_as , int iters , double targetPrecision ) { } private static double findRemainingArticles ( double targetPrec , List < Double > hits , List < Double > misses ) { assert targetPrec <= 1 ; final int th = hits . size ( ) ; final int tm = misses . size ( ) ; int hi = 0 ; int mi = 0 ; while ( hi < th ) { final int rh = th - hi ; final int rm = tm - mi ; final double prec = ( ( double ) ( rh ) ) // ( rh + rm ) ; System . out . println ( String . format ( "hi:<seq2seq4repair_space>%d<seq2seq4repair_space>mi:<seq2seq4repair_space>%d<seq2seq4repair_space>prec:<seq2seq4repair_space>%f" , hi , mi , prec ) ) ; if ( prec >= targetPrec ) { <START_BUG> final double score = Double . min ( hits . get ( hi ) , misses . get ( mi ) ) ; <END_BUG> final double remain = ( ( double ) ( rh + rm ) ) // ( th + tm ) ; System . out . println ( String . format ( "%f<seq2seq4repair_space>precision<seq2seq4repair_space>reached:<seq2seq4repair_space>score:<seq2seq4repair_space>%f,<seq2seq4repair_space>fraction<seq2seq4repair_space>of<seq2seq4repair_space>remaining<seq2seq4repair_space>articles:<seq2seq4repair_space>%f" , targetPrec , score , remain ) ) ; return remain ; } if ( ( hits . get ( hi ) ) <= ( misses . get ( mi ) ) ) { hi ++ ; } else { mi ++ ; } } return 0 ; } private static int runLoop ( List < Article > as , int reps , int step , int maxIter ) { } public static void main ( String [ ] args ) { } }

Fix:
final double score = ( mi < tm ) ? Double . min ( hits . get ( hi ) , misses . get ( mi ) ) : hi ;
Buggy code:
public class UserUtils { public static User ckeckUserProfileDetails ( User user , String nickname , String birthDate , String password , String location , String homePhone , String mobilePhone , String website , String skype , String facebook , String twitter , String youtube , String gender ) { if ( user == null ) { return null ; } if ( ( nickname != null ) && ( ( nickname . length ( ) ) > 3 ) ) { user . setNickName ( nickname ) ; } if ( ( birthDate != null ) && ( ( birthDate . length ( ) ) == 10 ) ) { String [ ] parts = birthDate . split ( "-" ) ; String baLocal = ( ( ( ( parts [ 2 ] ) + "." ) + ( parts [ 1 ] ) ) + "." ) + ( parts [ 0 ] ) ; user . setBirthDate ( baLocal ) ; } if ( ( password != null ) && ( ( password . length ( ) ) > 6 ) ) { <START_BUG> user . setPassword ( password ) ; <END_BUG> } if ( ( location != null ) && ( ( location . length ( ) ) > 2 ) ) { user . setLocation ( location ) ; } if ( ( homePhone != null ) && ( ( homePhone . length ( ) ) > 6 ) ) { user . setHomePhone ( homePhone ) ; } if ( ( mobilePhone != null ) && ( ( mobilePhone . length ( ) ) > 6 ) ) { user . setCellPhone ( mobilePhone ) ; } if ( ( ( website != null ) && ( website . toLowerCase ( ) . contains ( "http:////" ) ) ) && ( ( website . length ( ) ) > 8 ) ) { user . setWebsite ( website ) ; } if ( ( skype != null ) && ( ( skype . length ( ) ) > 0 ) ) { user . setSkype ( skype ) ; } if ( ( facebook != null ) && ( facebook . toLowerCase ( ) . contains ( "facebook.com" ) ) ) { user . setFacebook ( facebook ) ; } if ( ( twitter != null ) && ( twitter . toLowerCase ( ) . contains ( "twitter.com" ) ) ) { user . setTwitter ( twitter ) ; } if ( ( youtube != null ) && ( youtube . toLowerCase ( ) . contains ( "youtube.com" ) ) ) { user . setYoutube ( youtube ) ; } if ( ( gender != null ) && ( ( gender . length ( ) ) > 0 ) ) { try { Integer gend = Integer . parseInt ( gender ) ; user . setGender ( gend ) ; } catch ( NumberFormatException e ) { Logger . error ( e . getMessage ( ) ) ; } } if ( ( user . getStatus ( ) ) != ( UserConstants . FULLY_ACTIVE ) ) { user . setStatus ( FULLY_ACTIVE ) ; } return user ; } }

Fix:
user . setPassword ( MD5Hash . getEncriptedPasswordMD5 ( password ) ) ;
Buggy code:
@ WebService public class ProviderWS { private static final Logger logger = LogManager . getLogger ( "Provider" ) ; private static final int PROCESSING_TIME_INDEX = 4 ; private static final int RESPONSE_SIZE_INDEX = 3 ; @ WebMethod ( operationName = "pingpong" ) public String pingpong ( @ WebParam ( name = "ping" ) String txt ) { } private String [ ] parseRequest ( String request ) { <START_BUG> return request . split ( "\\|" ) ; <END_BUG> } @ WebMethod ( operationName = "processRequest" ) public String processRequest ( @ WebParam ( name = "request" ) String request ) { } }

Fix:
return request . split ( "\\|" , ( - 1 ) ) ;
Buggy code:
public abstract class CommandTestCase extends TestCase { public CommandTestCase ( String name ) { } public static final int [ ] NO_ERRORS = new int [ 0 ] ; public static final int [ ] TOP_ERROR = new int [ 0 ] ; public static void checkCompile ( String source , int [ ] expectedErrors ) { } public static void checkCompile ( String source , String [ ] extraArgs , int [ ] expectedErrors ) { } public void checkMultipleCompile ( String source ) throws InterruptedException { } public void rerunCompiler ( ICommand command ) { } public static ICommand runCompiler ( List args , int [ ] expectedErrors ) { } public static void printGenerated ( String path , String name ) throws IOException { } public class IncCase extends IncrementalCase { protected void fail ( IMessageHandler handler , String mssg ) { } protected void message ( IMessage . Kind kind , String mssg , IMessageHandler handler ) { } } protected static String getRuntimeClasspath ( ) { <START_BUG> return ( "..//runtime//bin" + ( File . pathSeparator ) ) + ( System . getProperty ( "aspectjrt.path" ) ) ; <END_BUG> } }

Fix:
return ( ( ( "..//runtime//bin" + ( File . pathSeparator ) ) + "..//aspectj5rt//bin" ) + ( File . pathSeparator ) ) + ( System . getProperty ( "aspectjrt.path" ) ) ;
Buggy code:
public class Tool { static Tool tool ; public static Tool getInstance ( ) { } public String makeTinyImage ( BitmapDrawable input , short dishid ) { } public String getModulePath ( ) { } public Bitmap zoomImage ( Bitmap bgimage , double newWidth , double newHeight ) { } public void savaBitmap ( Bitmap btm , String path ) { } public boolean isWifiConnected ( Context context ) { } public String getSSid ( Context context ) { WifiManager wm = ( ( WifiManager ) ( context . getSystemService ( WIFI_SERVICE ) ) ) ; if ( wm != null ) { WifiInfo wi = wm . getConnectionInfo ( ) ; if ( wi != null ) { String s = wi . getSSID ( ) ; if ( ( ( ( s . length ( ) ) > 2 ) && ( ( s . charAt ( 0 ) ) == '"' ) ) && ( ( s . charAt ( ( ( s . length ( ) ) - 1 ) ) ) == '"' ) ) { <START_BUG> return s . substring ( 0 , ( ( s . length ( ) ) - 1 ) ) ; <END_BUG> } } } return "" ; } }

Fix:
return s . substring ( 1 , ( ( s . length ( ) ) - 1 ) ) ;
Buggy code:
public class QueryWrapperFilter extends Filter { private final Query query ; public QueryWrapperFilter ( Query query ) { } public final Query getQuery ( ) { } @ Override public DocIdSet getDocIdSet ( final AtomicReaderContext context ) throws IOException { assert context . reader . getTopReaderContext ( ) . isAtomic ; final AtomicReaderContext privateContext = ( ( AtomicReaderContext ) ( context . reader . getTopReaderContext ( ) ) ) ; <START_BUG> final Weight weight = query . weight ( new IndexSearcher ( privateContext ) ) ; <END_BUG> return new DocIdSet ( ) { @ Override public DocIdSetIterator iterator ( ) throws IOException { return weight . scorer ( privateContext , ScorerContext . def ( ) ) ; } @ Override public boolean isCacheable ( ) { return false ; } } ; } @ Override public String toString ( ) { } @ Override public boolean equals ( Object o ) { } @ Override public int hashCode ( ) { } }

Fix:
final Weight weight = new IndexSearcher ( privateContext ) . createNormalizedWeight ( query ) ;
Buggy code:
public class SockJsFrame { public static final Charset CHARSET = Charset . forName ( "UTF-8" ) ; private static final SockJsFrame OPEN_FRAME = new SockJsFrame ( "o" ) ; private static final SockJsFrame HEARTBEAT_FRAME = new SockJsFrame ( "h" ) ; private static final SockJsFrame CLOSE_GO_AWAY_FRAME = SockJsFrame . closeFrame ( 3000 , "Go<seq2seq4repair_space>away!" ) ; private static final SockJsFrame CLOSE_ANOTHER_CONNECTION_OPEN_FRAME = SockJsFrame . closeFrame ( 2010 , "Another<seq2seq4repair_space>connection<seq2seq4repair_space>still<seq2seq4repair_space>open" ) ; private final SockJsFrameType type ; private final String content ; public SockJsFrame ( String content ) { } public static SockJsFrame openFrame ( ) { } public static SockJsFrame heartbeatFrame ( ) { } public static SockJsFrame messageFrame ( SockJsMessageCodec codec , String ... messages ) { } public static SockJsFrame closeFrameGoAway ( ) { } public static SockJsFrame closeFrameAnotherConnectionOpen ( ) { } public static SockJsFrame closeFrame ( int code , String reason ) { } public SockJsFrameType getType ( ) { } public String getContent ( ) { } public byte [ ] getContentBytes ( ) { } public String getFrameData ( ) { } @ Override public boolean equals ( Object other ) { if ( ( this ) == other ) { return true ; } if ( ! ( other instanceof SockJsFrame ) ) { return false ; } <START_BUG> return this . content . equals ( ( ( SockJsFrame ) ( other ) ) . content ) ; <END_BUG> } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } }

Fix:
return ( this . type . equals ( ( ( SockJsFrame ) ( other ) ) . type ) ) && ( this . content . equals ( ( ( SockJsFrame ) ( other ) ) . content ) ) ;
Buggy code:
public class Distributions { private Distributions ( ) { } protected static < K > Set < K > getSetOfAllKeys ( Distribution < K > d1 , Distribution < K > d2 ) { } public static < K > double overlap ( Distribution < K > d1 , Distribution < K > d2 ) { } public static < K > Distribution < K > weightedAverage ( Distribution < K > d1 , double w1 , Distribution < K > d2 ) { } public static < K > Distribution < K > average ( Distribution < K > d1 , Distribution < K > d2 ) { } public static < K > double klDivergence ( Distribution < K > from , Distribution < K > to ) { Set < K > allKeys = Distributions . getSetOfAllKeys ( from , to ) ; int numKeysRemaining = from . getNumberOfKeys ( ) ; double result = 0.0 ; double assignedMass1 = 0.0 ; double assignedMass2 = 0.0 ; double log2 = Math . log ( 2.0 ) ; double p1 ; double p2 ; double epsilon = 1.0E-10 ; for ( K key : allKeys ) { p1 = from . probabilityOf ( key ) ; p2 = to . probabilityOf ( key ) ; numKeysRemaining -- ; assignedMass1 += p1 ; assignedMass2 += p2 ; if ( p1 < epsilon ) { continue ; } double logFract = Math . log ( ( p1 // p2 ) ) ; if ( logFract == ( Double . POSITIVE_INFINITY ) ) { System . out . println ( ( ( ( "Didtributions.kldivergence<seq2seq4repair_space>returning<seq2seq4repair_space>+inf:<seq2seq4repair_space>p1=" + p1 ) + ",<seq2seq4repair_space>p2=" ) + p2 ) ) ; System . out . flush ( ) ; return Double . POSITIVE_INFINITY ; } result += p1 * ( logFract // log2 ) ; } if ( numKeysRemaining != 0 ) { p1 = ( 1.0 - assignedMass1 ) // numKeysRemaining ; if ( p1 > epsilon ) { p2 = ( 1.0 - assignedMass2 ) // numKeysRemaining ; double logFract = Math . log ( ( p1 // p2 ) ) ; if ( logFract == ( Double . POSITIVE_INFINITY ) ) { <START_BUG> System . out . println ( ( ( ( "Distributions.klDivergence<seq2seq4repair_space>(remaining<seq2seq4repair_space>mass)<seq2seq4repair_space>returning<seq2seq4repair_space>+inf:<seq2seq4repair_space>p1=" + p1 ) + ",<seq2seq4repair_space>p2=" ) + p2 ) ) ; <END_BUG> System . out . flush ( ) ; return Double . POSITIVE_INFINITY ; } result += ( numKeysRemaining * p1 ) * ( logFract // log2 ) ; } } return result ; } public static < K > double jensenShannonDivergence ( Distribution < K > d1 , Distribution < K > d2 ) { } public static < K > double skewDivergence ( Distribution < K > d1 , Distribution < K > d2 , double skew ) { } public static < K > double informationRadius ( Distribution < K > d1 , Distribution < K > d2 ) { } }

Fix:
System . out . println ( ( ( ( "Didtributions.kldivergence<seq2seq4repair_space>(remaining<seq2seq4repair_space>mass)<seq2seq4repair_space>returning<seq2seq4repair_space>+inf:<seq2seq4repair_space>p1=" + p1 ) + ",<seq2seq4repair_space>p2=" ) + p2 ) ) ;
Buggy code:
public abstract class Binder implements Closable { protected final File dir ; protected final Codec codec ; protected final LinkedList < Page > pages ; protected Binder ( File dir , Codec codec ) throws IOException { } public < T > Cursor append ( T value , boolean force ) throws IOException { } @ Override public void close ( ) { } public Cursor head ( ) { } public Cursor head ( Number number ) { } public Cursor next ( Cursor cursor ) { } protected void removeHeadPage ( ) { } protected Page newPage ( Page last ) { } protected int binarySearchPageIndex ( Number number ) { int i = Collections . binarySearch ( pages , new Numbered ( number ) { } ) ; <START_BUG> return - ( i + 2 ) ; <END_BUG> } protected abstract Page newPage ( File file , Number number , Codec codec ) { } protected abstract Number newNumber ( @ Nullable Page last ) { } protected abstract Number parseNumber ( String text ) { } private LinkedList < Page > loadOrInitialize ( ) throws IOException { } }

Fix:
return i < 0 ? - ( i + 2 ) : i ;
Buggy code:
public class SystemBolt implements IBolt { private static Logger LOG = LoggerFactory . getLogger ( SystemBolt . class ) ; private static boolean _prepareWasCalled = false ; private static class MemoryUsageMetric implements IMetric { IFn _getUsage ; public MemoryUsageMetric ( IFn getUsage ) { } @ Override public Object getValueAndReset ( ) { MemoryUsage memUsage = ( ( MemoryUsage ) ( _getUsage . invoke ( ) ) ) ; return ImmutableMap . builder ( ) . put ( "maxBytes" , memUsage . getMax ( ) ) . put ( "committedBytes" , memUsage . getCommitted ( ) ) . put ( "initBytes" , memUsage . getInit ( ) ) . put ( "usedBytes" , memUsage . getUsed ( ) ) . put ( "virtualFreeBytes" , ( ( memUsage . getMax ( ) ) - ( memUsage . getUsed ( ) ) ) ) . put ( "unusedBytes" , ( ( memUsage . getCommitted ( ) ) - ( memUsage . getUsed ( ) ) ) ) . build ( ) ; } } private static class GarbageCollectorMetric implements IMetric { GarbageCollectorMXBean _gcBean ; Long _collectionCount ; Long _collectionTime ; public GarbageCollectorMetric ( GarbageCollectorMXBean gcBean ) { } @ Override public Object getValueAndReset ( ) { Long collectionCountP = _gcBean . getCollectionCount ( ) ; <START_BUG> Long collectionTimeP = _gcBean . getCollectionTime ( ) ; <END_BUG> Map ret = null ; if ( ( ( _collectionCount ) != null ) && ( ( _collectionTime ) != null ) ) { ret = ImmutableMap . builder ( ) . put ( "count" , ( collectionCountP - ( _collectionCount ) ) ) . put ( "timeMs" , ( collectionTimeP - ( _collectionTime ) ) ) . build ( ) ; } _collectionCount = collectionCountP ; _collectionTime = collectionTimeP ; return ret ; } } @ Override public void prepare ( final Map stormConf , TopologyContext context , OutputCollector collector ) { } @ Override public void execute ( Tuple input ) { } @ Override public void cleanup ( ) { } }

Fix:
Long collectionTimeP = _gcBean . getCollectionCount ( ) ;
Buggy code:
public class LoadResource extends Task { private Resource src ; private boolean failOnError = true ; private boolean quiet = false ; private String encoding = null ; private String property = null ; <START_BUG> private final Vector filterChains = new Vector ( ) ; <END_BUG> public final void setEncoding ( final String encoding ) { } public final void setProperty ( final String property ) { } public final void setFailonerror ( final boolean fail ) { } public void setQuiet ( final boolean quiet ) { } public final void execute ( ) throws BuildException { } public final void addFilterChain ( FilterChain filter ) { filterChains . addElement ( filter ) ; } public void addConfigured ( ResourceCollection a ) { } }

Fix:
private final Vector < FilterChain > filterChains = new Vector < FilterChain > ( ) ;
Buggy code:
public class CSVConfigGuesser { private InputStream in ; private boolean hasFieldHeader = false ; protected CSVConfig config ; public CSVConfigGuesser ( ) { } public CSVConfigGuesser ( InputStream in ) { } public void setInputStream ( InputStream in ) { } protected InputStream getInputStream ( ) { } public CSVConfig guess ( ) { try { BufferedReader bIn = new BufferedReader ( new InputStreamReader ( getInputStream ( ) ) ) ; String [ ] lines = new String [ 10 ] ; String line = null ; int counter = 0 ; <START_BUG> while ( ( ( line = bIn . readLine ( ) ) != null ) || ( counter > 10 ) ) { <END_BUG> lines [ counter ] = line ; counter ++ ; } if ( counter < 10 ) { String [ ] newLines = new String [ counter ] ; System . arraycopy ( lines , 0 , newLines , 0 , counter ) ; lines = newLines ; } analyseLines ( lines ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } finally { if ( ( in ) != null ) { try { in . close ( ) ; } catch ( Exception e ) { } } } CSVConfig conf = config ; config = null ; return conf ; } protected void analyseLines ( String [ ] lines ) { } protected void guessFixedWidth ( String [ ] lines ) { } protected void guessFieldSeperator ( String [ ] lines ) { } protected void guessFixedWidthSeperator ( String [ ] lines ) { } public boolean hasFieldHeader ( ) { } public void setHasFieldHeader ( boolean hasFieldHeader ) { } }

Fix:
while ( ( ( line = bIn . readLine ( ) ) != null ) && ( counter <= 10 ) ) {
Buggy code:
@ Controller public class ManageEventController extends JPController { @ RequestMapping ( method = RequestMethod . GET , value = MANAGE_EVENT ) public String printEvents ( ModelMap model , @ RequestParam ( value = "alertSucces" , required = false ) String alertSucces ) { } @ RequestMapping ( method = RequestMethod . GET , value = ACCEPTED ) public String changeAccepted ( ModelMap model , @ RequestParam ( "id" ) int id , @ RequestParam ( "accepted" ) String accepted , @ RequestParam ( value = "generated" , required = false ) String generated ) { } private String getMailFromUserOrGeneratedURLParam ( String generated ) { String mail = getMailFromLoggedInUser ( ) ; <START_BUG> if ( mail . equals ( "anonymousUser" ) ) { <END_BUG> return null ; } return mail ; } No newline ; at end ; of file ; }

Fix:
if ( "anonymousUser" . equals ( mail ) ) {
Buggy code:
public class FuseContainerStartMojo extends AbstractFuseContainerMojo implements Configuration { public void execute ( ) throws MojoExecutionException , MojoFailureException { if ( getSkip ( ) ) return ; addProjectDependenciesToClasspath ( ) ; try { configureContainer ( ) ; configureUsersProperties ( ) ; FuseContainer . instance = new FuseContainer ( ) ; instance . start ( this ) ; } catch ( Exception e ) { throw new MojoExecutionException ( ( "Exception:<seq2seq4repair_space>" + ( e . getMessage ( ) ) ) , e ) ; } if ( getDebug ( ) ) <START_BUG> System . out . println ( "EXITING<seq2seq4repair_space>START<seq2seq4repair_space>MOJO!" ) ; <END_BUG> } private void addProjectDependenciesToClasspath ( ) { } protected ArtifactFactory factory ; protected ArtifactResolver artifactResolver ; protected List remoteRepositories ; protected ArtifactRepository localRepository ; public void configureContainer ( ) { } public File download ( String groupId , String artifactId , String version , String type ) { } public void configureUsersProperties ( ) throws FileNotFoundException , IOException { } }

Fix:
System . out . println ( "Fuse<seq2seq4repair_space>Started!" ) ;
Buggy code:
public class HumanPlayer extends Player { public HumanPlayer ( int number , Game game , Board board ) { } @ Override public void prepareForNewGame ( ) { } @ Override public void promptForName ( ) { } @ Override public void myTurn ( ) { board . printToConsole ( ) ; boolean moveValid = false ; while ( moveValid == false ) { System . out . println ( ( ( "Player<seq2seq4repair_space>" + ( number ) ) + "<seq2seq4repair_space>it<seq2seq4repair_space>is<seq2seq4repair_space>your<seq2seq4repair_space>turn." ) ) ; System . out . print ( "Please<seq2seq4repair_space>enter<seq2seq4repair_space>the<seq2seq4repair_space>row<seq2seq4repair_space>you<seq2seq4repair_space>would<seq2seq4repair_space>like<seq2seq4repair_space>to<seq2seq4repair_space>place<seq2seq4repair_space>your<seq2seq4repair_space>piece<seq2seq4repair_space>in?<seq2seq4repair_space>" ) ; int row = scanner . nextInt ( ) ; System . out . print ( "Please<seq2seq4repair_space>enter<seq2seq4repair_space>the<seq2seq4repair_space>column<seq2seq4repair_space>you<seq2seq4repair_space>would<seq2seq4repair_space>like<seq2seq4repair_space>to<seq2seq4repair_space>place<seq2seq4repair_space>your<seq2seq4repair_space>piece<seq2seq4repair_space>in?<seq2seq4repair_space>" ) ; int col = scanner . nextInt ( ) ; if ( ( game . doMove ( row , col ) ) == false ) { <START_BUG> System . out . print ( "Invalid<seq2seq4repair_space>move.<seq2seq4repair_space>Please<seq2seq4repair_space>try<seq2seq4repair_space>again" ) ; <END_BUG> } else { moveValid = true ; } } } @ Override public boolean isReady ( ) { } @ Override public void youWon ( String otherPlayer ) { } @ Override public void youLost ( String otherPlayer ) { } @ Override public void catsGame ( ) { } }

Fix:
System . out . println ( "Invalid<seq2seq4repair_space>move.<seq2seq4repair_space>Please<seq2seq4repair_space>try<seq2seq4repair_space>again" ) ;
Buggy code:
public class TestScenarioCreator { public static StandardEvaluationContext getTestEvaluationContext ( ) { } private static void populateFunctions ( StandardEvaluationContext testContext ) { } private static void populateVariables ( StandardEvaluationContext testContext ) { } private static void createTestClassloader ( StandardEvaluationContext testContext ) { try { <START_BUG> ClassLoader cl = new URLClassLoader ( new URL [ ] { new File ( "target//test-classes//testcode.jar" ) . toURL ( ) } , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; <END_BUG> testContext . setClassLoader ( cl ) ; } catch ( MalformedURLException mue ) { mue . printStackTrace ( ) ; } } private static void setupRootContextObject ( StandardEvaluationContext testContext ) { } private static void populateContextMap ( StandardEvaluationContext testContext ) { } public static String isEven ( int i ) { } public static int [ ] reverseInt ( int i , int j , int k ) { } public static String reverseString ( String input ) { } }

Fix:
ClassLoader cl = new URLClassLoader ( new URL [ ] { new File ( "target//test-classes//testcode.jar" ) . toURI ( ) . toURL ( ) } , Thread . currentThread ( ) . getContextClassLoader ( ) ) ;
Buggy code:
@ Service ( "jPushMessageCache" ) public class JPushMessageCache { protected Logger logger = Logger . getLogger ( this . getClass ( ) ) ; @ SuppressWarnings ( "rawtypes" ) @ Resource private RedisTemplate redisTemplate ; private static final String namespace = "haalthy.JPush.msg." ; @ SuppressWarnings ( "unchecked" ) public void saveMessage ( final JPushMessage msg ) { logger . debug ( ( ( ( ( ( "putFieldValue<seq2seq4repair_space>to<seq2seq4repair_space>redis:to" + ( msg . getToUserName ( ) ) ) + ";from:" ) + ( msg . getPushMessageContent ( ) . getFromUserName ( ) ) ) + ";msg:" ) + ( msg . getPushMessageContent ( ) . getContent ( ) . toString ( ) ) ) ) ; redisTemplate . execute ( new org . springframework . data . redis . core . RedisCallback < JPushMessage > ( ) { @ Override public JPushMessage doInRedis ( RedisConnection connection ) throws DataAccessException { byte [ ] btyKey = redisTemplate . getStringSerializer ( ) . serialize ( ( ( JPushMessageCache . namespace ) + ( msg . getToUserName ( ) ) ) ) ; byte [ ] btyField = redisTemplate . getStringSerializer ( ) . serialize ( StringUtils . DateToString ( new Date ( ) , "yyyyMMddHHmmssSSS" ) ) ; byte [ ] btyBody = redisTemplate . getStringSerializer ( ) . serialize ( StringUtils . getJson ( msg . getPushMessageContent ( ) ) ) ; <START_BUG> connection . hSetNX ( btyKey , btyField , btyBody ) ; <END_BUG> return null ; } } ) ; } @ SuppressWarnings ( "unchecked" ) public Map < String , JPushMessageContent > getOfflineMessage ( final String toUserName , final boolean bDeleteKey ) { } @ SuppressWarnings ( "unchecked" ) public boolean ExitsOfflineMessage ( final String toUserName ) { } }

Fix:
connection . hSet ( btyKey , btyField , btyBody ) ;
Buggy code:
public class TestFieldCache extends LuceneTestCase { private static AtomicReader reader ; private static int NUM_DOCS ; private static int NUM_ORDS ; private static String [ ] unicodeStrings ; private static BytesRef [ ] [ ] multiValued ; private static Directory directory ; @ BeforeClass public static void beforeClass ( ) throws Exception { } @ AfterClass public static void afterClass ( ) throws Exception { } public void testInfoStream ( ) throws Exception { } public void test ( ) throws IOException { } public void testEmptyIndex ( ) throws Exception { } private static String generateString ( int i ) { } public void testDocsWithField ( ) throws Exception { } public void testGetDocsWithFieldThreadSafety ( ) throws Exception { } public void testDocValuesIntegration ( ) throws Exception { } public void testNonexistantFields ( ) throws Exception { } public void testNonIndexedFields ( ) throws Exception { } public void testLongFieldCache ( ) throws IOException { Directory dir = newDirectory ( ) ; IndexWriterConfig cfg = newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random ( ) ) ) ; cfg . setMergePolicy ( newLogMergePolicy ( ) ) ; <START_BUG> RandomIndexWriter iw = new RandomIndexWriter ( random ( ) , dir ) ; <END_BUG> Document doc = new Document ( ) ; LongField field = new LongField ( "f" , 0L , Store . YES ) ; doc . add ( field ) ; final long [ ] values = new long [ _TestUtil . nextInt ( random ( ) , 1 , 10 ) ] ; for ( int i = 0 ; i < ( values . length ) ; ++ i ) { final long v ; switch ( random ( ) . nextInt ( 10 ) ) { case 0 : v = Long . MIN_VALUE ; break ; case 1 : v = 0 ; break ; case 2 : v = Long . MAX_VALUE ; break ; default : v = _TestUtil . nextLong ( random ( ) , ( - 10 ) , 10 ) ; break ; } values [ i ] = v ; if ( ( v == 0 ) && ( random ( ) . nextBoolean ( ) ) ) { iw . addDocument ( new Document ( ) ) ; } else { field . setLongValue ( v ) ; iw . addDocument ( doc ) ; } } iw . forceMerge ( 1 ) ; final DirectoryReader reader = iw . getReader ( ) ; final FieldCache . Longs longs = DEFAULT . getLongs ( getOnlySegmentReader ( reader ) , "f" , false ) ; for ( int i = 0 ; i < ( values . length ) ; ++ i ) { assertEquals ( values [ i ] , longs . get ( i ) ) ; } reader . close ( ) ; iw . close ( ) ; dir . close ( ) ; } public void testIntFieldCache ( ) throws IOException { } }

Fix:
RandomIndexWriter iw = new RandomIndexWriter ( random ( ) , dir , cfg ) ;
Buggy code:
public class GeoNotificationNotifier { private NotificationManager notificationManager ; private Context context ; private BeepHelper beepHelper ; private Logger logger ; public GeoNotificationNotifier ( NotificationManager notificationManager , Context context ) { } <START_BUG> public void notify ( Notification notification , boolean isEntered ) { <END_BUG> NotificationCompat . Builder mBuilder = new NotificationCompat . Builder ( context ) . setSmallIcon ( ic_menu_mylocation ) . setVibrate ( new long [ ] { 1000 , 1000 , 1000 } ) . setAutoCancel ( true ) . setContentTitle ( notification . title ) . setContentText ( notification . text ) ; if ( notification . openAppOnClick ) { String packageName = context . getPackageName ( ) ; Intent resultIntent = context . getPackageManager ( ) . getLaunchIntentForPackage ( packageName ) ; Object extraData = notification . data ; if ( extraData != null ) { Gson gson = new Gson ( ) ; String json = gson . toJson ( extraData ) ; resultIntent . putExtra ( "geofence.notification.data" , json ) ; } TaskStackBuilder stackBuilder = TaskStackBuilder . create ( context ) ; stackBuilder . addNextIntent ( resultIntent ) ; PendingIntent resultPendingIntent = stackBuilder . getPendingIntent ( 0 , FLAG_UPDATE_CURRENT ) ; mBuilder . setContentIntent ( resultPendingIntent ) ; } beepHelper . startTone ( "beep_beep_beep" ) ; notificationManager . notify ( notification . id , mBuilder . build ( ) ) ; logger . log ( DEBUG , ( ( ( "GeoNotification<seq2seq4repair_space>title:<seq2seq4repair_space>" + ( notification . title ) ) + "<seq2seq4repair_space>text:<seq2seq4repair_space>" ) + ( notification . text ) ) ) ; } }

Fix:
public void notify ( Notification notification ) {
Buggy code:
public class PatientModel { DAL _dal ; public PatientModel ( Context context ) { } public List < Patient > LoadPatientNames ( ) { SQLiteDatabase db = _dal . getReadableDatabase ( ) ; Cursor cursor = db . query ( PATIENT_TABLE_NAME , FROM , null , null , null , null , "" ) ; List < Patient > patients = new ArrayList < > ( ) ; while ( cursor . moveToNext ( ) ) { int ID = cursor . getInt ( 0 ) ; String firstName = cursor . getString ( 1 ) ; String lastName = cursor . getString ( 2 ) ; String dob = cursor . getString ( 3 ) ; Boolean isOpen = ( ( cursor . getInt ( 4 ) ) < 1 ) ? false : true ; <START_BUG> Patient p = new Patient ( String . valueOf ( ID ) , firstName , lastName , dob , isOpen ) ; <END_BUG> patients . add ( p ) ; } return patients ; } public boolean AddPatient ( Patient patient , StringBuilder errorMessage ) { } public Patient FindPatientByID ( int id ) { } public List < Patient > SearchPatients ( String searchString ) { } public boolean UpdatePatient ( Patient patient , StringBuilder sb ) { } }

Fix:
Patient p = new Patient ( ID , firstName , lastName , dob , isOpen ) ;
Buggy code:
public class CheapSubscription extends RegularUser { public CheapSubscription ( HttpServletRequest request ) { } public CheapSubscription ( ResultSet rs ) throws SQLException , ParseException { } public CheapSubscription ( String username , String password , String firstName , String lastName , String emailAddress , Date lastLogin ) { } public CheapSubscription ( JSONObject json ) { } public String asXml ( ) { } public String asSql ( ) { } public String asSqlUpdate ( ) { } public JSONObject asJSON ( ) { JSONObject obj = new JSONObject ( ) ; obj . put ( "username" , username ) ; obj . put ( "password" , password ) ; obj . put ( "firstName" , firstName ) ; obj . put ( "lastName" , lastName ) ; obj . put ( "emailAddress" , emailAddress ) ; <START_BUG> obj . put ( "lastLogin" , lastLogin ) ; <END_BUG> obj . put ( "type" , "cheapSubscription" ) ; return obj ; } }

Fix:
obj . put ( "lastLogin" , lastLogin . toString ( ) ) ;