nus-yam/ex-repair huggingface dataset:
Buggy code:
@ Controller @ RequestMapping ( "//registration" ) public class RegistrationController { @ Autowired private ServletContext servletContext ; private static final Logger logger = Logger . getLogger ( String . valueOf ( RegistrationController . class ) ) ; @ RequestMapping ( method = RequestMethod . POST ) public String printWelcome ( HttpServletRequest req , ModelMap model ) { } private void saveUserToXML ( User _user ) { String tmp_enc_password = "" ; ServletContextResource servletContextResource = null ; File userXML = null ; try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ; InputStream inputStream = null ; try { ServletContextResource resource = new ServletContextResource ( servletContext , "//WEB-INF//content//users.xml" ) ; userXML = resource . getFile ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } Document document = documentBuilder . parse ( userXML ) ; Element root = document . getDocumentElement ( ) ; Collection < User > users = new ArrayList < User > ( ) ; users . add ( _user ) ; for ( User user : users ) { Element newUser = document . createElement ( "user" ) ; root . appendChild ( newUser ) ; Element userName = document . createElement ( "username" ) ; userName . appendChild ( document . createTextNode ( user . getUsername ( ) ) ) ; newUser . appendChild ( userName ) ; Element password = document . createElement ( "password" ) ; tmp_enc_password = LoginController . encryptPassword ( user . getPassword ( ) ) ; password . appendChild ( document . createTextNode ( tmp_enc_password ) ) ; newUser . appendChild ( password ) ; Element uuid = document . createElement ( "uuid" ) ; <START_BUG> uuid . appendChild ( document . createTextNode ( user . getUuid ( ) . toString ( ) ) ) ; <END_BUG> newUser . appendChild ( uuid ) ; root . appendChild ( newUser ) ; } DOMSource source = new DOMSource ( document ) ; TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = transformerFactory . newTransformer ( ) ; StreamResult result = new StreamResult ( userXML ) ; transformer . transform ( source , result ) ; } catch ( ParserConfigurationException e ) { e . printStackTrace ( ) ; } catch ( TransformerException e ) { e . printStackTrace ( ) ; } catch ( SAXException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } @ RequestMapping ( method = RequestMethod . GET ) public String showRegistration ( ModelMap model ) { } }

Fix:
uuid . appendChild ( document . createTextNode ( user . getID ( ) . toString ( ) ) ) ;
Buggy code:
public class TestQueryLock extends BaseQueryTest { public TestQueryLock ( String test ) { } public void setUp ( ) { } public void testJPQLLock ( ) { EntityManager em = currentEntityManager ( ) ; <START_BUG> Query q = em . createQuery ( ( "SELECT<seq2seq4repair_space>o<seq2seq4repair_space>FROM<seq2seq4repair_space>Entity1<seq2seq4repair_space>o<seq2seq4repair_space>" + "WHERE<seq2seq4repair_space>o.stringField<seq2seq4repair_space>=<seq2seq4repair_space>'testSimple'" ) ) ; <END_BUG> try { q . setLockMode ( NONE ) ; assertEquals ( "Verify<seq2seq4repair_space>NONE<seq2seq4repair_space>after<seq2seq4repair_space>set" , NONE , q . getLockMode ( ) ) ; } catch ( Exception e ) { fail ( ( "Do<seq2seq4repair_space>not<seq2seq4repair_space>expected<seq2seq4repair_space>" + ( e . getClass ( ) . getName ( ) ) ) ) ; } try { q . setLockMode ( PESSIMISTIC_READ ) ; fail ( "Expecting<seq2seq4repair_space>TransactionRequiredException<seq2seq4repair_space>thrown" ) ; } catch ( TransactionRequiredException tre ) { assertEquals ( "Verify<seq2seq4repair_space>still<seq2seq4repair_space>NONE<seq2seq4repair_space>after<seq2seq4repair_space>set<seq2seq4repair_space>incorrect<seq2seq4repair_space>lock<seq2seq4repair_space>mode" , NONE , q . getLockMode ( ) ) ; } catch ( Exception e ) { fail ( "Expecting<seq2seq4repair_space>TransactionRequiredException<seq2seq4repair_space>thrown" ) ; } startTx ( em ) ; try { q . setLockMode ( OPTIMISTIC_FORCE_INCREMENT ) ; assertEquals ( "Verify<seq2seq4repair_space>changed<seq2seq4repair_space>to<seq2seq4repair_space>OPTIMISTIC_FORCE_INCREMENT" , OPTIMISTIC_FORCE_INCREMENT , q . getLockMode ( ) ) ; } catch ( Exception e ) { fail ( ( "Do<seq2seq4repair_space>not<seq2seq4repair_space>expected<seq2seq4repair_space>" + ( e . getClass ( ) . getName ( ) ) ) ) ; } endTx ( em ) ; endEm ( em ) ; } public void testCriteriaLock ( ) { } public void testNativeLock ( ) { } }

Fix:
Query q = em . createQuery ( "SELECT<seq2seq4repair_space>o<seq2seq4repair_space>FROM<seq2seq4repair_space>Entity1<seq2seq4repair_space>o<seq2seq4repair_space>WHERE<seq2seq4repair_space>o.stringField<seq2seq4repair_space>=<seq2seq4repair_space>'testSimple'" ) ;
Buggy code:
public class ExampleRunner { public static void main ( String [ ] args ) throws Exception { Display display = new Display ( ) ; Shell shell = new Shell ( display ) ; shell . setLayout ( new GridLayout ( 1 , false ) ) ; shell . setText ( "Change<seq2seq4repair_space>a<seq2seq4repair_space>value<seq2seq4repair_space>to<seq2seq4repair_space>see<seq2seq4repair_space>bean<seq2seq4repair_space>as<seq2seq4repair_space>JSON" ) ; <START_BUG> final ExampleComposite ui = new ExampleComposite ( shell , SWT . NONE ) ; <END_BUG> ui . setLayoutData ( new org . eclipse . swt . layout . GridData ( SWT . FILL , SWT . FILL , true , true ) ) ; final Label value = new Label ( shell , SWT . WRAP ) ; value . setLayoutData ( new org . eclipse . swt . layout . GridData ( SWT . FILL , SWT . FILL , true , false ) ) ; shell . pack ( ) ; shell . setSize ( 700 , 700 ) ; final ExampleBean bean = new ExampleBean ( ) ; ExampleItem item = new ExampleItem ( 1 , 2 ) ; item . addOption ( new OptionItem ( true , true , true , true ) ) ; bean . addItem ( item ) ; item = new ExampleItem ( 2 , 3 , ItemChoice . POLAR ) ; item . addOption ( new OptionItem ( true , false , true , false ) ) ; item . addOption ( new OptionItem ( false , false , false , false ) ) ; bean . addItem ( item ) ; bean . addItem ( new ExampleItem ( 3 , 4 , ItemChoice . XY ) ) ; BeanUI . beanToUI ( bean , ui ) ; BeanUI . switchState ( ui , true ) ; BeanUI . addValueListener ( bean , ui , new ValueAdapter ( "Example<seq2seq4repair_space>listener" ) { @ Override public void valueChangePerformed ( ValueEvent e ) { try { BeanUI . uiToBean ( ui , bean ) ; ObjectMapper mapper = new ObjectMapper ( ) ; String json = mapper . writeValueAsString ( bean ) ; value . setText ( json ) ; value . getParent ( ) . layout ( ) ; } catch ( Exception e1 ) { e1 . printStackTrace ( ) ; } } } ) ; SWTUtils . showCenteredShell ( shell ) ; } }

Fix:
final ExampleComposite ui = new ExampleComposite ( shell , SWT . BORDER ) ;
Buggy code:
public class GlobalOptimizationPublisher { private Endpoint endpoint ; public static void main ( String [ ] args ) { } private void create_endpoint ( ) { } private void configure_endpoint ( ) { } private void publish ( ) { int port = 8885 ; String ip = "10.131.253.211" ; String url = String . format ( "http:////%s:%d//globaloptimization" , ip , port ) ; endpoint . publish ( url ) ; <START_BUG> System . out . println ( ( "globalOptimization<seq2seq4repair_space>on<seq2seq4repair_space>Port<seq2seq4repair_space>:<seq2seq4repair_space>" + port ) ) ; <END_BUG> } }

Fix:
System . out . println ( ( "Publishing<seq2seq4repair_space>Global<seq2seq4repair_space>Optimization<seq2seq4repair_space>Service<seq2seq4repair_space>on<seq2seq4repair_space>Port<seq2seq4repair_space>:<seq2seq4repair_space>" + url ) ) ;
Buggy code:
public class Executor { public static Stack < Process > runningProcesses = new Stack < Process > ( ) ; public static Stack < Method > runningMethods = new Stack < Method > ( ) ; public static Process getCurrentProcess ( ) { } public static Method getCurrentMethod ( ) { } public static Method getMethodInCurrentProcess ( String methodName ) { } public static Method getMethod ( String methodName , int processID ) { } public static void executeMethod ( Method m ) { } public static void executeMethod ( Method m , String [ ] args ) { } public static void popStack ( ) { if ( ! ( Executor . runningMethods . isEmpty ( ) ) ) { Variable . clearLocalVariables ( Executor . runningMethods . pop ( ) ) ; } if ( ! ( Executor . lineReturns . isEmpty ( ) ) ) { Executor . setLine ( Executor . lineReturns . pop ( ) ) ; } else { if ( ( Executor . runningProcesses . size ( ) ) > 1 ) { Executor . runningProcesses . pop ( ) ; <START_BUG> Executor . setLine ( ( ( Executor . getCurrentProcess ( ) . getLine ( ) ) + 1 ) ) ; <END_BUG> } else { Executor . closeRequested = true ; } } } public static void addProcess ( Process p ) { } public static ArrayList < Method > methods = new ArrayList < Method > ( ) ; public static boolean closeRequested = false ; public static Stack < Integer > lineReturns = new Stack < Integer > ( ) ; public static String startingMethod ; public static void setLine ( int num ) { } public static void setLine ( int num , int UUID ) { } public static void run ( File runFile , List < String > args ) throws IOException { } public static void executeLineInCurrentProcess ( int lineNumber ) { } public static void executeLineInCurrentProcess ( int i , int returnLine ) { } public static int getUUID ( ) { } public static ArrayList < Integer > UUIDsUsed = new ArrayList < Integer > ( ) ; public static long timeStarted = 0 ; public static int frames = 0 ; public static ArrayList < Integer > eventsToBeHandled = new ArrayList < Integer > ( ) ; }

Fix:
Executor . setLine ( ( ( Executor . getCurrentProcess ( ) . getLine ( ) ) + 2 ) ) ;
Buggy code:
public class SweetSpotSimilarityTest extends LuceneTestCase { public static float computeAndDecodeNorm ( SweetSpotSimilarity decode , Similarity encode , FieldInvertState state ) { } public static byte computeAndGetNorm ( Similarity s , FieldInvertState state ) { } public void testSweetSpotComputeNorm ( ) { } public void testSweetSpotTf ( ) { } public void testHyperbolicSweetSpot ( ) { SweetSpotSimilarity ss = new SweetSpotSimilarity ( ) { @ Override <START_BUG> public float tf ( int freq ) { <END_BUG> return hyperbolicTf ( freq ) ; } } ; ss . setHyperbolicTfFactors ( 3.3F , 7.7F , Math . E , 5.0F ) ; TFIDFSimilarity s = ss ; for ( int i = 1 ; i <= 1000 ; i ++ ) { assertTrue ( ( ( ( "MIN<seq2seq4repair_space>tf:<seq2seq4repair_space>i=" + i ) + "<seq2seq4repair_space>:<seq2seq4repair_space>s=" ) + ( s . tf ( i ) ) ) , ( 3.3F <= ( s . tf ( i ) ) ) ) ; assertTrue ( ( ( ( "MAX<seq2seq4repair_space>tf:<seq2seq4repair_space>i=" + i ) + "<seq2seq4repair_space>:<seq2seq4repair_space>s=" ) + ( s . tf ( i ) ) ) , ( ( s . tf ( i ) ) <= 7.7F ) ) ; } assertEquals ( "MID<seq2seq4repair_space>tf" , ( 3.3F + ( ( 7.7F - 3.3F ) // 2.0F ) ) , s . tf ( 5 ) , 1.0E-5F ) ; assertEquals ( "tf<seq2seq4repair_space>zero" , 0.0F , s . tf ( 0 ) , 0.0F ) ; } }

Fix:
public float tf ( float freq ) {
Buggy code:
public class Log { private static boolean PRINT_TRACE_METHOD = true ; private static SizeBasedTriggeringPolicy triggeringPolicy ; private static Logger logbackLogger ; public static void setup ( String fileName , boolean useDetailedLogging ) { Log . PRINT_TRACE_METHOD = useDetailedLogging ; LoggerContext loggerContext = ( ( LoggerContext ) ( LoggerFactory . getILoggerFactory ( ) ) ) ; RollingFileAppender appender = new RollingFileAppender ( ) ; appender . setContext ( loggerContext ) ; appender . setFile ( ( fileName + ".log" ) ) ; FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy ( ) ; rollingPolicy . setContext ( loggerContext ) ; rollingPolicy . setParent ( appender ) ; rollingPolicy . setFileNamePattern ( ( fileName + "_%i.log" ) ) ; rollingPolicy . setMinIndex ( 1 ) ; rollingPolicy . setMaxIndex ( 10 ) ; rollingPolicy . start ( ) ; Log . triggeringPolicy = new SizeBasedTriggeringPolicy ( ) ; Log . triggeringPolicy . setMaxFileSize ( "1MB" ) ; Log . triggeringPolicy . start ( ) ; PatternLayoutEncoder encoder = new PatternLayoutEncoder ( ) ; encoder . setContext ( loggerContext ) ; encoder . setPattern ( "%d{MMM-dd<seq2seq4repair_space>HH:mm:ss.SSS}<seq2seq4repair_space>[%thread]<seq2seq4repair_space>%-5level<seq2seq4repair_space>%logger{15}:<seq2seq4repair_space>%msg<seq2seq4repair_space>%xEx%n" ) ; encoder . start ( ) ; appender . setEncoder ( encoder ) ; appender . setRollingPolicy ( rollingPolicy ) ; appender . setTriggeringPolicy ( Log . triggeringPolicy ) ; appender . start ( ) ; Log . logbackLogger = loggerContext . getLogger ( ROOT_LOGGER_NAME ) ; <START_BUG> Log . logbackLogger . setLevel ( ( useDetailedLogging ? Level . TRACE : Level . TRACE ) ) ; <END_BUG> Log . logbackLogger . addAppender ( appender ) ; } public static void traceCall ( ) { } public static void traceCall ( String message ) { } }

Fix:
Log . logbackLogger . setLevel ( ( useDetailedLogging ? Level . TRACE : Level . WARN ) ) ;
Buggy code:
@ Deprecated public class FileParserJob implements ParserState , Runnable { private static final Logger logger = LoggerFactory . getLogger ( FileParserJob . class ) ; private DateTime stabilizationPeriodEnd ; private long inputDirSignature ; private boolean isRunning = false ; private final Class < ? extends FileParser > parser ; private final File rootDir ; private final int minimumImportFrequency ; private final ConnectionManager connectionManager = new ConnectionManager ( ) ; public FileParserJob ( File rootDir , Class < ? extends FileParser > parser , int minimumImportFrequency ) { } @ Override public final void run ( ) { } private FileParser createParserInstance ( ) { } private final void internalRun ( FileParser parser ) { <START_BUG> if ( ! ( isLocked ( ) ) ) <END_BUG> return ; if ( ( getInputFiles ( ) . length ) == 0 ) return ; isRunning = true ; if ( ( inputDirSignature ) != ( getDirSignature ( ) ) ) { FileParserJob . logger . info ( "Files<seq2seq4repair_space>discovered<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>input<seq2seq4repair_space>directory.<seq2seq4repair_space>Making<seq2seq4repair_space>sure<seq2seq4repair_space>the<seq2seq4repair_space>files<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>completly<seq2seq4repair_space>transfered<seq2seq4repair_space>before<seq2seq4repair_space>parsing<seq2seq4repair_space>will<seq2seq4repair_space>begin." ) ; startStabilizationPeriod ( ) ; return ; } if ( stabilizationPeriodEnd . isAfterNow ( ) ) return ; stabilizationPeriodEnd = null ; inputDirSignature = - 1 ; File [ ] input = getInputFiles ( ) ; if ( ! ( parser . validateInputStructure ( input ) ) ) { FileParserJob . logger . error ( "Not<seq2seq4repair_space>all<seq2seq4repair_space>expected<seq2seq4repair_space>files<seq2seq4repair_space>could<seq2seq4repair_space>be<seq2seq4repair_space>found.<seq2seq4repair_space>Moving<seq2seq4repair_space>the<seq2seq4repair_space>input<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>rejected<seq2seq4repair_space>folder." ) ; moveAllFilesToRejected ( ) ; return ; } runParser ( parser ) ; } private boolean isMundane ( File file ) { } protected long getDirSignature ( ) { } private void startStabilizationPeriod ( ) { } private boolean moveInputToProcessing ( ) { } private void runParser ( FileParser parser ) { } protected void moveAllFilesToRejected ( ) { } public boolean isRejectedDirEmpty ( ) { } public File getInputDir ( ) { } public File [ ] getInputFiles ( ) { } public File getRejectedDir ( ) { } public File [ ] getProcessingFiles ( ) { } public File getProcessingDir ( ) { } public File [ ] getRejectedFiles ( ) { } public File [ ] filterOutMundaneFiles ( File root ) { } public boolean isOverdue ( ) { } @ Override public DateTime nextDeadline ( ) { } @ Override public int minimumImportFrequency ( ) { } @ Override public DateTime latestRunTime ( ) { } @ Override public boolean hasBeenRun ( ) { } @ Override public String identifier ( ) { } @ Override public boolean isLocked ( ) { } @ Override public boolean isInProgress ( ) { } @ Override public String name ( ) { } }

Fix:
if ( isLocked ( ) )
Buggy code:
public class TapPlatformTest extends PlatformTestCase implements Serializable { public TapPlatformTest ( ) { } @ Test public void testSinkDeclaredFields ( ) throws IOException { } @ Test public void testSinkUnknown ( ) throws IOException { } @ Test public void testMultiSinkTap ( ) throws IOException { getPlatform ( ) . copyFromLocal ( inputFileJoined ) ; Tap source = getPlatform ( ) . getTextFile ( new Fields ( "line" ) , inputFileJoined ) ; Pipe pipe = new Pipe ( "test" ) ; pipe = new cascading . pipe . Each ( pipe , new cascading . operation . regex . RegexSplitter ( new Fields ( "number" , "lower" , "upper" ) , "\t" ) ) ; Tap lhsSink = getPlatform ( ) . getTextFile ( new Fields ( "offset" , "line" ) , new Fields ( "number" , "lower" ) , getOutputPath ( "multisink//lhs" ) , REPLACE ) ; <START_BUG> Tap rhsSink = getPlatform ( ) . getTextFile ( new Fields ( "offset" , "line" ) , new Fields ( "number" , "upper" ) , getOutputPath ( "//multisink//rhs" ) , REPLACE ) ; <END_BUG> Tap sink = new MultiSinkTap ( lhsSink , rhsSink ) ; Flow flow = getPlatform ( ) . getFlowConnector ( ) . connect ( source , sink , pipe ) ; flow . complete ( ) ; validateLength ( flow . openTapForRead ( lhsSink ) , 5 ) ; validateLength ( flow . openTapForRead ( rhsSink ) , 5 ) ; } @ Test public void testMultiSourceIterator ( ) throws Exception { } @ Test public void testSideFileCollector ( ) throws Exception { } @ Test public void testPartitionTapTextDelimited ( ) throws IOException { } @ Test public void testTupleEntrySchemeIteratorExceptionHandling ( ) throws IOException { } @ Test public void testTupleEntrySchemeIteratorEOFException ( ) throws IOException { } }

Fix:
Tap rhsSink = getPlatform ( ) . getTextFile ( new Fields ( "offset" , "line" ) , new Fields ( "number" , "upper" ) , getOutputPath ( "multisink//rhs" ) , REPLACE ) ;
Buggy code:
@ RunWith ( MockitoJUnitRunner . class ) public class ServicoControllerTest { private static final Servico SERVICO = new Servico ( "1" , "Título" , "Descrição" , "url:////site" , "Gratuita" , new Orgao ( "Nome" , "123" ) , new Orgao ( "Nome" , null ) , Arrays . asList ( "Área<seq2seq4repair_space>de<seq2seq4repair_space>Interesse" ) , Arrays . asList ( "Linhas<seq2seq4repair_space>da<seq2seq4repair_space>Vida" ) , Arrays . asList ( "Eventos<seq2seq4repair_space>das<seq2seq4repair_space>Linhas<seq2seq4repair_space>da<seq2seq4repair_space>Vida" ) , 0L , 0L ) ; @ Mock private ServicoRepository servicos ; private ServicoController controller ; @ Before public void setUp ( ) { } @ Test public void redirecionaParaAPaginaDeServicos ( ) { } @ Test public void retornaOServicoBuscado ( ) { } @ Test public void incrementaONumeroDeAcessosAoServico ( ) { } @ Test public void redirecionaUsuarioParaLinkDoServico ( ) { ArgumentCaptor < Servico > captor = ArgumentCaptor . forClass ( Servico . class ) ; doReturn ( ServicoControllerTest . SERVICO ) . when ( servicos ) . save ( captor . capture ( ) ) ; String actual = controller . navegar ( "1" ) . getUrl ( ) ; <START_BUG> assertThat ( actual , is ( ServicoControllerTest . SERVICO . getUrl ( ) . get ( ) ) ) ; <END_BUG> assertThat ( captor . getValue ( ) . getAtivacoes ( ) , is ( 1L ) ) ; } @ Test ( expected = ConteudoNaoEncontrado . class ) public void retorna404QuandoServicoNaoExiste ( ) { } @ Test ( expected = ConteudoNaoEncontrado . class ) public void retorna404QuandoRedirecionaParaServicoNaoExistente ( ) { } @ Test ( expected = ConteudoNaoEncontrado . class ) public void retorna404QuandoRedirecionaParaServicoSemURL ( ) { } No newline ; at end ; of file ; }

Fix:
assertThat ( actual , is ( ServicoControllerTest . SERVICO . getUrl ( ) ) ) ;
Buggy code:
class Customer { private final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ; private final String HEX_ALPHABET = "abcdefABCDEF0123456789" ; final int NUM_IN_HEX = HEX_ALPHABET . length ( ) ; private final String ALPHA_NUMERIC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ; private final int LENGTH_OF_ALPHA_NUMERIC = ALPHA_NUMERIC . length ( ) ; private final int NUM_IN_ALPHABET = ALPHABET . length ( ) ; private final UUID CUSTOMER_ID ; private final String NAME ; private final String PASSWORD ; Random r = new Random ( ) ; private CreditReport _cred ; private ChexSystems _score ; private Hashtable < Integer , Account > accountHashtable = new Hashtable < Integer , Account > ( 400 ) ; private int age ; private int ChexSystemsScore ; public Customer ( String tempName , int tempAge , String password , CreditReport newCreditReport , ChexSystems newScore ) { } public Customer ( boolean random ) { } public String getPASSWORD ( ) { } public UUID getUUID ( ) { } public int getAge ( ) { } public String getName ( ) { } public void addSavingsAccount ( double openingBalance ) { } public void addCertificateOfDeposit ( double openingBalance ) { } public void addCheckingAccount ( double openingBalance ) { } public void addIndividualRetirementAccount ( double openingBalance ) { } public int getChexSystemsScore ( ) { } public int getCreditScore ( ) { } private String nameGen ( int minLength , int maxLength ) { } private String passwordGen ( int minLength , int maxLength ) { } private int acctGen ( ) { } public void printAllCustomerInformation ( ) { <START_BUG> System . out . println ( ( ( ( ( ( ( ( ( ( ( ( ( this . CUSTOMER_ID ) + "<seq2seq4repair_space>" ) + ( this . PASSWORD ) ) + "<seq2seq4repair_space>" ) + ( this . NAME ) ) + "<seq2seq4repair_space>" ) + ( this . getAge ( ) ) ) + "<seq2seq4repair_space>" ) + ( this . getCreditScore ( ) ) ) + "<seq2seq4repair_space>" ) + ( this . getChexSystemsScore ( ) ) ) + "<seq2seq4repair_space>" ) ) ; <END_BUG> this . printAccountInformation ( ) ; } public void printAccountInformation ( ) { } No newline ; at end ; of file ; }

Fix:
System . out . println ( ( ( ( ( ( ( ( ( ( ( ( ( "\n" + ( this . CUSTOMER_ID ) ) + "<seq2seq4repair_space>" ) + ( this . PASSWORD ) ) + "<seq2seq4repair_space>" ) + ( this . NAME ) ) + "<seq2seq4repair_space>" ) + ( this . getAge ( ) ) ) + "<seq2seq4repair_space>" ) + ( this . getCreditScore ( ) ) ) + "<seq2seq4repair_space>" ) + ( this . getChexSystemsScore ( ) ) ) + "<seq2seq4repair_space>" ) ) ;
Buggy code:
public class SimpleSecurityManager implements ServerSecurityManager { private ThreadLocalStack < SecurityContext > contexts = new ThreadLocalStack < SecurityContext > ( ) ; private boolean propagate = true ; public SimpleSecurityManager ( ) { } public SimpleSecurityManager ( SimpleSecurityManager delegate ) { } private ISecurityManagement securityManagement = null ; private PrivilegedAction < SecurityContext > securityContext ( ) { } private SecurityContext establishSecurityContext ( final String securityDomain ) { } public void setSecurityManagement ( ISecurityManagement iSecurityManagement ) { } public Principal getCallerPrincipal ( ) { } public Subject getSubject ( ) { } private Principal getPrincipal ( Subject subject ) { } @ Override public boolean isCallerInRole ( String ejbName , Object mappedRoles , Map < String , Collection < String > > roleLinks , String ... roleNames ) { } public boolean isCallerInRole ( final String ejbName , final String policyContextID , final Object incommingMappedRoles , final Map < String , Collection < String > > roleLinks , final String ... roleNames ) { } public boolean authorize ( String ejbName , CodeSource ejbCodeSource , String ejbMethodIntf , Method ejbMethod , Set < Principal > methodRoles , String contextID ) { } public void push ( final String securityDomain ) { } public void push ( final String securityDomain , String userName , char [ ] password , final Subject subject ) { } public void authenticate ( ) { } public void authenticate ( final String runAs , final String runAsPrincipal , final Set < String > extraRoles ) { } private boolean authenticate ( SecurityContext context , Subject subject ) { } private Identity getUnauthenticatedIdentity ( ) { } public void pop ( ) { } private void audit ( String level , AuditManager auditManager , Principal userPrincipal ) { <START_BUG> AuditEvent auditEvent = new AuditEvent ( level ) ; <END_BUG> Map < String , Object > ctxMap = new HashMap < String , Object > ( ) ; ctxMap . put ( "principal" , ( userPrincipal != null ? userPrincipal . getName ( ) : "null" ) ) ; ctxMap . put ( "Source" , getClass ( ) . getCanonicalName ( ) ) ; ctxMap . put ( "Action" , "authentication" ) ; auditEvent . setContextMap ( ctxMap ) ; auditManager . audit ( auditEvent ) ; } private SubjectInfo getSubjectInfo ( final SecurityContext context ) { } private RoleGroup getSubjectRoles ( final AuthorizationManager am , final SecurityContextCallbackHandler scb , final Subject authenticatedSubject ) { } private Map < String , Set < String > > setSecurityRolesAssociation ( Map < String , Set < String > > mappedRoles ) { } private static class SetSecurityRolesAssociationAction implements PrivilegedAction < Map < String , Set < String > > > { private final Map < String , Set < String > > mappedRoles ; SetSecurityRolesAssociationAction ( Map < String , Set < String > > mappedRoles ) { } @ Override public Map < String , Set < String > > run ( ) { } } }

Fix:
AuditEvent auditEvent = new AuditEvent ( AuditLevel . SUCCESS ) ;
Buggy code:
public class ModuleContextProcessor implements DeploymentUnitProcessor { public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final ServiceTarget serviceTarget = phaseContext . getServiceTarget ( ) ; final DeploymentUnit deploymentUnitContext = phaseContext . getDeploymentUnit ( ) ; final ServiceName moduleContextServiceName = GLOBAL_CONTEXT_SERVICE_NAME . append ( deploymentUnitContext . getName ( ) ) ; final JndiName moduleContextJndiName = GLOBAL_CONTEXT_NAME . append ( deploymentUnitContext . getName ( ) ) ; final ContextService contextService = new ContextService ( moduleContextJndiName ) ; serviceTarget . addService ( moduleContextServiceName , contextService ) . addDependency ( GLOBAL_CONTEXT_SERVICE_NAME , Context . class , contextService . getParentContextInjector ( ) ) . install ( ) ; <START_BUG> phaseContext . putAttachment ( ATTACHMENT_KEY , new ModuleContextConfig ( moduleContextServiceName , moduleContextJndiName ) ) ; <END_BUG> } public void undeploy ( DeploymentUnit context ) { } }

Fix:
phaseContext . getDeploymentUnit ( ) . putAttachment ( ATTACHMENT_KEY , new ModuleContextConfig ( moduleContextServiceName , moduleContextJndiName ) ) ;
Buggy code:
public abstract class CacheOperation { private Set < String > cacheNames = Collections . emptySet ( ) ; private String condition = "" ; private String key = "" ; private String name = "" ; public Set < String > getCacheNames ( ) { } public String getCondition ( ) { } public String getKey ( ) { } public String getName ( ) { } public void setCacheName ( String cacheName ) { } public void setCacheNames ( String [ ] cacheNames ) { } public void setCondition ( String condition ) { } public void setKey ( String key ) { } public void setName ( String name ) { } @ Override public boolean equals ( Object other ) { } @ Override public int hashCode ( ) { } @ Override public String toString ( ) { } protected StringBuilder getOperationDescription ( ) { StringBuilder result = new StringBuilder ( ) ; <START_BUG> result . append ( "CacheDefinition[" ) ; <END_BUG> result . append ( this . name ) ; result . append ( "]<seq2seq4repair_space>caches=" ) ; result . append ( this . cacheNames ) ; result . append ( "<seq2seq4repair_space>|<seq2seq4repair_space>condition='" ) ; result . append ( this . condition ) ; result . append ( "'<seq2seq4repair_space>|<seq2seq4repair_space>key='" ) ; result . append ( this . key ) ; result . append ( "'" ) ; return result ; } }

Fix:
result . append ( "CacheOperation[" ) ;
Buggy code:
public class CompareClassifiers { private static Printer printer = new Printer ( true ) ; public static void main ( String [ ] args ) { System . out . println ( "Compare<seq2seq4repair_space>classifiers" ) ; System . out . println ( "--------------------------------------------------" ) ; System . out . println ( ) ; String resourcesDir = Environment . resources ( ) ; Instances ngramsSet = WekaClassifier . fromFiles ( new File ( resourcesDir , "arff//balanced-ngrams-full-dataset.arff" ) ) ; Instances fullSet = WekaClassifier . fromFiles ( new File ( resourcesDir , "arff//balanced-features-full-dataset.arff" ) ) ; <START_BUG> ArrayList < SingleCitedDataSet > datasets = datasetsFromDir ( new File ( resourcesDir , "teufel-citation-context-corpus" ) ) ; <END_BUG> WekaClassifier wekaSMO = WekaClassifier . SMO ( ) ; WekaClassifier wekaNB = WekaClassifier . NaiveBayes ( ) ; WekaClassifier wekaTree = WekaClassifier . J48 ( ) ; WekaClassifier wekaKnn = WekaClassifier . KNN ( ) ; MRF mrf = new MRF ( 4 ) ; double simMult = 0.01 ; WikiGraph conceptGraph = WikiGraphFactory . loadWikiGraph ( new File ( resourcesDir , "ser//linksSingleWords.ser" ) , new File ( resourcesDir , "ser//toIndexSingleWords.ser" ) , simMult , false ) ; MRF_WithConcepts mrfConcepts = new MRF_WithConcepts ( 4 , conceptGraph ) ; int numFolds = 4 ; boolean balanceData = false ; List < String > testSentences = null ; CompareClassifiers . printResult ( "MRF" , mrf . classify ( datasets . get ( 0 ) ) , testSentences ) ; CompareClassifiers . printResult ( "MRF+" , mrfConcepts . classify ( datasets . get ( 0 ) ) , testSentences ) ; CompareClassifiers . printResult ( "SMO+" , wekaSMO . crossValidate ( fullSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "NB+" , wekaNB . crossValidate ( fullSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "Tree+" , wekaTree . crossValidate ( fullSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "KNN+" , wekaKnn . crossValidate ( fullSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "SMO" , wekaSMO . crossValidate ( ngramsSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "NB" , wekaNB . crossValidate ( ngramsSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "Tree" , wekaTree . crossValidate ( ngramsSet , numFolds , balanceData ) , testSentences ) ; CompareClassifiers . printResult ( "KNN" , wekaKnn . crossValidate ( ngramsSet , numFolds , balanceData ) , testSentences ) ; } private static void printResult ( String title , ClassificationResult result , List < String > testSentences ) { } }

Fix:
ArrayList < SingleCitedDataSet > datasets = SingleCitedDataSet . datasetsFromDir ( new File ( resourcesDir , "teufel-citation-context-corpus" ) ) ;
Buggy code:
public class ParticleGameTest { @ Test public void oneRound ( ) { ParticleGame game = new ParticleGame . Builder ( ) . player ( "foo" ) . player ( "bar" ) . build ( ) ; GameRound roundInfo = game . getRoundInfo ( ) ; List < Particle > particles = roundInfo . getParticles ( ) ; assertEquals ( "First<seq2seq4repair_space>round<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>one<seq2seq4repair_space>particle" , particles . size ( ) , 1 ) ; assertEquals ( INITIAL , roundInfo . getState ( ) ) ; Particle p = particles . get ( 0 ) ; game . setSentence ( "foo" , "仕方Aない" ) ; assertEquals ( RUNNING , roundInfo . getState ( ) ) ; GuessResult guess = game . guess ( "bar" , Arrays . asList ( p . toString ( ) ) ) ; assertTrue ( guess . isSuccess ( ) ) ; <START_BUG> assertEquals ( 0 , game . getScore ( ) ) ; <END_BUG> roundInfo = game . getRoundInfo ( ) ; assertEquals ( INITIAL , roundInfo . getState ( ) ) ; assertEquals ( "bar" , roundInfo . getPlayer ( ) ) ; assertNull ( roundInfo . getSentence ( ) ) ; assertEquals ( 1 , roundInfo . getParticles ( ) . size ( ) ) ; } @ Test public void testSentence ( ) { } @ Test public void testGuess ( ) { } }

Fix:
assertEquals ( 1 , game . getScore ( ) ) ;
Buggy code:
public abstract class PerspectiveMenu extends ContributionItem { private static IPerspectiveRegistry reg ; private IWorkbenchWindow window ; private boolean showActive = false ; private boolean dirty = true ; private IMenuListener menuListener = new IMenuListener ( ) { public void menuAboutToShow ( IMenuManager manager ) { } } ; private Comparator comparator = new Comparator ( ) { private Collator collator = Collator . getInstance ( ) ; public int compare ( Object ob1 , Object ob2 ) { } } ; private static Hashtable imageCache = new Hashtable ( 11 ) ; public PerspectiveMenu ( IWorkbenchWindow window , String id ) { } void createMenuItem ( Menu menu , int index , final IPerspectiveDescriptor desc , boolean bCheck ) { } void createOtherItem ( Menu menu , int index ) { } public void fill ( Menu menu , int index ) { } private Image getImage ( IPerspectiveDescriptor perspDesc ) { } private ArrayList getPerspectiveShortcuts ( ) { ArrayList list = new ArrayList ( ) ; IWorkbenchPage page = window . getActivePage ( ) ; if ( page == null ) return list ; ArrayList ids = ( ( org . eclipse . ui . internal . WorkbenchPage ) ( page ) ) . getPerspectiveActionIds ( ) ; if ( ids == null ) return list ; ids = new ArrayList ( ids ) ; IObjectActivityManager activityManager = window . getWorkbench ( ) . getObjectActivityManager ( PL_PERSPECTIVES , false ) ; if ( activityManager != null ) { <START_BUG> ids . retainAll ( activityManager . getActiveObjects ( ) ) ; <END_BUG> } for ( int i = 0 ; i < ( ids . size ( ) ) ; i ++ ) { String perspID = ( ( String ) ( ids . get ( i ) ) ) ; IPerspectiveDescriptor desc = PerspectiveMenu . reg . findPerspectiveWithId ( perspID ) ; if ( ( desc != null ) && ( ! ( list . contains ( desc ) ) ) ) list . add ( desc ) ; } return list ; } protected ArrayList getPerspectiveItems ( ) { } protected boolean getShowActive ( ) { } protected IWorkbenchWindow getWindow ( ) { } public boolean isDirty ( ) { } public boolean isDynamic ( ) { } protected abstract void run ( IPerspectiveDescriptor desc ) { } protected void run ( IPerspectiveDescriptor desc , SelectionEvent event ) { } void runOther ( SelectionEvent event ) { } protected void showActive ( boolean b ) { } }

Fix:
ids . retainAll ( activityManager . getEnabledObjects ( ) ) ;
Buggy code:
public abstract class AbstractComboRules implements IComboRules { protected final boolean haveSamePrerequisite ( ICharm charm1 , ICharm charm2 ) { } protected final boolean haveAttributePrerequisites ( ICharm charm1 , ICharm charm2 ) { } protected final boolean haveAbilityPrerequisites ( ICharm charm1 , ICharm charm2 ) { } protected final boolean allAbilitiesRuleApplied ( ICharm charm1 , ICharm charm2 ) { } protected final boolean selectAbilitiesRuleApplied ( ICharm charm1 , ICharm charm2 ) { <START_BUG> return selectAbilitiesCombo ( charm1 , charm2 ) ; <END_BUG> } protected final boolean isAbilityAttributeCombo ( ICharm charm1 , ICharm charm2 ) { } private boolean isAbilityAttributeMix ( ICharm charm1 , ICharm charm2 ) { } private boolean hasAbilityPrerequisite ( ICharm charm ) { } private boolean hasAttributePrerequisite ( ICharm charm ) { } private boolean allAbiltiesCombo ( ICharm charm1 , ICharm charm2 ) { } private boolean selectAbilitiesCombo ( ICharm charm1 , ICharm charm2 ) { } No newline ; at end ; of file ; }

Fix:
return ( selectAbilitiesCombo ( charm1 , charm2 ) ) || ( selectAbilitiesCombo ( charm2 , charm1 ) ) ;
Buggy code:
public class ResultTeamFragment extends BaseFragment { private GameActionsListener mGameActionsListener ; private ArrayList < AliasWord > mWords ; private RecyclerView mWordsList ; private Button mNextTeam ; public ResultTeamFragment ( ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onViewCreated ( View view , Bundle savedInstanceState ) { super . onViewCreated ( view , savedInstanceState ) ; mWords = getCurrentTeam ( ) . getWords ( ) ; LinearLayoutManager linearLayoutManager = new LinearLayoutManager ( getActivity ( ) , LinearLayoutManager . VERTICAL , false ) ; ResultTeamAdapter adapter = new ResultTeamAdapter ( mWords ) ; mWordsList = ( ( RecyclerView ) ( findViewById ( team_res_team_list ) ) ) ; mWordsList . setLayoutManager ( linearLayoutManager ) ; mWordsList . setAdapter ( adapter ) ; <START_BUG> mNextTeam = ( ( Button ) ( findViewById ( res_footer_replay ) ) ) ; <END_BUG> mNextTeam . setText ( ( isFinish ( ) ? "Show<seq2seq4repair_space>results" : "Start<seq2seq4repair_space>new<seq2seq4repair_space>round!" ) ) ; mNextTeam . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( isFinish ( ) ) mGameActionsListener . onFinishGame ( ) ; else mGameActionsListener . onStartRound ( ) ; } } ) ; } @ Override public void onAttach ( Activity activity ) { } }

Fix:
mNextTeam = ( ( Button ) ( findViewById ( team_res_next ) ) ) ;
Buggy code:
public class QuickAccessHandler extends AbstractHandler { private IWorkbenchWindow window ; public QuickAccessHandler ( ) { } public Object execute ( ExecutionEvent executionEvent ) { window = HandlerUtil . getActiveWorkbenchWindow ( executionEvent ) ; if ( ( window ) == null ) { return null ; } <START_BUG> final PopupDialog popupDialog = new QuickAccessDialog ( window ) ; <END_BUG> window . getShell ( ) . getDisplay ( ) . asyncExec ( new Runnable ( ) { public void run ( ) { final Shell shell = popupDialog . getShell ( ) ; if ( ( shell != null ) && ( ! ( shell . isDisposed ( ) ) ) ) { Point size = shell . getSize ( ) ; shell . setSize ( size . x , ( ( size . y ) + 1 ) ) ; } } } ) ; popupDialog . open ( ) ; return null ; } }

Fix:
final PopupDialog popupDialog = new QuickAccessDialog ( window , executionEvent . getCommand ( ) ) ;
Buggy code:
public class Rule implements OnOperandValueChangedListener { public static final String ARG_RULE_ID = "Rule<seq2seq4repair_space>ID" ; private String mName ; protected RuleOperation mRuleOperation ; protected Map < String , RuleOperation > mRuleOperationDataSourceIdMap ; protected List < RuleAction > mActions ; protected boolean mEnabled ; protected AccessModifier mAccessModifier ; protected UUID mRuleId ; private final IOpenHABWidgetControl mOpenHABWidgetControl ; private final IWearCommandHost mWearCommandHost ; public Rule ( IOpenHABWidgetControl widgetControl , IWearCommandHost wearCommandHost ) { } public Rule ( String name , IOpenHABWidgetControl widgetControl , IWearCommandHost wearCommandHost ) { } public RuleOperation getRuleOperation ( ) { } public void setRuleOperation ( RuleOperation ruleOperation ) { } public String getName ( ) { } public void setName ( String name ) { } @ Override public String toString ( ) { } public void setEnabled ( boolean value ) { } public boolean isEnabled ( ) { } @ Override public void onOperandValueChanged ( IEntityDataType operand ) { <START_BUG> if ( ! ( mEnabled ) ) <END_BUG> return ; for ( RuleAction action : mActions ) { if ( ( ( ( action . getActionType ( ) ) == ( RuleActionType . COMMAND ) ) && ( StringHandler . isNullOrEmpty ( action . mTargetOpenHABItemName ) ) ) || ( StringHandler . isNullOrEmpty ( action . getCommand ( ) ) ) ) continue ; if ( ( action . getActionType ( ) ) == ( RuleActionType . COMMAND ) ) mOpenHABWidgetControl . sendItemCommand ( action . getTargetOpenHABItemName ( ) , action . getCommand ( ) ) ; else mWearCommandHost . startSession ( "Rule<seq2seq4repair_space>Action" , action . getTextValue ( ) ) ; } } public void addAction ( RuleAction action ) { } public List < RuleAction > getActions ( ) { } public AccessModifier getAccess ( ) { } public void setAccess ( AccessModifier access ) { } public UUID getRuleId ( ) { } public void setRuleId ( UUID ruleId ) { } }

Fix:
if ( ( ! ( mEnabled ) ) || ( operand . getValue ( ) . equals ( new LogicBoolean ( false ) ) ) )
Buggy code:
public class OrderByList extends OrderedColumnList implements RequiredRowOrdering { private boolean allAscending = true ; private boolean alwaysSort ; private ResultSetNode resultToSort ; private SortCostController scc ; private Object [ ] resultRow ; private ColumnOrdering [ ] columnOrdering ; private int estimatedRowSize ; private boolean sortNeeded = true ; public void addOrderByColumn ( OrderByColumn column ) { } boolean allAscending ( ) { } public OrderByColumn getOrderByColumn ( int position ) { } public void printSubNodes ( int depth ) { } public void bindOrderByColumns ( ResultSetNode target ) throws StandardException { } public void pullUpOrderByColumns ( ResultSetNode target ) throws StandardException { } boolean isInOrderPrefix ( ResultColumnList sourceRCL ) { } void resetToSourceRCs ( ) { } ResultColumnList reorderRCL ( ResultColumnList resultColumns ) throws StandardException { } void removeConstantColumns ( PredicateList whereClause ) { } void removeDupColumns ( ) { } public void generate ( ActivationClassBuilder acb , MethodBuilder mb , ResultSetNode child ) throws StandardException { if ( ! ( sortNeeded ) ) { child . generate ( acb , mb ) ; return ; } CompilerContext cc = getCompilerContext ( ) ; int orderItem = acb . addItem ( acb . getColumnOrdering ( this ) ) ; acb . pushGetResultSetFactoryExpression ( mb ) ; child . generate ( acb , mb ) ; int resultSetNumber = cc . getNextResultSetNumber ( ) ; mb . push ( false ) ; mb . push ( false ) ; mb . push ( orderItem ) ; child . getResultColumns ( ) . generateHolder ( acb , mb ) ; mb . push ( child . getResultColumns ( ) . getTotalColumnSize ( ) ) ; mb . push ( resultSetNumber ) ; <START_BUG> CostEstimate costEstimate = child . getCostEstimate ( ) ; <END_BUG> mb . push ( costEstimate . rowCount ( ) ) ; mb . push ( costEstimate . getEstimatedCost ( ) ) ; acb . pushResultSetClosedMethodFieldAccess ( mb ) ; mb . callMethod ( INVOKEINTERFACE , ( ( String ) ( null ) ) , "getSortResultSet" , NoPutResultSet , 10 ) ; } public int sortRequired ( RowOrdering rowOrdering ) throws StandardException { } public int sortRequired ( RowOrdering rowOrdering , JBitSet tableMap ) throws StandardException { } public void estimateCost ( double estimatedInputRows , RowOrdering rowOrdering , CostEstimate resultCost ) throws StandardException { } public void sortNeeded ( ) { } public void sortNotNeeded ( ) { } void remapColumnReferencesToExpressions ( ) throws StandardException { } public boolean getSortNeeded ( ) { } }

Fix:
CostEstimate costEstimate = child . getFinalCostEstimate ( ) ;
Buggy code:
public class CommonFilter implements ContainerRequestFilter , ContainerResponseFilter { private final String SCAN_PKG_REST_ANNOTATION = "com.dsi" ; private final String REQ_KEY = "REQ" ; private final String RESP_KEY = "RESP" ; private Map < String , Filter > cache = new WeakHashMap < String , Filter > ( ) ; public void filter ( ContainerRequestContext requestContext ) throws IOException { } private void buildCache ( ) { } public void filter ( ContainerRequestContext requestContext , ContainerResponseContext responseContext ) throws IOException { Response resp = ( ( Response ) ( requestContext . getProperty ( RESP_KEY ) ) ) ; if ( ( resp . getStatus ( ) ) != null ) { responseContext . setStatus ( resp . getStatus ( ) . getStatusCode ( ) ) ; } if ( ( resp . getEntity ( ) ) != null ) { responseContext . setEntity ( resp . getEntity ( ) ) ; } if ( ( resp . getHeaders ( ) . size ( ) ) > 0 ) { MultivaluedMap < String , Object > headers = responseContext . getHeaders ( ) ; for ( Map . Entry < String , String > header : resp . getHeaders ( ) . entrySet ( ) ) { <START_BUG> headers . add ( header . getKey ( ) , header . getValue ( ) ) ; <END_BUG> } } } }

Fix:
headers . putSingle ( header . getKey ( ) , header . getValue ( ) ) ;
Buggy code:
public class TestNumericRangeFilterBuilder extends LuceneTestCase { public void testGetFilterHandleNumericParseErrorStrict ( ) throws Exception { } public void testGetFilterHandleNumericParseError ( ) throws Exception { NumericRangeFilterBuilder filterBuilder = new NumericRangeFilterBuilder ( ) ; filterBuilder . setStrictMode ( false ) ; String xml = "<NumericRangeFilter<seq2seq4repair_space>fieldName='AGE'<seq2seq4repair_space>type='int'<seq2seq4repair_space>lowerTerm='-1'<seq2seq4repair_space>upperTerm='NaN'//>" ; Document doc = TestNumericRangeFilterBuilder . getDocumentFromString ( xml ) ; Filter filter = filterBuilder . getFilter ( doc . getDocumentElement ( ) ) ; Directory ramDir = newDirectory ( ) ; IndexWriter writer = new IndexWriter ( ramDir , newIndexWriterConfig ( TEST_VERSION_CURRENT , null ) ) ; writer . commit ( ) ; try { AtomicReader reader = SlowCompositeReaderWrapper . wrap ( DirectoryReader . open ( ramDir ) ) ; try { assertNull ( filter . getDocIdSet ( reader . getContext ( ) , reader . getLiveDocs ( ) ) ) ; } finally { reader . close ( ) ; } } finally { writer . commit ( ) ; <START_BUG> writer . close ( ) ; <END_BUG> ramDir . close ( ) ; } } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void testGetFilterInt ( ) throws Exception { } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void testGetFilterLong ( ) throws Exception { } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void testGetFilterDouble ( ) throws Exception { } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void testGetFilterFloat ( ) throws Exception { } private static Document getDocumentFromString ( String str ) throws IOException , ParserConfigurationException , SAXException { } }

Fix:
writer . shutdown ( ) ;
Buggy code:
public class EmbeddedCassandraServiceTest { private static EmbeddedCassandraService cassandra ; @ BeforeClass public static void setup ( ) throws IOException , InterruptedException , ConfigurationException , TTransportException { } @ Test public void testEmbeddedCassandraService ( ) throws UnsupportedEncodingException , AuthenticationException , AuthorizationException , InvalidRequestException , NotFoundException , TimedOutException , UnavailableException , TException { } private Client getClient ( ) throws TTransportException { <START_BUG> TTransport tr = new TSocket ( "localhost" , 9170 ) ; <END_BUG> TProtocol proto = new org . apache . thrift . protocol . TBinaryProtocol ( tr ) ; Cassandra . Client client = new Cassandra . Client ( proto ) ; tr . open ( ) ; return client ; } }

Fix:
TTransport tr = new org . apache . thrift . transport . TSocket ( "localhost" , DatabaseDescriptor . getRpcPort ( ) ) ;