nus-yam/ex-repair huggingface dataset:
Buggy code:
public class OSGiExtension implements Extension { public static final String SUBSYSTEM_NAME = "osgi" ; @ Override public void initializeParsers ( ExtensionParsingContext context ) { } @ Override public void initialize ( ExtensionContext context ) { final SubsystemRegistration subsystem = context . registerSubsystem ( OSGiExtension . SUBSYSTEM_NAME ) ; final ManagementResourceRegistration registration = subsystem . registerSubsystemModel ( SUBSYSTEM ) ; registration . registerOperationHandler ( ADD , INSTANCE , DESCRIPTION , false ) ; registration . registerReadWriteAttribute ( ACTIVATION , null , new ActivationAttributeHandler ( ) , CONFIGURATION ) ; registration . registerReadWriteAttribute ( STARTLEVEL , READ_HANDLER , WRITE_HANDLER , RUNTIME ) ; registration . registerOperationHandler ( DESCRIBE , OSGiSubsystemDescribeHandler . INSTANCE , DESCRIPTION , false , PRIVATE ) ; ManagementResourceRegistration configuration = registration . registerSubModel ( PathElement . pathElement ( ModelConstants . CONFIGURATION ) , CONFIGURATION_DESCRIPTION ) ; configuration . registerOperationHandler ( ADD , OSGiConfigurationAdd . INSTANCE , OSGiConfigurationAdd . DESCRIPTION , false ) ; configuration . registerOperationHandler ( REMOVE , OSGiConfigurationRemove . INSTANCE , OSGiConfigurationRemove . DESCRIPTION , false ) ; <START_BUG> ManagementResourceRegistration properties = registration . registerSubModel ( PathElement . pathElement ( FRAMEWORK_PROPERTY ) , FRAMEWORK_PROPERTY_DESCRIPTION ) ; <END_BUG> properties . registerOperationHandler ( ADD , OSGiFrameworkPropertyAdd . INSTANCE , OSGiFrameworkPropertyAdd . DESCRIPTION , false ) ; properties . registerOperationHandler ( REMOVE , OSGiFrameworkPropertyRemove . INSTANCE , OSGiFrameworkPropertyRemove . DESCRIPTION , false ) ; ManagementResourceRegistration capabilities = registration . registerSubModel ( PathElement . pathElement ( CAPABILITY ) , CAPABILITY_DESCRIPTION ) ; capabilities . registerOperationHandler ( ADD , OSGiCapabilityAdd . INSTANCE , OSGiCapabilityAdd . DESCRIPTION , false ) ; capabilities . registerOperationHandler ( REMOVE , OSGiCapabilityRemove . INSTANCE , OSGiCapabilityRemove . DESCRIPTION , false ) ; if ( context . getProcessType ( ) . isServer ( ) ) { ManagementResourceRegistration bundles = registration . registerSubModel ( PathElement . pathElement ( BUNDLE ) , BUNDLE_DESCRIPTION ) ; BundleRuntimeHandler . INSTANCE . register ( bundles ) ; } subsystem . registerXMLElementWriter ( OSGiSubsystemWriter . INSTANCE ) ; } }

Fix:
ManagementResourceRegistration properties = registration . registerSubModel ( PathElement . pathElement ( PROPERTY ) , FRAMEWORK_PROPERTY_DESCRIPTION ) ;
Buggy code:
public class UpToDate extends MatchingTask implements Condition { private Vector sourceFileSets = new Vector ( ) ; protected Mapper mapperElement = null ; private String _property ; private File _targetFile ; private String _value ; public void setProperty ( String property ) { } public void setTargetFile ( File file ) { } public void setValue ( String value ) { } public void addSrcfiles ( FileSet fs ) { } public Mapper createMapper ( ) throws TaskException { } public boolean eval ( ) throws TaskException { } public void execute ( ) throws TaskException { boolean upToDate = eval ( ) ; if ( upToDate ) { <START_BUG> this . project . setProperty ( _property , this . getValue ( ) ) ; <END_BUG> if ( ( mapperElement ) == null ) { log ( ( ( "File<seq2seq4repair_space>\"" + ( _targetFile . getAbsolutePath ( ) ) ) + "\"<seq2seq4repair_space>is<seq2seq4repair_space>up<seq2seq4repair_space>to<seq2seq4repair_space>date." ) , MSG_VERBOSE ) ; } else { log ( "All<seq2seq4repair_space>target<seq2seq4repair_space>files<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>up<seq2seq4repair_space>to<seq2seq4repair_space>date." , MSG_VERBOSE ) ; } } } protected boolean scanDir ( File srcDir , String [ ] files ) throws TaskException { } private String getValue ( ) { } }

Fix:
setProperty ( _property , this . getValue ( ) ) ;
Buggy code:
public abstract class Piece { protected Tile position ; protected String color ; private Image chesspieceImage ; private ImageView chesspieceImageView ; public Piece ( Tile position , String color ) { } public void move ( Board board , Tile position ) throws InvalidMoveException { <START_BUG> if ( Arrays . asList ( getMoves ( board ) ) . contains ( position ) ) { <END_BUG> this . position = position ; position . setPiece ( this ) ; } else { throw new InvalidMoveException ( "This<seq2seq4repair_space>piece<seq2seq4repair_space>can't<seq2seq4repair_space>move<seq2seq4repair_space>there." ) ; } } public Image getChesspieceImage ( ) { } public void setChesspieceImage ( Image chesspieceImage ) { } public ImageView getChesspieceImageView ( ) { } public void setChesspieceImageView ( ImageView chesspieceImageView ) { } abstract List < Tile > getMoves ( Board board ) { } public String getColor ( ) { } public Tile getPosition ( ) { } }

Fix:
if ( getMoves ( board ) . contains ( position ) ) {
Buggy code:
public class YamlReaderTest extends TestCase { public void testSimpleFields ( ) throws Exception { } public void testUnicodeStrings ( ) throws Exception { } public void testSequence ( ) throws Exception { } public void testAnchors ( ) throws Exception { } public void testSingleQuotes ( ) throws Exception { } public static class Node { public YamlReaderTest . Node left ; public YamlReaderTest . Node right ; public YamlReaderTest . Node parent ; public String value ; } public void testCyclicReferences ( ) throws Exception { } private YamlReaderTest . Test read ( String yaml ) throws Exception { if ( true ) { System . out . println ( yaml ) ; System . out . println ( "===" ) ; <START_BUG> System . out . println ( new YamlReader ( yaml ) . read ( null ) ) ; <END_BUG> System . out . println ( ) ; System . out . println ( ) ; } return new YamlReader ( yaml ) . read ( YamlReaderTest . Test . class ) ; } public static class Test { public String stringValue ; public int intValue ; public boolean booleanValue ; public float floatValue ; public double doubleValue ; public long longValue ; public short shortValue ; public char charValue ; public byte byteValue ; public List listValues ; public Object [ ] arrayObjects ; public String [ ] arrayStrings ; public int [ ] arrayInts ; public YamlReaderTest . Test child1 ; public YamlReaderTest . Test child2 ; public YamlReaderTest . TestEnum testEnum ; } public static enum TestEnum { a , b , c ; } public void testPropertyElementType ( ) throws Exception { } public void testConstructorArgs ( ) throws Exception { } public static class Moo1 { private List < YamlReaderTest . Value > ints ; public List strings ; public List < YamlReaderTest . Value > getInts ( ) { } public void setInts ( List < YamlReaderTest . Value > ints ) { } public List getStrings ( ) { } public void setStrings ( List strings ) { } } public static class Moo2 { private List < YamlReaderTest . Value > ints ; public List < YamlReaderTest . Value > getInts ( ) { } public void setInts ( List < YamlReaderTest . Value > ints ) { } } public static class Value { public int value ; public int getValue ( ) { } public void setValue ( int value ) { } } public static class ConstructorArgs { private int x ; private int y ; private int z ; public ConstructorArgs ( int x , int y ) { } public int getX ( ) { } public void setX ( int x ) { } public int getY ( ) { } public void setY ( int y ) { } public int getZ ( ) { } public void setZ ( int z ) { } } }

Fix:
System . out . println ( new YamlReader ( yaml ) . read ( ) ) ;
Buggy code:
public class TokenizedPattern { public static final TokenizedPattern EMPTY_PATTERN = new TokenizedPattern ( "" , new String [ 0 ] ) ; private final String pattern ; private final String [ ] tokenizedPattern ; public TokenizedPattern ( String pattern ) { } TokenizedPattern ( String pattern , String [ ] tokens ) { } public boolean matchPath ( TokenizedPath path , boolean isCaseSensitive ) { } public boolean matchStartOf ( TokenizedPath path , boolean caseSensitive ) { } public String toString ( ) { } public String getPattern ( ) { } public boolean equals ( Object o ) { } public int hashCode ( ) { } public int depth ( ) { } public boolean containsPattern ( String pat ) { } public TokenizedPath rtrimWildcardTokens ( ) { <START_BUG> StringBuffer sb = new StringBuffer ( ) ; <END_BUG> int newLen = 0 ; for ( ; newLen < ( tokenizedPattern . length ) ; newLen ++ ) { if ( SelectorUtils . hasWildcards ( tokenizedPattern [ newLen ] ) ) { break ; } if ( ( newLen > 0 ) && ( ( sb . charAt ( ( ( sb . length ( ) ) - 1 ) ) ) != ( File . separatorChar ) ) ) { sb . append ( File . separator ) ; } sb . append ( tokenizedPattern [ newLen ] ) ; } if ( newLen == 0 ) { return TokenizedPath . EMPTY_PATH ; } String [ ] newPats = new String [ newLen ] ; System . arraycopy ( tokenizedPattern , 0 , newPats , 0 , newLen ) ; return new TokenizedPath ( sb . toString ( ) , newPats ) ; } public boolean endsWith ( String s ) { } public TokenizedPattern withoutLastToken ( ) { } }

Fix:
StringBuilder sb = new StringBuilder ( ) ;
Buggy code:
public class SubsystemParsingUnitTestCase extends TestCase { private static final String namespace = "urn:jboss:domain:messaging:1.0" ; private static final MessagingSubsystemParser parser = MessagingSubsystemParser . getInstance ( ) ; public void test ( ) throws Exception { List < ModelNode > operations = parse ( "subsystem.xml" ) ; <START_BUG> Assert . assertEquals ( 1 , operations . size ( ) ) ; <END_BUG> final ModelNode operation = operations . get ( 0 ) ; System . err . println ( operation ) ; operation . get ( OP_ADDR ) . asPropertyList ( ) ; final ModelNode node = new ModelNode ( ) ; node . add ( "test" , "test" ) ; node . asPropertyList ( ) ; final ModelNode op = new ModelNode ( ) ; op . get ( "address" ) . set ( node ) ; op . get ( "address" ) . asPropertyList ( ) ; final ModelNode op2 = new ModelNode ( ) ; op2 . get ( "address" ) . set ( node ) . add ( "test" , "test" ) ; op2 . get ( "address" ) . asPropertyList ( ) ; } List < ModelNode > parse ( final String name ) throws IOException , XMLStreamException { } }

Fix:
Assert . assertEquals ( 6 , operations . size ( ) ) ;
Buggy code:
public interface BlogRepository extends JpaRepository < Blog , Integer > { @ Query ( "select<seq2seq4repair_space>b<seq2seq4repair_space>from<seq2seq4repair_space>Blog<seq2seq4repair_space>b<seq2seq4repair_space>where<seq2seq4repair_space>user<seq2seq4repair_space>=<seq2seq4repair_space>?1<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>b.id" ) List < Blog > findByUser ( User user ) { } Blog findByUrl ( String url ) { } @ Query ( "select<seq2seq4repair_space>b<seq2seq4repair_space>from<seq2seq4repair_space>Blog<seq2seq4repair_space>b<seq2seq4repair_space>join<seq2seq4repair_space>fetch<seq2seq4repair_space>b.user<seq2seq4repair_space>where<seq2seq4repair_space>b.id<seq2seq4repair_space>=<seq2seq4repair_space>?1" ) Blog findOneFetchUser ( int id ) { } Blog findByShortName ( String shortName ) { } <START_BUG> @ Query ( "select<seq2seq4repair_space>b<seq2seq4repair_space>from<seq2seq4repair_space>Blog<seq2seq4repair_space>b<seq2seq4repair_space>join<seq2seq4repair_space>fetch<seq2seq4repair_space>b.user<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>b.shortName" ) <END_BUG> List < Blog > findAllFetchUser ( ) ; Blog findByIdAndUserName ( int id , String username ) { } }

Fix:
@ Query ( "select<seq2seq4repair_space>b<seq2seq4repair_space>from<seq2seq4repair_space>Blog<seq2seq4repair_space>b<seq2seq4repair_space>join<seq2seq4repair_space>fetch<seq2seq4repair_space>b.user<seq2seq4repair_space>left<seq2seq4repair_space>join<seq2seq4repair_space>fetch<seq2seq4repair_space>b.category<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>b.shortName" )
Buggy code:
public class JoinGroupWizard extends Wizard { protected static final String PAGE_TITLE = "ECF<seq2seq4repair_space>Connect" ; private static final String DIALOG_SETTINGS = JoinGroupWizard . class . getName ( ) ; JoinGroupWizardPage mainPage ; private IResource project ; public JoinGroupWizard ( IResource project , IWorkbench workbench ) { } protected ISchedulingRule getSchedulingRule ( ) { } public void addPages ( ) { } public boolean performFinish ( ) { } protected void finishPage ( final IProgressMonitor monitor ) throws InterruptedException , CoreException { mainPage . saveDialogSettings ( ) ; URIClientConnectAction client = null ; String groupName = mainPage . getJoinGroupText ( ) ; String nickName = mainPage . getNicknameText ( ) ; String containerType = mainPage . getContainerType ( ) ; String password = mainPage . getPasswordText ( ) ; try { client = new URIClientConnectAction ( containerType , groupName , nickName , password , project ) ; client . run ( null ) ; } catch ( Exception e ) { <START_BUG> String id = ClientPlugin . PLUGIN_ID ; <END_BUG> throw new CoreException ( new Status ( Status . ERROR , id , 100 , ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>connect<seq2seq4repair_space>to<seq2seq4repair_space>" + groupName ) , e ) ) ; } } }

Fix:
String id = ClientPlugin . getDefault ( ) . getBundle ( ) . getSymbolicName ( ) ;
Buggy code:
public class QueuelessThreadPoolService implements Service < ManagedQueuelessExecutorService > { private final InjectedValue < ThreadFactory > threadFactoryValue = new InjectedValue < ThreadFactory > ( ) ; private final InjectedValue < Executor > handoffExecutorValue = new InjectedValue < Executor > ( ) ; private ManagedQueuelessExecutorService executor ; private int maxThreads ; private boolean blocking ; private TimeSpec keepAlive ; public QueuelessThreadPoolService ( int maxThreads , boolean blocking , TimeSpec keepAlive ) { } public synchronized void start ( final StartContext context ) throws StartException { } public synchronized void stop ( final StopContext context ) { } public synchronized ManagedQueuelessExecutorService getValue ( ) throws IllegalStateException { final ManagedQueuelessExecutorService value = this . executor ; if ( value == null ) { <START_BUG> throw ROOT_LOGGER . queuelessThreadPoolExecutorUninitialized ( ) ; <END_BUG> } return value ; } public Injector < ThreadFactory > getThreadFactoryInjector ( ) { } public Injector < Executor > getHandoffExecutorInjector ( ) { } public synchronized void setMaxThreads ( int maxThreads ) { } public synchronized void setKeepAlive ( TimeSpec keepAliveSpec ) { } public int getCurrentThreadCount ( ) { } public int getLargestThreadCount ( ) { } public int getRejectedCount ( ) { } public int getQueueSize ( ) { } TimeUnit getKeepAliveUnit ( ) { } }

Fix:
throw MESSAGES . queuelessThreadPoolExecutorUninitialized ( ) ;
Buggy code:
class SessionOpenRequestHandler extends EJBIdentifierBasedMessageHandler { private static final byte HEADER_SESSION_OPEN_RESPONSE = 2 ; private static final byte HEADER_EJB_NOT_STATEFUL = 13 ; private final ExecutorService executorService ; private final MarshallerFactory marshallerFactory ; SessionOpenRequestHandler ( final DeploymentRepository deploymentRepository , final MarshallerFactory marshallerFactory , final ExecutorService executorService ) { } @ Override public void processMessage ( ChannelAssociation channelAssociation , MessageInputStream messageInputStream ) throws IOException { if ( messageInputStream == null ) { throw MESSAGES . messageInputStreamCannotBeNull ( ) ; } final DataInputStream dataInputStream = new DataInputStream ( messageInputStream ) ; final short invocationId = dataInputStream . readShort ( ) ; final String appName = dataInputStream . readUTF ( ) ; final String moduleName = dataInputStream . readUTF ( ) ; final String distinctName = dataInputStream . readUTF ( ) ; final String beanName = dataInputStream . readUTF ( ) ; final EjbDeploymentInformation ejbDeploymentInformation = this . findEJB ( appName , moduleName , distinctName , beanName ) ; if ( ejbDeploymentInformation == null ) { this . writeNoSuchEJBFailureMessage ( channelAssociation , invocationId , appName , moduleName , distinctName , beanName , null ) ; return ; } final Component component = ejbDeploymentInformation . getEjbComponent ( ) ; if ( ! ( component instanceof StatefulSessionComponent ) ) { <START_BUG> final String failureMessage = ROOT_LOGGER . notStatefulSessionBean ( beanName , appName , moduleName , distinctName ) . getLocalizedMessage ( ) ; <END_BUG> this . writeInvocationFailure ( channelAssociation , SessionOpenRequestHandler . HEADER_EJB_NOT_STATEFUL , invocationId , failureMessage ) ; return ; } final StatefulSessionComponent statefulSessionComponent = ( ( StatefulSessionComponent ) ( component ) ) ; executorService . submit ( new SessionOpenRequestHandler . SessionIDGeneratorTask ( statefulSessionComponent , channelAssociation , invocationId ) ) ; } private void writeSessionId ( final ChannelAssociation channelAssociation , final short invocationId , final SessionID sessionID , final Affinity hardAffinity ) throws IOException { } private class SessionIDGeneratorTask implements Runnable { private final StatefulSessionComponent statefulSessionComponent ; private final ChannelAssociation channelAssociation ; private final short invocationId ; SessionIDGeneratorTask ( final StatefulSessionComponent statefulSessionComponent , final ChannelAssociation channelAssociation , final short invocationId ) { } @ Override public void run ( ) { } } }

Fix:
final String failureMessage = MESSAGES . notStatefulSessionBean ( beanName , appName , moduleName , distinctName ) . getLocalizedMessage ( ) ;
Buggy code:
public class P4Reopen extends P4Base { private String toChange = "" ; public void setToChange ( String toChange ) throws BuildException { <START_BUG> if ( ( toChange == null ) && ( ! ( toChange . equals ( "" ) ) ) ) { <END_BUG> throw new BuildException ( "P4Reopen:<seq2seq4repair_space>tochange<seq2seq4repair_space>cannot<seq2seq4repair_space>be<seq2seq4repair_space>null<seq2seq4repair_space>or<seq2seq4repair_space>empty" ) ; } this . toChange = toChange ; } public void execute ( ) throws BuildException { } }

Fix:
if ( ( toChange == null ) || ( toChange . equals ( "" ) ) ) {
Buggy code:
public class ColumbaHeader { protected Header header ; protected Attributes attributes ; protected Flags flags ; public ColumbaHeader ( ColumbaHeader header ) { } public ColumbaHeader ( ) { } public ColumbaHeader ( Header header ) { } public Object clone ( ) { } public void copyColumbaKeys ( ColumbaHeader header ) { } public int count ( ) { } public Flags getFlags ( ) { } public Object get ( String s ) { } public void set ( String s , Object o ) { } public Header getHeader ( ) { } public Attributes getAttributes ( ) { } public void setAttributes ( Attributes attributes ) { } public void setFlags ( Flags flags ) { } public void setHeader ( Header header ) { } public Boolean hasAttachments ( ) { boolean hasAttachments = false ; MimeType mimeType = new org . columba . ristretto . message . MimeHeader ( header ) . getMimeType ( ) ; hasAttachments = ( ! ( mimeType . getType ( ) . equals ( "text" ) ) ) && ( ! ( mimeType . getSubtype ( ) . equals ( "alternative" ) ) ) ; <START_BUG> return new Boolean ( hasAttachments ) ; <END_BUG> } }

Fix:
return Boolean . valueOf ( hasAttachments ) ;
Buggy code:
public class Compiler implements ITypeRequestor , ProblemSeverities { public Parser parser ; ICompilerRequestor requestor ; public CompilerOptions options ; public ProblemReporter problemReporter ; CompilationUnitDeclaration [ ] unitsToProcess ; int totalUnits ; public LookupEnvironment lookupEnvironment ; public static boolean DEBUG = false ; public int parseThreshold = - 1 ; public static IDebugRequestor DebugRequestor = null ; public Compiler ( INameEnvironment environment , IErrorHandlingPolicy policy , Map settings , final ICompilerRequestor requestor , IProblemFactory problemFactory ) { } public Compiler ( INameEnvironment environment , IErrorHandlingPolicy policy , Map settings , final ICompilerRequestor requestor , IProblemFactory problemFactory , boolean parseLiteralExpressionsAsConstants ) { } public void accept ( IBinaryType binaryType , PackageBinding packageBinding ) { } public void accept ( ICompilationUnit sourceUnit ) { } public void accept ( ISourceType [ ] sourceTypes , PackageBinding packageBinding ) { } protected void addCompilationUnit ( ICompilationUnit sourceUnit , CompilationUnitDeclaration parsedUnit ) { } protected void beginToCompile ( ICompilationUnit [ ] sourceUnits ) { } public void compile ( ICompilationUnit [ ] sourceUnits ) { } protected void getMethodBodies ( CompilationUnitDeclaration unit , int place ) { } protected void handleInternalException ( Throwable internalException , CompilationUnitDeclaration unit , CompilationResult result ) { internalException . printStackTrace ( ) ; if ( unit != null ) result = unit . compilationResult ; if ( ( ( result == null ) && ( ( unitsToProcess ) != null ) ) && ( ( totalUnits ) > 0 ) ) result = unitsToProcess [ ( ( totalUnits ) - 1 ) ] . compilationResult ; if ( result != null ) { StringWriter stringWriter = new StringWriter ( ) ; PrintWriter writer = new PrintWriter ( stringWriter ) ; internalException . printStackTrace ( writer ) ; StringBuffer buffer = stringWriter . getBuffer ( ) ; <START_BUG> result . record ( problemReporter . createProblem ( result . getFileName ( ) , UnclassifiedProblem , new String [ ] { ( ( org . eclipse . jdt . internal . compiler . util . Util . bind ( "compilation.internalError" ) ) + "\n" ) + ( buffer . toString ( ) ) } , ProblemSeverities . Error , 0 , 0 , 0 ) ) ; <END_BUG> if ( ! ( result . hasBeenAccepted ) ) { requestor . acceptResult ( result . tagAsAccepted ( ) ) ; } } } protected void handleInternalException ( org . eclipse . jdt . internal . compiler . problem . AbortCompilation abortException , CompilationUnitDeclaration unit ) { } private void process ( CompilationUnitDeclaration unit , int i ) { } public void reset ( ) { } public CompilationUnitDeclaration resolve ( ICompilationUnit sourceUnit ) { } }

Fix:
result . record ( problemReporter . createProblem ( result . getFileName ( ) , IProblem . Unclassified , new String [ ] { ( ( org . eclipse . jdt . internal . compiler . util . Util . bind ( "compilation.internalError" ) ) + "\n" ) + ( buffer . toString ( ) ) } , ProblemSeverities . Error , 0 , 0 , 0 ) ) ;
Buggy code:
public class XMlHandlerFindById extends DefaultHandler { boolean isText = false ; boolean isTitle = false ; boolean isBody = true ; private int id ; private String text = "" ; private String title = "" ; private boolean found = false ; private Article a ; public XMlHandlerFindById ( int id ) { } public void startElement ( String uri , String localName , String qName , Attributes attributes ) throws SAXException { } public void characters ( char [ ] ch , int start , int length ) throws SAXException { } public void endElement ( String uri , String localName , String qName ) throws SAXException { if ( ( qName . equals ( "TEXT" ) ) && ( found ) ) isText = false ; if ( ( qName . equals ( "TITLE" ) ) && ( found ) ) isTitle = false ; if ( ( qName . equals ( "BODY" ) ) && ( found ) ) { isBody = false ; <START_BUG> a = new Article ( id , HtmlEntities . encode ( title ) , text ) ; <END_BUG> throw new SAXException ( "done" ) ; } } public Article getResult ( ) { } }

Fix:
a = new Article ( id , HtmlEntities . encode ( title ) , HtmlEntities . encode ( text ) ) ;
Buggy code:
public class SolrExampleEmbeddedTest extends SolrExampleTests { SolrServer server ; @ Override public void setUp ( ) throws Exception { } @ Override protected SolrServer getSolrServer ( ) { } @ Override protected SolrServer createNewSolrServer ( ) { <START_BUG> return new EmbeddedSolrServer ( h . getCore ( ) ) ; <END_BUG> } }

Fix:
return new EmbeddedSolrServer ( h . getCoreContainer ( ) , "" ) ;
Buggy code:
public abstract class AbstractNaiveBayesClassifier extends AbstractVectorClassifier { private final NaiveBayesModel model ; protected AbstractNaiveBayesClassifier ( NaiveBayesModel model ) { } protected NaiveBayesModel getModel ( ) { } protected abstract double getScoreForLabelFeature ( int label , int feature ) { } protected double getScoreForLabelInstance ( int label , Vector instance ) { double result = 0.0 ; Iterator < Element > elements = instance . iterateNonZero ( ) ; while ( elements . hasNext ( ) ) { Element e = elements . next ( ) ; result += ( e . get ( ) ) * ( getScoreForLabelFeature ( label , e . index ( ) ) ) ; } <START_BUG> return result // ( model . thetaNormalizer ( label ) ) ; <END_BUG> } @ Override public int numCategories ( ) { } @ Override public Vector classifyFull ( Vector instance ) { } @ Override public Vector classifyFull ( Vector r , Vector instance ) { } @ Override public double classifyScalar ( Vector instance ) { } @ Override public Vector classify ( Vector instance ) { } }

Fix:
return - result ;
Buggy code:
public class MockWebApplicationTest extends TestCase { private MockWebApplication application ; public MockWebApplicationTest ( String name ) { } protected void setUp ( ) throws Exception { } public void testRenderHomePage ( ) throws Exception { } public void testClickLink ( ) throws Exception { } private boolean validateDocument ( String document , int expectedLinkClickCount ) { HtmlDocumentValidator validator = new HtmlDocumentValidator ( ) ; Tag html = new Tag ( "html" ) ; Tag head = new Tag ( "head" ) ; html . addExpectedChild ( head ) ; Tag title = new Tag ( "title" ) ; head . addExpectedChild ( title ) ; title . addExpectedChild ( new TextContent ( "Mock<seq2seq4repair_space>Page" ) ) ; Tag body = new Tag ( "body" ) ; html . addExpectedChild ( body ) ; Tag a = new Tag ( "a" ) ; a . addExpectedAttribute ( "href" , "//MockWebApplication//MockWebApplication\\?component=[0-9]+.actionLink&amp;version=[0-9]+&amp;interface=ILinkListener" ) ; <START_BUG> a . addExpectedAttribute ( "id" , "wicket-actionLink" ) ; <END_BUG> body . addExpectedChild ( a ) ; a . addExpectedChild ( new TextContent ( "Action<seq2seq4repair_space>link<seq2seq4repair_space>clicked<seq2seq4repair_space>" ) ) ; Tag span = new Tag ( "span" ) ; span . addExpectedChild ( new TextContent ( ( "" + expectedLinkClickCount ) ) ) ; a . addExpectedChild ( span ) ; a . addExpectedChild ( new TextContent ( "<seq2seq4repair_space>times" ) ) ; validator . addRootElement ( html ) ; return validator . isDocumentValid ( document ) ; } }

Fix:
a . addExpectedAttribute ( "wicket:id" , "actionLink" ) ;
Buggy code:
public class TXEmailServlet extends HttpServlet { private static final long serialVersionUID = 1L ; private Date currentDate ; private EventsDAO eventDao ; public void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws IOException { } private List < Event > filterEvents ( List < Event > events ) { List < Event > filteredEvents = new ArrayList < Event > ( ) ; for ( Event event : events ) { <START_BUG> if ( event . isFinished ( ) ) <END_BUG> continue ; Phase currentPhase = event . getCurrentPhase ( ) ; PHASE_STATE oldState = currentPhase . getState ( ) ; Date phaseStartDate = currentPhase . getFechaIni ( ) ; Date phaseEndDate = currentPhase . getFechaFin ( ) ; PHASE_STATE newState = PHASE_STATE . NO_STATE ; if ( currentDate . before ( phaseStartDate ) ) newState = PHASE_STATE . NOT_STARTED ; else if ( ( currentDate . after ( phaseStartDate ) ) && ( currentDate . before ( phaseEndDate ) ) ) newState = PHASE_STATE . IN_PROGRESS ; else if ( currentDate . after ( phaseEndDate ) ) newState = PHASE_STATE . FINISHED ; if ( oldState == newState ) continue ; LOGGER . info ( ( "El<seq2seq4repair_space>estado<seq2seq4repair_space>de<seq2seq4repair_space>la<seq2seq4repair_space>fase<seq2seq4repair_space>ha<seq2seq4repair_space>cambiado:<seq2seq4repair_space>" + currentPhase ) ) ; if ( newState != ( oldState . next ( ) ) ) { LOGGER . severe ( ( ( ( "State<seq2seq4repair_space>changed<seq2seq4repair_space>unespectly\n" + currentPhase ) + "\n" ) + event ) ) ; continue ; } filteredEvents . add ( event ) ; } return filteredEvents ; } }

Fix:
if ( ( event . isFinished ( ) ) || ( ! ( event . hasStarted ( ) ) ) )
Buggy code:
public class Config { private File configdir ; private static final String DATABASE_DIR_PROPERTY = "database_dir" ; private final File databaseDir ; private static final String TEMPORARY_DIR_PROPERTY = "temporary_dir" ; private final File tmpDir ; private static final String MONITOR_PORT_PROPERTY = "monitor_port" ; private final int monitorPort ; private static final String WARC_SIZE_LIMIT_PROPERTY = "warc_size_limit" ; private static final Long DEFAULT_WARC_SIZE_LIMIT = 1000000000L ; private final long warcSizeLimit ; private static final String UPLOAD_WAIT_LIMIT_PROPERTY = "upload_wait_limit" ; private static final Long DEFAULT_UPLOAD_WAIT_LIMIT = 600000L ; private final long uploadWaitLimit ; private static final String CHECK_WARC_CONDITION_INTERVAL_PROPERTY = "check_conditions" ; private static final Long DEFAULT_CHECK_WARC_CONDITION_INTERVAL = 60000L ; private final Long checkWarcConditionInterval ; public Config ( File yggrasilConfigFile ) throws YggdrasilException { } private String extractConfigStringValue ( Map < String , Object > configs , String property , String defaultValue ) throws YggdrasilException { } private Long extractConfigLongValue ( Map < String , Object > configs , String property , Object defaultValue ) throws YggdrasilException { Object res = extractConfigValue ( configs , property , defaultValue ) ; if ( ( res . getClass ( ) ) == ( Integer . class ) ) { int i = ( ( Integer ) ( res ) ) ; <START_BUG> return new Long ( i ) ; <END_BUG> } return ( ( Long ) ( res ) ) ; } private Object extractConfigValue ( Map < String , Object > configs , String property , Object defaultValue ) throws YggdrasilException { } private File extractConfigValueAsDirectory ( Map < String , Object > configs , String property , String defaultValue ) throws YggdrasilException { } public File getDatabaseDir ( ) { } public File getTemporaryDir ( ) { } public File getConfigDir ( ) { } public int getMonitorPort ( ) { } public long getWarcSizeLimit ( ) { } public long getUploadWaitLimit ( ) { } public long getCheckWarcConditionInterval ( ) { } }

Fix:
return Long . valueOf ( i ) ;
Buggy code:
public class Jasper41Mangler implements JspMangler { public String mapJspToJavaName ( File jspFile ) { String jspUri = jspFile . getAbsolutePath ( ) ; int start = ( jspUri . lastIndexOf ( File . separatorChar ) ) + 1 ; int end = jspUri . length ( ) ; StringBuffer modifiedClassName ; modifiedClassName = new StringBuffer ( ( ( jspUri . length ( ) ) - start ) ) ; if ( ( ! ( Character . isJavaIdentifierStart ( jspUri . charAt ( start ) ) ) ) || ( ( jspUri . charAt ( start ) ) == '_' ) ) { modifiedClassName . append ( '_' ) ; } for ( int i = start ; i < end ; i ++ ) { char ch = jspUri . charAt ( i ) ; if ( Character . isJavaIdentifierPart ( ch ) ) { modifiedClassName . append ( ch ) ; } else if ( ch == '.' ) { modifiedClassName . append ( '_' ) ; } else { modifiedClassName . append ( Jasper41Mangler . mangleChar ( ch ) ) ; } } <START_BUG> return ( modifiedClassName . toString ( ) ) + ".java" ; <END_BUG> } private static final String mangleChar ( char ch ) { } public String mapPath ( String path ) { } }

Fix:
return modifiedClassName . toString ( ) ;
Buggy code:
public class AklToussaintHeuristicTest extends ConvexHullGenerator2DAbstractTest { @ Override protected ConvexHullGenerator2D createConvexHullGenerator ( boolean includeCollinearPoints ) { <START_BUG> return new GrahamScan ( includeCollinearPoints ) ; <END_BUG> } @ Override protected Collection < Vector2D > reducePoints ( Collection < Vector2D > points ) { } }

Fix:
return new MonotoneChain ( includeCollinearPoints ) ;
Buggy code:
public class DeploymentUndeployHandler implements ModelUpdateOperationHandler , DescriptionProvider , RuntimeOperationHandler { public static final String OPERATION_NAME = "undeploy" ; static final ModelNode getOperation ( ModelNode address ) { } public static final DeploymentUndeployHandler INSTANCE = new DeploymentUndeployHandler ( ) ; private DeploymentUndeployHandler ( ) { } @ Override public ModelNode getModelDescription ( Locale locale ) { } @ Override public Cancellable execute ( NewOperationContext context , ModelNode operation , ResultHandler resultHandler ) { } private void undeploy ( ModelNode model , NewOperationContext context , ResultHandler resultHandler , ModelNode compensatingOp ) { if ( context instanceof NewRuntimeOperationContext ) { NewRuntimeOperationContext updateContext = ( ( NewRuntimeOperationContext ) ( context ) ) ; String deploymentUnitName = model . require ( NAME ) . asString ( ) ; <START_BUG> final ServiceName deploymentUnitServiceName = JBOSS_DEPLOYMENT . append ( deploymentUnitName ) ; <END_BUG> final ServiceRegistry serviceRegistry = updateContext . getServiceRegistry ( ) ; final ServiceController < ? > controller = serviceRegistry . getService ( deploymentUnitServiceName ) ; controller . setMode ( NEVER ) ; resultHandler . handleResultComplete ( compensatingOp ) ; } else { resultHandler . handleResultComplete ( compensatingOp ) ; } } }

Fix:
final ServiceName deploymentUnitServiceName = Services . deploymentUnitName ( deploymentUnitName ) ;
Buggy code:
@ RunWith ( SpringJUnit4ClassRunner . class ) @ Transactional @ TransactionConfiguration ( defaultRollback = true ) @ ContextConfiguration ( { "classpath:test-spring-context.xml" } ) public class LanguageMapperTest { @ Test public void testGetLanguageUsingIdExists ( ) { } @ Test public void testGetLanguageUsingIdNotExists ( ) { } @ Test public void testGetLanguageUsingSlugExists ( ) { <START_BUG> Language language = languageMapper . getLanguageUsingSlug ( "text//x-c" ) ; <END_BUG> Assert . assertNotNull ( language ) ; String languageName = language . getLanguageName ( ) ; Assert . assertEquals ( "C" , languageName ) ; } @ Test public void testGetLanguageUsingSlugNotExists ( ) { } @ Test public void testCreateLanguageNormal ( ) { } @ Test ( expected = DataIntegrityViolationException . class ) public void testCreateLanguageUsingTooLongSlug ( ) { } @ Test public void testUpdateLanguageNormal ( ) { } @ Test public void testUpdateLanguageNotExists ( ) { } @ Test public void testDeleteLanguageExists ( ) { } @ Test public void testDeleteLanguageNotExists ( ) { } @ Autowired private LanguageMapper languageMapper ; }

Fix:
Language language = languageMapper . getLanguageUsingSlug ( "text//x-csrc" ) ;
Buggy code:
public abstract class Resource implements IResourceListener { private IResourceStream resourceStream ; protected Resource ( ) { } public final void onResourceRequested ( ) { } protected abstract IResourceStream getResourceStream ( ) { } protected void invalidate ( ) { } private void init ( ) { } private final void respond ( final Response response ) { try { final OutputStream out = response . getOutputStream ( ) ; try { <START_BUG> Streams . writeStream ( resourceStream . getInputStream ( ) , out ) ; <END_BUG> } finally { resourceStream . close ( ) ; out . flush ( ) ; } } catch ( Exception e ) { throw new WicketRuntimeException ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>render<seq2seq4repair_space>resource<seq2seq4repair_space>stream<seq2seq4repair_space>" + ( resourceStream ) ) , e ) ; } } }

Fix:
Streams . copy ( resourceStream . getInputStream ( ) , out ) ;
Buggy code:
public class ChunkGenerationThread implements Runnable { private World world = null ; private int worldSizeInBlocks = 0 ; private int worldSizeInChunks = 0 ; private int BorderSizeInChunks = 20 ; private Point spawnChunk = null ; private Point maxVars = null ; private Point minVars = null ; private Point lastRenderedChunk = null ; private int TaskID = - 1 ; private long status = 0L ; private long maxChunks ; private List < Chunk > bufferChunks = new LinkedList < Chunk > ( ) ; public ChunkGenerationThread ( int worldSize , String worldName ) { } public void setTaskID ( int ID ) { } public int getTaskID ( ) { } public long getStatsAsInt ( ) { } public String getStatus ( ) { } private void loadConfig ( ) { } public void saveConfig ( ) { } private void resetRenderPosition ( ) { File file = new File ( "plugins//GreenMile//worlds//" , ( ( world . getName ( ) ) + ".yml" ) ) ; if ( ! ( file . exists ( ) ) ) return ; try { YamlConfiguration config = new YamlConfiguration ( ) ; config . load ( file ) ; config . set ( "lastRenderedChunk.X" , null ) ; config . set ( "lastRenderedChunk.Y" , null ) ; <START_BUG> config . set ( "status" , null ) ; <END_BUG> config . save ( file ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } @ Override public void run ( ) { } public boolean renderChunk ( ) { } private void unloadChunks ( ) { } }

Fix:
config . set ( "status" , 0 ) ;
Buggy code:
public class Untar extends Expand { private Untar . UntarCompressionMethod compression = new Untar . UntarCompressionMethod ( ) ; public void setCompression ( Untar . UntarCompressionMethod method ) { } protected void expandFile ( FileUtils fileUtils , File srcF , File dir ) { TarInputStream tis = null ; try { log ( ( ( ( "Expanding:<seq2seq4repair_space>" + srcF ) + "<seq2seq4repair_space>into<seq2seq4repair_space>" ) + dir ) , MSG_INFO ) ; tis = new TarInputStream ( compression . decompress ( srcF , new BufferedInputStream ( new FileInputStream ( srcF ) ) ) ) ; TarEntry te = null ; while ( ( te = tis . getNextEntry ( ) ) != null ) { extractFile ( fileUtils , srcF , dir , tis , te . getName ( ) , te . getModTime ( ) , te . isDirectory ( ) ) ; } log ( "expand<seq2seq4repair_space>complete" , MSG_VERBOSE ) ; } catch ( IOException ioe ) { <START_BUG> throw new BuildException ( ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>expanding<seq2seq4repair_space>" + ( srcF . getPath ( ) ) ) , ioe , location ) ; <END_BUG> } finally { if ( tis != null ) { try { tis . close ( ) ; } catch ( IOException e ) { } } } } public static final class UntarCompressionMethod extends EnumeratedAttribute { private static final String NONE = "none" ; private static final String GZIP = "gzip" ; private static final String BZIP2 = "bzip2" ; public UntarCompressionMethod ( ) { } public String [ ] getValues ( ) { } private InputStream decompress ( final File file , final InputStream istream ) throws IOException , BuildException { } } }

Fix:
throw new BuildException ( ( "Error<seq2seq4repair_space>while<seq2seq4repair_space>expanding<seq2seq4repair_space>" + ( srcF . getPath ( ) ) ) , ioe , getLocation ( ) ) ;
Buggy code:
public class HierarchyScope extends AbstractSearchScope { public IType focusType ; private String focusPath ; private ITypeHierarchy hierarchy ; private IType [ ] types ; private HashSet resourcePaths ; private IPath [ ] enclosingProjectsAndJars ; protected IResource [ ] elements ; protected int elementCount ; public boolean needsRefresh ; public void add ( IResource element ) { } public HierarchyScope ( IType type ) throws JavaModelException { } private void buildResourceVector ( ) throws JavaModelException { } private IPath [ ] computeProjectsAndJars ( IType type ) throws JavaModelException { HashSet set = new HashSet ( ) ; IPackageFragmentRoot root = ( ( IPackageFragmentRoot ) ( type . getPackageFragment ( ) . getParent ( ) ) ) ; if ( root . isArchive ( ) ) { set . add ( root . getPath ( ) ) ; IPath rootPath = root . getPath ( ) ; IJavaModel model = JavaModelManager . getJavaModelManager ( ) . getJavaModel ( ) ; IJavaProject [ ] projects = model . getJavaProjects ( ) ; HashSet visited = new HashSet ( ) ; for ( int i = 0 ; i < ( projects . length ) ; i ++ ) { IJavaProject project = projects [ i ] ; IClasspathEntry [ ] classpath = project . getResolvedClasspath ( true ) ; for ( int j = 0 ; j < ( classpath . length ) ; j ++ ) { if ( rootPath . equals ( classpath [ j ] . getPath ( ) ) ) { <START_BUG> IPackageFragmentRoot [ ] roots = project . getPackageFragmentRoots ( ) ; <END_BUG> set . add ( project . getPath ( ) ) ; for ( int k = 0 ; k < ( roots . length ) ; k ++ ) { IPackageFragmentRoot pkgFragmentRoot = roots [ k ] ; if ( ( pkgFragmentRoot . getKind ( ) ) == ( IPackageFragmentRoot . K_BINARY ) ) { set . add ( pkgFragmentRoot . getPath ( ) ) ; } } this . computeDependents ( project , set , visited ) ; break ; } } } } else { IJavaProject project = ( ( IJavaProject ) ( root . getParent ( ) ) ) ; IPackageFragmentRoot [ ] roots = project . getAllPackageFragmentRoots ( ) ; for ( int i = 0 ; i < ( roots . length ) ; i ++ ) { IPackageFragmentRoot pkgFragmentRoot = roots [ i ] ; if ( ( pkgFragmentRoot . getKind ( ) ) == ( IPackageFragmentRoot . K_BINARY ) ) { set . add ( pkgFragmentRoot . getPath ( ) ) ; } else { set . add ( pkgFragmentRoot . getParent ( ) . getPath ( ) ) ; } } this . computeDependents ( project , set , new HashSet ( ) ) ; } IPath [ ] result = new IPath [ set . size ( ) ] ; set . toArray ( result ) ; return result ; } private void computeDependents ( IJavaProject project , HashSet set , HashSet visited ) { } public boolean encloses ( String resourcePath ) { } public boolean encloses ( IJavaElement element ) { } public IPath [ ] enclosingProjectsAndJars ( ) { } protected void initialize ( ) throws JavaModelException { } public void processDelta ( IJavaElementDelta delta ) { } protected void refresh ( ) throws JavaModelException { } public String toString ( ) { } }

Fix:
IPackageFragmentRoot [ ] roots = project . getAllPackageFragmentRoots ( ) ;
Buggy code:
public class StockQuote { private static final String serviceUrl = "http:////www.webservicex.net//stockquote.asmx" ; private String symbol ; public StockQuote ( ) { } public StockQuote ( String symbol ) { } public String getSymbol ( ) { } public void setSymbol ( String symbol ) { } public String getQuote ( ) { } private String getSOAPQuote ( String symbol ) { } private void writeRequest ( String message , HttpURLConnection httpConn ) throws IOException { OutputStream out = httpConn . getOutputStream ( ) ; <START_BUG> out . write ( message . toString ( ) . getBytes ( ) ) ; <END_BUG> out . close ( ) ; } private HttpURLConnection setUpHttpConnection ( URL url , int length ) throws IOException , ProtocolException { } private String readResult ( HttpURLConnection connection ) throws IOException { } private String createMessage ( String symbol ) { } }

Fix:
out . write ( message . getBytes ( ) ) ;
Buggy code:
public class ConcurrentUpdateSolrServer extends SolrServer { private static final long serialVersionUID = 1L ; static final Logger log = LoggerFactory . getLogger ( ConcurrentUpdateSolrServer . class ) ; private HttpSolrServer server ; final BlockingQueue < UpdateRequest > queue ; final ExecutorService scheduler ; final Queue < ConcurrentUpdateSolrServer . Runner > runners ; volatile CountDownLatch lock = null ; final int threadCount ; boolean shutdownExecutor = false ; int pollQueueTime = 250 ; private final boolean streamDeletes ; public ConcurrentUpdateSolrServer ( String solrServerUrl , int queueSize , int threadCount ) { } public ConcurrentUpdateSolrServer ( String solrServerUrl , HttpClient client , int queueSize , int threadCount ) { } public ConcurrentUpdateSolrServer ( String solrServerUrl , HttpClient client , int queueSize , int threadCount , ExecutorService es ) { } public ConcurrentUpdateSolrServer ( String solrServerUrl , HttpClient client , int queueSize , int threadCount , ExecutorService es , boolean streamDeletes ) { } public Set < String > getQueryParams ( ) { } public void setQueryParams ( Set < String > queryParams ) { } class Runner implements Runnable { final Lock runnerLock = new ReentrantLock ( ) ; @ Override public void run ( ) { } } @ Override public NamedList < Object > request ( final SolrRequest request ) throws IOException , SolrServerException { } public synchronized void blockUntilFinished ( ) { lock = new CountDownLatch ( 1 ) ; try { for ( ; ; ) { ConcurrentUpdateSolrServer . Runner runner ; synchronized ( runners ) { runner = runners . peek ( ) ; } <START_BUG> if ( runner == null ) <END_BUG> break ; runner . runnerLock . lock ( ) ; runner . runnerLock . unlock ( ) ; } } finally { lock . countDown ( ) ; lock = null ; } } public void handleError ( Throwable ex ) { } @ Override public void shutdown ( ) { } public void setConnectionTimeout ( int timeout ) { } public void setSoTimeout ( int timeout ) { } public void shutdownNow ( ) { } public void setParser ( ResponseParser responseParser ) { } public void setPollQueueTime ( int pollQueueTime ) { } public void setRequestWriter ( RequestWriter requestWriter ) { } }

Fix:
if ( ( runner == null ) || ( scheduler . isTerminated ( ) ) )
Buggy code:
public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest < ContextedRuntimeException > { @ Override protected void setUp ( ) throws Exception { } public void testContextedException ( ) { } public void testContextedExceptionString ( ) { } public void testContextedExceptionThrowable ( ) { } public void testContextedExceptionStringThrowable ( ) { } public void testContextedExceptionStringThrowableContext ( ) { } public void testNullExceptionPassing ( ) { <START_BUG> exceptionContext = new ContextedRuntimeException ( TEST_MESSAGE_2 , new Exception ( TEST_MESSAGE ) , null ) . addContextValue ( "test1" , null ) . addContextValue ( "test2" , "some<seq2seq4repair_space>value" ) . addContextValue ( "test<seq2seq4repair_space>Date" , new Date ( ) ) . addContextValue ( "test<seq2seq4repair_space>Nbr" , new Integer ( 5 ) ) . addContextValue ( "test<seq2seq4repair_space>Poorly<seq2seq4repair_space>written<seq2seq4repair_space>obj" , new ObjectWithFaultyToString ( ) ) ; <END_BUG> String message = exceptionContext . getMessage ( ) ; assertTrue ( ( message != null ) ) ; } public void testRawMessage ( ) { } }

Fix:
exceptionContext = new ContextedRuntimeException ( TEST_MESSAGE_2 , new Exception ( TEST_MESSAGE ) , null ) . addContextValue ( "test1" , null ) . addContextValue ( "test2" , "some<seq2seq4repair_space>value" ) . addContextValue ( "test<seq2seq4repair_space>Date" , new Date ( ) ) . addContextValue ( "test<seq2seq4repair_space>Nbr" , Integer . valueOf ( 5 ) ) . addContextValue ( "test<seq2seq4repair_space>Poorly<seq2seq4repair_space>written<seq2seq4repair_space>obj" , new ObjectWithFaultyToString ( ) ) ;
Buggy code:
public class PromptNewUserState implements State { private final StateValues stateValues ; private ConsoleWrapper theConsole ; public PromptNewUserState ( ConsoleWrapper theConsole , final StateValues stateValues ) { } @ Override public State execute ( ) { State continuingState = new ValidateUserState ( theConsole , stateValues ) ; if ( ( stateValues . isSilentOrNonInteractive ( ) ) == false ) { stateValues . setPassword ( null ) ; String existingUsername = stateValues . getUserName ( ) ; String usernamePrompt = ( existingUsername == null ) ? ROOT_LOGGER . usernamePrompt ( ) : ROOT_LOGGER . usernamePrompt ( existingUsername ) ; theConsole . printf ( usernamePrompt ) ; String temp = theConsole . readLine ( "<seq2seq4repair_space>:<seq2seq4repair_space>" ) ; if ( ( temp != null ) && ( ( temp . length ( ) ) > 0 ) ) { existingUsername = temp ; } if ( ( ( temp == null ) || ( existingUsername == null ) ) || ( ( existingUsername . length ( ) ) == 0 ) ) { <START_BUG> return new ErrorState ( theConsole , ROOT_LOGGER . noUsernameExiting ( ) ) ; <END_BUG> } stateValues . setUserName ( existingUsername ) ; } return continuingState ; } }

Fix:
return new ErrorState ( theConsole , ROOT_LOGGER . noUsernameExiting ( ) , stateValues ) ;
Buggy code:
public class PaperStack { private static final Logger LOG = Logger . getLogger ( PaperStack . class . getName ( ) ) ; static final Charset ENCODING = StandardCharsets . UTF_8 ; private static PaperStack INSTANCE ; private final Map < String , NoteContent > notes = new HashMap < > ( ) ; private PaperStack ( ) { } public static PaperStack getInstance ( ) { } public void addNote ( NoteContent note ) throws IOException { } public void removeNote ( String noteId ) throws IOException { } public NoteContent getNote ( String Id ) { } public List < NoteContent > getAllNotes ( ) { } public void saveStackToFile ( ) throws IOException { } public static void loadStackFromFile ( ) throws IOException { try { String pathString = Preferences . getInstance ( ) . getSavePath ( ) ; Path path = Paths . get ( pathString ) ; StringBuilder sb = new StringBuilder ( ) ; try ( Scanner scanner = new Scanner ( path , PaperStack . ENCODING . name ( ) ) ) { while ( scanner . hasNextLine ( ) ) { sb . append ( scanner . nextLine ( ) ) ; } scanner . close ( ) ; } PaperStack . fromXml ( sb . toString ( ) ) ; <START_BUG> } catch ( IOException ex ) { <END_BUG> PaperStack . LOG . log ( Level . SEVERE , null , ex ) ; PaperStack . fromXml ( null ) ; throw ex ; } } public String toXml ( ) { } public static void fromXml ( String xmlString ) { } }

Fix:
} catch ( Exception ex ) {