nus-yam/ex-repair huggingface dataset:
Buggy code:
public class Rfc822MessageViewer extends JPanel implements Scrollable , ICustomViewer { protected AttachmentsViewer attachmentsViewer ; private InlineAttachmentsViewer inlineAttachmentsViewer ; private EncryptionStatusViewer securityInformationController ; private TextViewer bodytextViewer ; private SpamStatusViewer spamStatusController ; private HeaderViewer headerController ; private PGPMessageFilter pgpFilter ; private MessageController mediator ; public Rfc822MessageViewer ( MessageController mediator ) { } private boolean showAttachmentsInlineEnabled ( ) { XmlElement gui = MailConfig . getInstance ( ) . get ( "options" ) . getElement ( "//options//gui" ) ; XmlElement messageviewer = gui . getElement ( "messageviewer" ) ; if ( messageviewer == null ) { messageviewer = gui . addSubElement ( "messageviewer" ) ; } DefaultItem item = new DefaultItem ( messageviewer ) ; <START_BUG> return item . getBoolean ( "inline_attachments" , false ) ; <END_BUG> } public void view ( IMailbox folder , Object uid , MailFrameMediator mediator ) throws Exception { } public void updateGUI ( ) throws Exception { } public JComponent getView ( ) { } public boolean isVisible ( ) { } public AttachmentsViewer getAttachmentsViewer ( ) { } public TextViewer getBodytextViewer ( ) { } public HeaderViewer getHeaderController ( ) { } public InlineAttachmentsViewer getInlineAttachmentsViewer ( ) { } public PGPMessageFilter getPgpFilter ( ) { } public EncryptionStatusViewer getSecurityInformationViewer ( ) { } public SpamStatusViewer getSpamStatusViewer ( ) { } public void setAttachmentSelectionReference ( MailFolderCommandReference ref ) { } public MailFolderCommandReference getAttachmentSelectionReference ( ) { } private void initComponents ( ) { } private void layoutComponents ( ) { } public void clear ( ) { } public IMailFolderCommandReference filterMessage ( IMailbox folder , Object uid ) throws Exception { } public String getSelectedText ( ) { } public Dimension getPreferredScrollableViewportSize ( ) { } public int getScrollableUnitIncrement ( Rectangle arg0 , int arg1 , int arg2 ) { } public int getScrollableBlockIncrement ( Rectangle arg0 , int arg1 , int arg2 ) { } public boolean getScrollableTracksViewportWidth ( ) { } public boolean getScrollableTracksViewportHeight ( ) { } private MimePart chooseBodyPart ( MimeTree mimePartTree ) { } private boolean hasHtmlPart ( MimePart mimeTypes ) { } private Integer [ ] getBodyPartAddress ( MimeTree mimePartTree ) { } }

Fix:
return item . getBooleanWithDefault ( "inline_attachments" , false ) ;
Buggy code:
public class AccountHelper { public static void userProfile ( HttpServletRequest request , HttpServletResponse response ) { UserProfileBean bean = null ; String user = null ; Session session = null ; Subject subject = null ; AccountFacade facade = null ; Account profile = null ; bean = new UserProfileBean ( ) ; facade = new AccountFacade ( ) ; subject = SecurityUtils . getSubject ( ) ; user = request . getParameter ( "account" ) ; if ( ( ! ( FormValidator . validateParameter ( user ) ) ) || ( ( facade . getProfile ( user ) ) == null ) ) { ErrorHelper . error404 ( request , response ) ; } else { profile = facade . getProfile ( user ) ; if ( subject . isAuthenticated ( ) ) { session = SessionManager . getSession ( subject ) ; bean . setUserData ( ( ( Account ) ( session . getAttribute ( "user_data" ) ) ) ) ; bean . setProfile ( profile ) ; bean . setLayout ( "system.user_profile_auth" ) ; } else { bean . setProfile ( profile ) ; bean . setLayout ( "system.user_profile" ) ; } <START_BUG> bean . setBlogEntries ( facade . getBlogEntries ( bean . getProfile ( ) . getId ( ) ) ) ; <END_BUG> request . setAttribute ( "Bean" , bean ) ; } } }

Fix:
bean . setBlogEntries ( facade . getBlogEntries ( bean . getProfile ( ) ) ) ;
Buggy code:
public class Issue extends BaseIssue implements Persistent { public String getUniqueId ( ) { } public String getFederatedId ( ) { } public void setFederatedId ( String id ) { } public static class FederatedId { String domainId ; String prefix ; int count ; public FederatedId ( String id ) { } public void setUniqueId ( String id ) { } public String getPrefix ( ) { } public int getCount ( ) { } public String getDomain ( ) { } } public void setModuleCast ( ModuleEntity me ) throws Exception { } public static Issue getIssueById ( String id ) { } public static Issue getIssueById ( Issue . FederatedId fid ) { } public SequencedHashtable getModuleAttributeValuesMap ( ) throws Exception { } public AttributeValue getAttributeValue ( Attribute attribute ) throws Exception { } public AttributeValue [ ] getOrderedAttributeValues ( ) throws Exception { } private AttributeValue [ ] orderAttributeValues ( Map values , Attribute [ ] attributes ) throws Exception { } public HashMap getAttributeValuesMap ( ) throws Exception { } public HashMap getAllAttributeValuesMap ( ) throws Exception { } public boolean containsMinimumAttributeValues ( ) throws Exception { } public List getEligibleAssignees ( ) throws Exception { ScarabSecurity security = SecurityFactory . getInstance ( ) ; <START_BUG> ScarabUser [ ] users = security . getUsers ( EDIT_ISSUE , getScarabModule ( ) ) ; <END_BUG> List assigneeAVs = getAssigneeAttributeValues ( ) ; if ( ( users != null ) && ( assigneeAVs != null ) ) { for ( int i = ( users . length ) - 1 ; i >= 0 ; i -- ) { for ( int j = ( assigneeAVs . size ( ) ) - 1 ; j >= 0 ; j -- ) { if ( ( ( AttributeValue ) ( assigneeAVs . get ( j ) ) ) . getUserId ( ) . equals ( users [ i ] . getUserId ( ) ) ) { users [ i ] = null ; break ; } } } } List eligibleUsers = new ArrayList ( users . length ) ; for ( int i = 0 ; i < ( users . length ) ; i ++ ) { if ( ( users [ i ] ) != null ) { eligibleUsers . add ( users [ i ] ) ; } } return eligibleUsers ; } public List getAssigneeAttributeValues ( ) throws Exception { } public Vector getComments ( ) throws Exception { } public Vector getUrls ( ) throws Exception { } public Vector getActivity ( ) throws Exception { } public List getChildren ( ) throws Exception { } public List getParents ( ) throws Exception { } public Vector getAllDependencyTypes ( ) throws Exception { } public Depend getDependency ( Issue childIssue ) throws Exception { } public void save ( DBConnection dbCon ) throws Exception { } public static List searchKeywords ( String [ ] keywords , boolean useAnd ) throws Exception { } public Date getClosedDate ( ) throws Exception { } public void addVote ( ScarabUser user ) throws Exception , ScarabException { } }

Fix:
ScarabUser [ ] users = security . getUsers ( ISSUE__EDIT , getScarabModule ( ) ) ;
Buggy code:
@ SuppressWarnings ( "serial" ) public class Game extends JPanel implements Runnable { private int mGameWidth ; private int mGameHeight ; private Image mGameImage ; private Thread mGameThread ; private volatile boolean mRunning ; private volatile State mCurrentState ; private InputHandler mInputHandler ; public Game ( int gameWidth , int gameHeight ) { } public void setCurrentState ( State newState ) { } @ Override public void addNotify ( ) { } private void initGame ( ) { } @ Override public void run ( ) { long updateDurationMillis = 0 ; long sleepDurationMillis = 0 ; while ( mRunning ) { long beforeUpdateRender = System . nanoTime ( ) ; long deltaMillis = updateDurationMillis + sleepDurationMillis ; updateAndRender ( deltaMillis ) ; <START_BUG> updateDurationMillis = ( ( System . nanoTime ( ) ) - beforeUpdateRender ) // 100000L ; <END_BUG> sleepDurationMillis = Math . max ( 2 , ( 17 - updateDurationMillis ) ) ; try { Thread . sleep ( sleepDurationMillis ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } System . exit ( 0 ) ; } private void updateAndRender ( long delta ) { } private void prepareGameImage ( ) { } public void exit ( ) { } private void renderGameImage ( Graphics g ) { } private void initInput ( ) { } }

Fix:
updateDurationMillis = ( ( System . nanoTime ( ) ) - beforeUpdateRender ) // 1000000L ;
Buggy code:
@ RunWith ( Arquillian . class ) public class CallbackBeansTestCase { @ Deployment ( name = "callback-beans" ) public static JavaArchive getCallbackBeansJar ( ) { JavaArchive archive = ShrinkWrap . create ( JavaArchive . class , "callback-beans.jar" ) ; archive . addPackage ( TOwner . class . getPackage ( ) ) ; <START_BUG> archive . addAsManifestResource ( "pojo//callback-jboss-beans.xml" , "callback-jboss-beans.xml" ) ; <END_BUG> return archive ; } @ Test @ OperateOnDeployment ( "callback-beans" ) public void testCallbackBeans ( ) throws Exception { } }

Fix:
archive . addAsManifestResource ( CallbackBeansTestCase . class . getPackage ( ) , "callback-jboss-beans.xml" , "callback-jboss-beans.xml" ) ;
Buggy code:
public class PopupMenuGenerator extends AbstractMenuGenerator { public PopupMenuGenerator ( FrameController frameController , String path ) { } public void createPopupMenu ( JPopupMenu menu ) { } public XmlElement getMenuRoot ( ) { } public String getRootElementName ( ) { } protected JPopupMenu createPopupMenu ( XmlElement menuElement , JPopupMenu menu ) { List childs = menuElement . getElements ( ) ; ListIterator it = childs . listIterator ( ) ; while ( it . hasNext ( ) ) { XmlElement next = ( ( XmlElement ) ( it . next ( ) ) ) ; String name = next . getName ( ) ; if ( name . equals ( "menuitem" ) ) { if ( ( next . getAttribute ( "action" ) ) != null ) { try { BasicAction action = ( ( ActionPluginHandler ) ( pluginManager . getHandler ( "org.columba.core.action" ) ) ) . getAction ( next . getAttribute ( "action" ) , frameController ) ; menu . add ( action ) ; } catch ( Exception e ) { log . error ( ( ( e + ":<seq2seq4repair_space>" ) + ( next . getAttribute ( "action" ) ) ) ) ; } } else if ( ( next . getAttribute ( "checkboxaction" ) ) != null ) { try { CheckBoxAction action = ( ( CheckBoxAction ) ( ( ( ActionPluginHandler ) ( pluginManager . getHandler ( "org.columba.core.action" ) ) ) . getAction ( next . getAttribute ( "checkboxaction" ) , frameController ) ) ) ; JCheckBoxMenuItem menuitem = new JCheckBoxMenuItem ( action ) ; menu . add ( menuitem ) ; action . setCheckBoxMenuItem ( menuitem ) ; } catch ( Exception e ) { log . error ( e ) ; } } else if ( ( next . getAttribute ( "imenu" ) ) != null ) { try { menu . add ( ( ( ActionPluginHandler ) ( pluginManager . getHandler ( "org.columba.core.action" ) ) ) . getIMenu ( next . getAttribute ( "imenu" ) , frameController ) ) ; } catch ( Exception e ) { log . error ( e ) ; } } } else if ( name . equals ( "separator" ) ) { menu . addSeparator ( ) ; } else if ( name . equals ( "menu" ) ) { <START_BUG> menu . add ( createMenu ( next ) ) ; <END_BUG> } } return menu ; } }

Fix:
menu . add ( createSubMenu ( next ) ) ;
Buggy code:
public class HighamHall54StepInterpolatorTest { @ Test public void derivativesConsistency ( ) { } @ Test public void serialization ( ) throws IOException , ClassNotFoundException { } @ Test public void checkClone ( ) { TestProblem3 pb = new TestProblem3 ( 0.9 ) ; double minStep = 0 ; double maxStep = ( pb . getFinalTime ( ) ) - ( pb . getInitialTime ( ) ) ; double scalAbsoluteTolerance = 1.0E-8 ; double scalRelativeTolerance = scalAbsoluteTolerance ; HighamHall54Integrator integ = new HighamHall54Integrator ( minStep , maxStep , scalAbsoluteTolerance , scalRelativeTolerance ) ; integ . addStepHandler ( new StepHandler ( ) { public void handleStep ( StepInterpolator interpolator , boolean isLast ) { StepInterpolator cloned = interpolator . copy ( ) ; double tA = cloned . getPreviousTime ( ) ; double tB = cloned . getCurrentTime ( ) ; double halfStep = ( FastMath . abs ( ( tB - tA ) ) ) // 2 ; Assert . assertEquals ( interpolator . getPreviousTime ( ) , tA , 1.0E-12 ) ; Assert . assertEquals ( interpolator . getCurrentTime ( ) , tB , 1.0E-12 ) ; for ( int i = 0 ; i < 10 ; ++ i ) { double t = ( ( i * tB ) + ( ( 9 - i ) * tA ) ) // 9 ; interpolator . setInterpolatedTime ( t ) ; Assert . assertTrue ( ( ( FastMath . abs ( ( ( cloned . getInterpolatedTime ( ) ) - t ) ) ) > ( halfStep // 10 ) ) ) ; cloned . setInterpolatedTime ( t ) ; Assert . assertEquals ( t , cloned . getInterpolatedTime ( ) , 1.0E-12 ) ; double [ ] referenceState = interpolator . getInterpolatedState ( ) ; double [ ] cloneState = cloned . getInterpolatedState ( ) ; for ( int j = 0 ; j < ( referenceState . length ) ; ++ j ) { Assert . assertEquals ( referenceState [ j ] , cloneState [ j ] , 1.0E-12 ) ; } } } <START_BUG> public void reset ( ) { <END_BUG> } } ) ; integ . integrate ( pb , pb . getInitialTime ( ) , pb . getInitialState ( ) , pb . getFinalTime ( ) , new double [ pb . getDimension ( ) ] ) ; } }

Fix:
public void init ( double t0 , double [ ] y0 , double t ) {
Buggy code:
public abstract class Form extends WebMarkupContainer implements IFormSubmitListener { private static Log log = LogFactory . getLog ( Form . class ) ; private final IFeedback feedback ; private static final class DefaultFormValidationStrategy implements IFormValidationStrategy { private static final Form . DefaultFormValidationStrategy instance = new Form . DefaultFormValidationStrategy ( ) ; private static final Log log = LogFactory . getLog ( Form . DefaultFormValidationStrategy . class ) ; private static Form . DefaultFormValidationStrategy getInstance ( ) { } public void validate ( final Form form ) { } } public Form ( final String id ) { } public Form ( final String id , final IFeedback feedback ) { } public Form ( final String id , IModel model , final IFeedback feedback ) { } public IFormValidationStrategy getValidationStrategy ( ) { } public final void loadPersistentFormComponentValues ( ) { } public void onFormSubmitted ( ) { } public void removePersistentFormComponentValues ( final boolean disablePersistence ) { } public void setVersioned ( final boolean isVersioned ) { } protected IValuePersister getValuePersister ( ) { } protected void onComponentTag ( final ComponentTag tag ) { checkComponentTag ( tag , "form" ) ; super . onComponentTag ( tag ) ; tag . put ( "method" , "POST" ) ; <START_BUG> tag . put ( "action" , urlFor ( IFormSubmitListener . class ) . replaceAll ( "&" , "&amp;" ) ) ; <END_BUG> } protected void onError ( ) { } protected void internalOnModelChanged ( ) { } protected abstract void onSubmit ( ) { } protected void onValidate ( ) { } protected final void validate ( ) { } protected void visitFormComponents ( final FormComponent . IVisitor visitor ) { } private void addFeedback ( ) { } private int countButtons ( ) { } private Button findSubmittingButton ( ) { } private boolean hasError ( ) { } private void invalid ( ) { } private void persistFormComponentData ( ) { } private void updateFormComponentModels ( ) { } }

Fix:
tag . put ( "action" , Strings . replaceAll ( urlFor ( IFormSubmitListener . class ) , "&" , "&amp;" ) ) ;
Buggy code:
public class TestJapaneseIterationMarkCharFilter extends BaseTokenStreamTestCase { private Analyzer keywordAnalyzer = new Analyzer ( ) { @ Override protected TokenStreamComponents createComponents ( String fieldName , Reader reader ) { } @ Override protected Reader initReader ( String fieldName , Reader reader ) { } } ; private Analyzer japaneseAnalyzer = new Analyzer ( ) { @ Override protected TokenStreamComponents createComponents ( String fieldName , Reader reader ) { } @ Override protected Reader initReader ( String fieldName , Reader reader ) { } } ; public void testKanji ( ) throws IOException { } public void testKatakana ( ) throws IOException { } public void testHiragana ( ) throws IOException { } public void testMalformed ( ) throws IOException { } public void testEmpty ( ) throws IOException { } public void testFullStop ( ) throws IOException { } public void testKanjiOnly ( ) throws IOException { } public void testKanaOnly ( ) throws IOException { } public void testNone ( ) throws IOException { } public void testCombinations ( ) throws IOException { } public void testHiraganaCoverage ( ) throws IOException { } public void testKatakanaCoverage ( ) throws IOException { } public void testRandomStrings ( ) throws Exception { } public void testRandomHugeStrings ( ) throws Exception { } private void assertCharFilterEquals ( CharFilter filter , String expected ) throws IOException { } private String readFully ( Reader stream ) throws IOException { <START_BUG> StringBuffer buffer = new StringBuffer ( ) ; <END_BUG> int ch ; while ( ( ch = stream . read ( ) ) != ( - 1 ) ) { buffer . append ( ( ( char ) ( ch ) ) ) ; } return buffer . toString ( ) ; } }

Fix:
StringBuilder buffer = new StringBuilder ( ) ;
Buggy code:
public class Javah extends Task { private static final String FAIL_MSG = "Compile<seq2seq4repair_space>failed,<seq2seq4repair_space>messages<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>provided." ; private static String lSep = System . getProperty ( "line.separator" ) ; private Vector classes = new Vector ( 2 ) ; private Path classpath = null ; private File outputFile = null ; private boolean verbose = false ; private boolean force = false ; private boolean old = false ; private boolean stubs = false ; private Path bootclasspath ; private String cls ; private File destDir ; public void setBootClasspathRef ( Reference r ) { } public void setBootclasspath ( Path src ) { } public void setClass ( String cls ) { } public void setClasspath ( Path src ) { } public void setClasspathRef ( Reference r ) { } public void setDestdir ( File destDir ) { } public void setForce ( boolean force ) { } public void setOld ( boolean old ) { } public void setOutputFile ( File outputFile ) { } public void setStubs ( boolean stubs ) { } public void setVerbose ( boolean verbose ) { } public Path createBootclasspath ( ) { } public Javah . ClassArgument createClass ( ) { } public Path createClasspath ( ) { } public void execute ( ) throws TaskException { } protected void logAndAddFilesToCompile ( Commandline cmd ) { } private Commandline setupJavahCommand ( ) { } private void doClassicCompile ( ) throws TaskException { } public class ClassArgument { private String name ; public ClassArgument ( ) { } public void setName ( String name ) { this . name = name ; <START_BUG> log ( ( "ClassArgument.name=" + name ) ) ; <END_BUG> } public String getName ( ) { } } }

Fix:
getLogger ( ) . info ( ( "ClassArgument.name=" + name ) ) ;
Buggy code:
public class EclipseAdditionalTest extends AbstractJPAItest { @ Test public void testContextCreationWithStartingBundle ( ) throws Exception { } @ Test public void testEntityManagerFactoryBuilderWithIncompletePersistenceUnit ( ) throws Exception { } @ Test ( expected = IllegalStateException . class ) public void testEntityManagerFactoryWithIncompletePersistenceUnit ( ) throws Exception { } @ Configuration public Option [ ] configuration ( ) { <START_BUG> InputStream testBundle = TinyBundles . bundle ( ) . set ( Constants . BUNDLE_SYMBOLICNAME , "incompleteTestUnit" ) . set ( "Meta-Persistence" , "<seq2seq4repair_space>" ) . add ( "META-INF//persistence.xml" , this . getClass ( ) . getResourceAsStream ( "persistence.xml" ) ) . build ( TinyBundles . withBnd ( ) ) ; <END_BUG> return new Option [ ] { baseOptions ( ) , ariesJpa21 ( ) , eclipseLink ( ) , derbyDSF ( ) , testBundleEclipseLink ( ) . noStart ( ) , streamBundle ( testBundle ) } ; } }

Fix:
InputStream testBundle = TinyBundles . bundle ( ) . set ( Constants . BUNDLE_SYMBOLICNAME , "incompleteTestUnit" ) . set ( "Meta-Persistence" , "<seq2seq4repair_space>" ) . add ( "META-INF//persistence.xml" , this . getClass ( ) . getResourceAsStream ( "//persistence.xml" ) ) . build ( TinyBundles . withBnd ( ) ) ;
Buggy code:
public class PubSubView extends ViewPart { protected TableViewer viewer ; protected MenuManager menuManager ; protected ISharedObjectContainer container ; private BaseSelectionListenerAction subscribeAction ; protected TableViewer sharedListViewer ; protected MenuManager sharedListMenuManager ; private BaseSelectionListenerAction appendAction ; protected final Vector sharedLists = new Vector ( ) ; public void init ( IViewSite site ) throws PartInitException { } public void createPartControl ( Composite parent ) { } public void setFocus ( ) { } public void dispose ( ) { } protected class ContentProvider implements IPublishedServiceDirectoryListener , IStructuredContentProvider { private Viewer viewer ; public Object [ ] getElements ( Object inputElement ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } public void dispose ( ) { } public void publishedServiceDirectoryChanged ( final PublishedServiceDirectoryChangeEvent event ) { } } protected class SubscriptionViewOpener implements ISubscriptionCallback { public void subscribed ( final ISubscription subscription ) { Display . getDefault ( ) . asyncExec ( new Runnable ( ) { public void run ( ) { SubscriptionView view ; try { view = ( ( SubscriptionView ) ( PlatformUI . getWorkbench ( ) . getActiveWorkbenchWindow ( ) . getActivePage ( ) . showView ( VIEW_ID , subscription . getID ( ) . getName ( ) , VIEW_ACTIVATE ) ) ) ; } catch ( PartInitException e ) { ErrorDialog . openError ( getSite ( ) . getShell ( ) , "Subscription<seq2seq4repair_space>Error" , "Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>subscription<seq2seq4repair_space>view." , e . getStatus ( ) ) ; return ; } <START_BUG> view . setSubscription ( container , subscription ) ; <END_BUG> } } ) ; } public void requestFailed ( final Throwable t ) { } } }

Fix:
view . setSubscription ( subscription ) ;
Buggy code:
abstract class AttachStrategy extends TransferFieldManager { private static final Localizer _loc = Localizer . forPackage ( AttachStrategy . class ) ; public abstract Object attach ( AttachManager manager , Object toAttach , ClassMetaData meta , PersistenceCapable into , OpenJPAStateManager owner , ValueMetaData ownerMeta , boolean explicit ) { } protected abstract Object getDetachedObjectId ( AttachManager manager , Object toAttach ) { } protected abstract void provideField ( Object toAttach , StateManagerImpl sm , int field ) { } protected StateManagerImpl persist ( AttachManager manager , PersistenceCapable pc , ClassMetaData meta , Object appId , boolean explicit ) { PersistenceCapable newInstance ; if ( ! ( manager . getCopyNew ( ) ) ) newInstance = pc ; else if ( appId == null ) newInstance = pc . pcNewInstance ( null , false ) ; else newInstance = pc . pcNewInstance ( null , appId , false ) ; <START_BUG> return ( ( StateManagerImpl ) ( manager . getBroker ( ) . persist ( newInstance , appId , explicit , manager . getBehavior ( ) ) ) ) ; <END_BUG> } protected boolean attachField ( AttachManager manager , Object toAttach , StateManagerImpl sm , FieldMetaData fmd , boolean nullLoaded ) { } protected Object getReference ( AttachManager manager , Object toAttach , OpenJPAStateManager sm , ValueMetaData vmd ) { } private void replaceCollection ( AttachManager manager , Collection frmc , Collection toc , OpenJPAStateManager sm , FieldMetaData fmd ) { } protected Collection attachCollection ( AttachManager manager , Collection orig , OpenJPAStateManager sm , FieldMetaData fmd ) { } private Collection copyCollection ( AttachManager manager , Collection orig , FieldMetaData fmd ) { } private Collection copyCollection ( AttachManager manager , Collection orig , FieldMetaData fmd , OpenJPAStateManager sm ) { } private Map copyMap ( AttachManager manager , Map orig , FieldMetaData fmd , OpenJPAStateManager sm ) { } private Collection replaceList ( AttachManager manager , Collection frml , Collection tol , OpenJPAStateManager sm , FieldMetaData fmd ) { } private void replaceMap ( AttachManager manager , Map frmm , Map tom , OpenJPAStateManager sm , FieldMetaData fmd ) { } protected Map attachMap ( AttachManager manager , Map orig , OpenJPAStateManager sm , FieldMetaData fmd ) { } private Object replaceArray ( AttachManager manager , Object frma , Object toa , OpenJPAStateManager sm , FieldMetaData fmd ) { } private static boolean equals ( Object a , Object b , boolean pc ) { } }

Fix:
return ( ( StateManagerImpl ) ( manager . getBroker ( ) . persist ( newInstance , appId , explicit , manager . getBehavior ( ) , ( ! ( manager . getCopyNew ( ) ) ) ) ) ) ;
Buggy code:
@ RunWith ( SpringJUnit4ClassRunner . class ) @ Transactional @ TransactionConfiguration ( defaultRollback = true ) @ ContextConfiguration ( { "classpath:test-spring-context.xml" } ) public class ProductDaoTest { @ Test public void testGetTotalProductsUsingNoneFilters ( ) { } @ Test public void testGetTotalProductsUsingWebFilters ( ) { } @ Test public void testGetProductsUsingNoneCategory ( ) { } @ Test public void testGetProductsUsingWebCategory ( ) { } @ Test public void testGetProductsUsingDeveloper ( ) { } @ Test public void testGetProductsUsingKeyword ( ) { } @ Test public void testGetProductsUsingProductIdExists ( ) { } @ Test public void testGetProductsUsingProductIdNotExists ( ) { } @ Test public void testCreateProductNormal ( ) { } @ Test ( expected = DataException . class ) public void testCreateProductUsingIllegalProductName ( ) { } @ Test ( expected = ConstraintViolationException . class ) public void testCreateProductUsingNotExistingCategory ( ) { } @ Test public void testAddProductTesterNormal ( ) { <START_BUG> Product product = productDao . getProductsUsingProductId ( 1000 ) ; <END_BUG> Assert . assertNotNull ( product ) ; User user = userDao . getUserUsingUid ( 1000 ) ; Assert . assertNotNull ( user ) ; Assert . assertTrue ( productDao . addProductTester ( product , user ) ) ; } @ Test public void testAddProductTesterUsingNotExistingProduct ( ) { } @ Test public void testAddProductTesterUsingNotExistingUser ( ) { } @ Test ( expected = ConstraintViolationException . class ) public void testAddProductTesterAlreadyAttended ( ) { } @ Test public void testUpdateProductNormal ( ) { } @ Test public void testUpdateProductNotExists ( ) { } @ Test ( expected = DataException . class ) public void testUpdateProductUsingIllegalProductName ( ) { } @ Test public void testDeleteProductExists ( ) { } @ Test public void testDeleteProductNotExists ( ) { } @ Autowired private ProductDao productDao ; @ Autowired private UserDao userDao ; }

Fix:
Product product = productDao . getProductsUsingProductId ( 1001 ) ;
Buggy code:
public class DeployUnDeployInvalidBPMNPackageTestCase extends BPSMasterTest { private static final Log log = LogFactory . getLog ( DeployUnDeployInvalidBPMNPackageTestCase . class ) ; @ Test ( groups = { "wso2.bps.test.deploy.invalidPackage" } , description = "Deploy//UnDeploy<seq2seq4repair_space>Invalid<seq2seq4repair_space>Package<seq2seq4repair_space>Test" , priority = 1 , singleThreaded = true ) public void deployUnDeployInvalidBPMNPackage ( ) throws Exception { init ( ) ; ActivitiRestClient tester = new ActivitiRestClient ( bpsServer . getInstance ( ) . getPorts ( ) . get ( "http" ) , bpsServer . getInstance ( ) . getHosts ( ) . get ( "default" ) ) ; String filePath = ( ( ( ( ( ( FrameworkPathUtil . getSystemResourceLocation ( ) ) + ( File . separator ) ) + ( BPMNTestConstants . DIR_ARTIFACTS ) ) + ( File . separator ) ) + ( BPMNTestConstants . DIR_BPMN ) ) + ( File . separator ) ) + "InvalidHelloApprove.bar" ; String fileName = "InvalidHelloApprove.bar" ; try { String [ ] deploymentResponse ; deploymentResponse = tester . deployBPMNPackage ( filePath , fileName ) ; <START_BUG> Assert . fail ( "Invalid<seq2seq4repair_space>package<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>deployed." ) ; <END_BUG> } catch ( Exception exception ) { Assert . assertTrue ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>upload<seq2seq4repair_space>the<seq2seq4repair_space>invalid<seq2seq4repair_space>BPMN<seq2seq4repair_space>Package" , "Error<seq2seq4repair_space>parsing<seq2seq4repair_space>XML" . equals ( exception . getMessage ( ) ) ) ; DeployUnDeployInvalidBPMNPackageTestCase . log . error ( ( "Unhandled<seq2seq4repair_space>Error,<seq2seq4repair_space>Uploading<seq2seq4repair_space>Invalid<seq2seq4repair_space>BPMN<seq2seq4repair_space>Package<seq2seq4repair_space>" + fileName ) , exception ) ; } } }

Fix:
Assert . fail ( "Invalid<seq2seq4repair_space>package<seq2seq4repair_space>was<seq2seq4repair_space>deployed." ) ;
Buggy code:
@ RunWith ( Arquillian . class ) public class FeedbackTest extends TestUtilityClass { @ FindBy ( className = "modal-content" ) private Feedback feedback ; @ FindBy ( id = "feedback-btn" ) private WebElement feedbackButton ; @ Before public void openPage ( ) { } @ Test public void testSendFeedback ( ) { Graphene . waitModel ( ) . until ( ) . element ( feedbackButton ) . is ( ) . visible ( ) ; feedbackButton . click ( ) ; <START_BUG> guardAjax ( feedback ) . sendFeedback ( "graphene-test" , EMAIL ) ; <END_BUG> assertTrue ( feedback . getAlertMsg ( ) . isSuccessAlert ( ) ) ; } @ Test public void testCloseFeedback ( ) { } @ Test public void testErrorDisplay ( ) { } No newline ; at end ; of file ; }

Fix:
feedback . sendFeedback ( "graphene-test" , EMAIL ) ;
Buggy code:
public class RemoteSearchEngine implements SearchEngineInterface { protected Folder folder ; protected IMAPRootFolder rootFolder ; public RemoteSearchEngine ( Folder folder ) { } protected String createSubjectString ( FilterCriteria criteria ) { } protected String createToString ( FilterCriteria criteria ) { } protected String createCcString ( FilterCriteria criteria ) { } protected String createBccString ( FilterCriteria criteria ) { } protected String createFromString ( FilterCriteria criteria ) { } protected String createToCCString ( FilterCriteria criteria ) { } protected String createBodyString ( FilterCriteria criteria ) { } protected String createSizeString ( FilterCriteria criteria ) { } protected String createDateString ( FilterCriteria criteria ) { } protected String createFlagsString ( FilterCriteria criteria ) { } protected String createPriorityString ( FilterCriteria criteria ) { } protected String generateSearchString ( FilterRule rule , Vector ruleStringList ) { } protected String generateSearchString ( Filter filter ) { FilterRule rule = filter . getFilterRule ( ) ; Vector ruleStringList = new Vector ( ) ; for ( int i = 0 ; i < ( rule . count ( ) ) ; i ++ ) { <START_BUG> FilterCriteria criteria = rule . getCriteria ( i ) ; <END_BUG> String headerItem ; String searchString = null ; switch ( criteria . getHeaderItem ( ) ) { case FilterCriteria . SUBJECT : { searchString = createSubjectString ( criteria ) ; break ; } case FilterCriteria . TO : { searchString = createToString ( criteria ) ; break ; } case FilterCriteria . FROM : { searchString = createFromString ( criteria ) ; break ; } case FilterCriteria . CC : { searchString = createCcString ( criteria ) ; break ; } case FilterCriteria . BCC : { searchString = createBccString ( criteria ) ; break ; } case FilterCriteria . TO_CC : { searchString = createToString ( criteria ) ; break ; } case FilterCriteria . BODY : { searchString = createBodyString ( criteria ) ; break ; } case FilterCriteria . SIZE : { searchString = createSizeString ( criteria ) ; break ; } case FilterCriteria . DATE : { searchString = createDateString ( criteria ) ; break ; } case FilterCriteria . FLAGS : { searchString = createFlagsString ( criteria ) ; break ; } case FilterCriteria . PRIORITY : { searchString = createPriorityString ( criteria ) ; break ; } } ruleStringList . add ( searchString . toString ( ) ) ; } String searchString = generateSearchString ( rule , ruleStringList ) ; log . info ( ( "searchString=" + ( searchString . toString ( ) ) ) ) ; return searchString ; } public Object [ ] searchMessages ( Filter filter , WorkerStatusController worker ) throws Exception { } public Object [ ] searchMessages ( Filter filter , Object [ ] uids , WorkerStatusController worker ) throws Exception { } }

Fix:
FilterCriteria criteria = rule . get ( i ) ;
Buggy code:
@ SuppressWarnings ( "serial" ) public class Benny extends HttpServlet { private static final Logger LOG = Logger . getLogger ( Authenticator . class ) ; private static final String PROPS_RESOURCE = "//benny.properties" ; private static final Pattern BASIC_AUTH_PATTERN = Pattern . compile ( "Basic\\s+([a-z0-9+//=]+)\\s*" , Pattern . CASE_INSENSITIVE ) ; private static final Charset UTF_8 = Charset . forName ( "UTF-8" ) ; private Authenticator authenticator ; private String realm ; @ Override public void init ( ServletConfig config ) throws ServletException { } @ Override protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , ServletException { String user = req . getParameter ( "user" ) ; String password = req . getParameter ( "password" ) ; if ( ( user == null ) && ( password == null ) ) { String [ ] credentials = getBasicAuthCredentials ( req ) ; if ( credentials == null ) { <START_BUG> resp . setHeader ( "WWW-Authenticate" , ( "Basic<seq2seq4repair_space>realm=" + ( realm ) ) ) ; <END_BUG> respond ( resp , SC_UNAUTHORIZED , "No<seq2seq4repair_space>credentials<seq2seq4repair_space>provided" ) ; return ; } user = credentials [ 0 ] ; password = credentials [ 1 ] ; } try { Benny . LOG . debug ( ( ( ( ( "checking<seq2seq4repair_space>user='" + user ) + "',<seq2seq4repair_space>password='" ) + password ) + "'" ) ) ; boolean ok = authenticator . authenticate ( user , password ) ; if ( ok ) { respond ( resp , SC_OK , "Credentials<seq2seq4repair_space>accepted" ) ; } else { respond ( resp , SC_FORBIDDEN , "Credentials<seq2seq4repair_space>rejected" ) ; } } catch ( IOException ex ) { throw ex ; } catch ( Exception ex ) { Benny . LOG . error ( "Unexpected<seq2seq4repair_space>exception" , ex ) ; respond ( resp , SC_INTERNAL_SERVER_ERROR , "Service<seq2seq4repair_space>error" ) ; } } private String [ ] getBasicAuthCredentials ( HttpServletRequest req ) { } private void respond ( HttpServletResponse resp , int status , String msg ) throws IOException { } }

Fix:
resp . setHeader ( "WWW-Authenticate" , ( ( "Basic<seq2seq4repair_space>realm=\"" + ( realm ) ) + "\"" ) ) ;
Buggy code:
public class DocBookOutlineProvider implements IOutlineProvider { public void init ( VexEditor editor ) { } public ITreeContentProvider getContentProvider ( ) { } public IBaseLabelProvider getLabelProvider ( ) { } public VEXElement getOutlineElement ( final VEXElement child ) { } private final ITreeContentProvider contentProvider = new ITreeContentProvider ( ) { public void dispose ( ) { } public void inputChanged ( final Viewer viewer , final Object oldInput , final Object newInput ) { } public Object [ ] getChildren ( final Object parentElement ) { } public Object getParent ( final Object element ) { } public boolean hasChildren ( final Object element ) { } public Object [ ] getElements ( final Object inputElement ) { } } ; private VEXElement [ ] getOutlineChildren ( final VEXElement element ) { <START_BUG> final List children = new ArrayList ( ) ; <END_BUG> final EList < VEXElement > childElements = element . getChildElements ( ) ; for ( int i = 0 ; i < ( childElements . size ( ) ) ; i ++ ) { if ( DocBookOutlineProvider . titledElements . contains ( childElements . get ( i ) . getName ( ) ) ) { children . add ( childElements . get ( i ) ) ; } } return ( ( VEXElement [ ] ) ( children . toArray ( new VEXElement [ children . size ( ) ] ) ) ) ; } private final ILabelProvider labelProvider = new LabelProvider ( ) { public String getText ( final Object o ) { } } ; private boolean isTitledElement ( final VEXElement e ) { } private VEXElement findChild ( VEXElement parent , String childName ) { } private static final int MAPSIZE = 101 ; private static final HashSet titledElements = new HashSet ( DocBookOutlineProvider . MAPSIZE ) ; }

Fix:
final List < VEXElement > children = new ArrayList < VEXElement > ( ) ;
Buggy code:
public class PropertyCollectionSerializer extends JsonSerializer < Object > { private SerializationConfig config ; private String wrapperFieldName ; private String getterName ; private Boolean hasLinks = false ; public PropertyCollectionSerializer ( SerializationConfig config , Class someClass , String getterName ) { } public PropertyCollectionSerializer ( SerializationConfig config , Class someClass , String getterName , Boolean links ) { } @ Override public void serialize ( Object value , JsonGenerator jgen , SerializerProvider sp ) throws IOException { } private void writeLinks ( Object value , JsonGenerator jgen , String valClassName ) throws IOException { } private void writeJsonArray ( JsonGenerator jgen , List propList , boolean writeWhenNullOrEmpty ) throws IOException { } private void writeJsonArrayWithFieldName ( JsonGenerator jgen , List propList , boolean writeWhenNullOrEmpty , String fieldName ) throws IOException { <START_BUG> if ( writeWhenNullOrEmpty ) <END_BUG> jgen . writeFieldName ( fieldName ) ; writeJsonArray ( jgen , propList , writeWhenNullOrEmpty ) ; } private void childSerialize ( Object obj , JsonGenerator jgen ) throws IOException , JsonProcessingException { } }

Fix:
if ( writeWhenNullOrEmpty || ( ! ( propList . isEmpty ( ) ) ) )
Buggy code:
public class ScoreboardTabList extends CustomTabListHandler implements PlayerTablistHandler { private static String getSlotID ( int n ) { String hex = Integer . toHexString ( ( n + 1 ) ) ; char [ ] alloc = new char [ ( hex . length ( ) ) * 2 ] ; for ( int i = 0 ; i < ( alloc . length ) ; i ++ ) { if ( ( i % 2 ) == 0 ) { alloc [ i ] = ChatColor . COLOR_CHAR ; } else { alloc [ i ] = hex . charAt ( ( i // 2 ) ) ; } } <START_BUG> return ( ( String . valueOf ( MAGIC ) ) + alloc ) + ( ChatColor . RESET ) ; <END_BUG> } private final int [ ] slots_ping = new int [ ConfigManager . getTabSize ( ) ] ; private int sendSlots = 0 ; private final String [ ] send = new String [ ConfigManager . getTabSize ( ) ] ; public ScoreboardTabList ( ProxiedPlayer player ) { } @ Override public void sendTablist ( ITabList tabList ) { } private void resize ( int size ) { } private void sendSlot ( int i ) { } private void removeSlot ( int i ) { } private void updateSlot ( int row , String text , int ping ) { } private void createSlot ( int row ) { } private String [ ] splitText ( String s ) { } @ Override public void unload ( ) { } }

Fix:
return ( ( String . valueOf ( MAGIC ) ) + ( String . valueOf ( alloc ) ) ) + ( ChatColor . RESET ) ;
Buggy code:
public class SourceMappings { private Set < TrendPathAndDBTableName > sourcesAndTableNames ; public SourceMappings ( ) { } public SourceMappings ( Set < TrendPathAndDBTableName > loadedPathsAndNames ) { } public Collection < TrendPathAndDBTableName > getSourcesAndTableNames ( ) { } public void addSourceAndName ( TrendPathAndDBTableName t ) { } public void removeSource ( String source ) { } public TrendPathAndDBTableName getTrendPathAndDBTableNameObject ( String source ) { } public Collection < String > getSources ( ) { } public Collection < String > getTableNames ( ) { } public Collection < String > getDisplayNames ( ) { } public boolean containsSource ( String source ) { } public String getNameFromSource ( String source ) { } public String getSourceFromTableName ( String tableName ) { } public short getTypeFromTableName ( String tableName ) { for ( TrendPathAndDBTableName t : sourcesAndTableNames ) { if ( t . getDbTableName ( ) . equals ( tableName ) ) return t . getTrendType ( ) ; } <START_BUG> return - 1 ; <END_BUG> } public String getDisplayNameFromTableName ( String tableName ) { } public void setIsEnabled ( String source , boolean isEnabled ) { } public boolean getIsEnabled ( String tableName ) { } public String getDisplayPathFromTableName ( String tableName ) { } }

Fix:
return - 2 ;
Buggy code:
public class JlinkTask extends MatchingTask { private File outfile = null ; private Path mergefiles = null ; private Path addfiles = null ; private boolean compress = false ; private String ps = System . getProperty ( "path.separator" ) ; public void setAddfiles ( Path addfiles ) { } public void setCompress ( boolean compress ) { } public void setMergefiles ( Path mergefiles ) { } public void setOutfile ( File outfile ) { } public Path createAddfiles ( ) { } public Path createMergefiles ( ) { } public void execute ( ) throws BuildException { if ( ( outfile ) == null ) { throw new BuildException ( "outfile<seq2seq4repair_space>attribute<seq2seq4repair_space>is<seq2seq4repair_space>required!<seq2seq4repair_space>Please<seq2seq4repair_space>set." ) ; } if ( ( ! ( haveAddFiles ( ) ) ) && ( ! ( haveMergeFiles ( ) ) ) ) { throw new BuildException ( "addfiles<seq2seq4repair_space>or<seq2seq4repair_space>mergefiles<seq2seq4repair_space>required!<seq2seq4repair_space>Please<seq2seq4repair_space>set." ) ; } log ( ( "linking:<seq2seq4repair_space>" + ( outfile . getPath ( ) ) ) ) ; log ( ( "compression:<seq2seq4repair_space>" + ( compress ) ) , MSG_VERBOSE ) ; jlink linker = new jlink ( ) ; linker . setOutfile ( outfile . getPath ( ) ) ; linker . setCompression ( compress ) ; if ( haveMergeFiles ( ) ) { log ( ( "merge<seq2seq4repair_space>files:<seq2seq4repair_space>" + ( mergefiles . toString ( ) ) ) , MSG_VERBOSE ) ; linker . addMergeFiles ( mergefiles . list ( ) ) ; } if ( haveAddFiles ( ) ) { log ( ( "add<seq2seq4repair_space>files:<seq2seq4repair_space>" + ( addfiles . toString ( ) ) ) , MSG_VERBOSE ) ; linker . addAddFiles ( addfiles . list ( ) ) ; } try { linker . link ( ) ; } catch ( Exception ex ) { <START_BUG> throw new BuildException ( ex ) ; <END_BUG> } } private boolean haveAddFiles ( ) { } private boolean haveEntries ( Path p ) { } private boolean haveMergeFiles ( ) { } }

Fix:
throw new BuildException ( "Error" , ex ) ;
Buggy code:
public class Group extends Composite { static final int CLIENT_INSET = 3 ; static final int GroupProc ; static final TCHAR GroupClass = new TCHAR ( 0 , ( OS . IsWinCE ? "BUTTON" : "SWT_GROUP" ) , true ) ; public Group ( Composite parent , int style ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } public Rectangle computeTrim ( int x , int y , int width , int height ) { } void createHandle ( ) { } public Rectangle getClientArea ( ) { } String getNameText ( ) { } public String getText ( ) { } boolean mnemonicHit ( char key ) { } boolean mnemonicMatch ( char key ) { } public void setFont ( Font font ) { checkWidget ( ) ; Rectangle oldRect = getClientArea ( ) ; super . setFont ( font ) ; Rectangle newRect = getClientArea ( ) ; if ( ! ( oldRect . equals ( newRect ) ) ) <START_BUG> resize ( ) ; <END_BUG> } public void setText ( String string ) { } int widgetStyle ( ) { } TCHAR windowClass ( ) { } int windowProc ( ) { } LRESULT WM_ERASEBKGND ( int wParam , int lParam ) { } LRESULT WM_NCHITTEST ( int wParam , int lParam ) { } LRESULT WM_MOUSEMOVE ( int wParam , int lParam ) { } LRESULT WM_PRINTCLIENT ( int wParam , int lParam ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT WM_UPDATEUISTATE ( int wParam , int lParam ) { } }

Fix:
sendResize ( ) ;
Buggy code:
public class PackageResource extends AbstractResource { private static final Logger log = LoggerFactory . getLogger ( PackageResource . class ) ; private static final long serialVersionUID = 1L ; public static final class PackageResourceBlockedException extends WicketRuntimeException { private static final long serialVersionUID = 1L ; public PackageResourceBlockedException ( String message ) { } } private final String absolutePath ; private final Locale locale ; private final String path ; private final String scopeName ; private final String style ; private final String variation ; protected PackageResource ( final Class < ? > scope , final String name , final Locale locale , final String style , final String variation ) { } public final Class < ? > getScope ( ) { } public final String getStyle ( ) { } @ Override protected ResourceResponse newResourceResponse ( Attributes attributes ) { final ResourceResponse resourceResponse = new ResourceResponse ( ) ; if ( resourceResponse . dataNeedsToBeWritten ( attributes ) ) { final IResourceStream resourceStream = getResourceStream ( ) ; if ( resourceStream == null ) return sendResourceError ( resourceResponse , 404 , "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>resource" ) ; resourceResponse . setContentType ( resourceStream . getContentType ( ) ) ; final Time lastModified = resourceStream . lastModifiedTime ( ) ; if ( lastModified != null ) resourceResponse . setLastModified ( lastModified . toDate ( ) ) ; try { final byte [ ] bytes ; try { bytes = IOUtils . toByteArray ( resourceStream . getInputStream ( ) ) ; } finally { resourceStream . close ( ) ; } resourceResponse . setContentLength ( bytes . length ) ; resourceResponse . setWriteCallback ( new WriteCallback ( ) { @ Override public void writeData ( Attributes attributes ) { attributes . getResponse ( ) . write ( bytes ) ; } } ) ; } catch ( IOException e ) { PackageResource . log . debug ( e . getMessage ( ) , e ) ; return sendResourceError ( resourceResponse , 500 , "Unable<seq2seq4repair_space>to<seq2seq4repair_space>read<seq2seq4repair_space>resource<seq2seq4repair_space>stream" ) ; } catch ( ResourceStreamNotFoundException e ) { PackageResource . log . debug ( e . getMessage ( ) , e ) ; return sendResourceError ( resourceResponse , 500 , "Unable<seq2seq4repair_space>to<seq2seq4repair_space>open<seq2seq4repair_space>resource<seq2seq4repair_space>stream" ) ; } } if ( Application . get ( ) . getResourceSettings ( ) . getUseTimestampOnResources ( ) ) { <START_BUG> resourceResponse . setCacheDuration ( Integer . MAX_VALUE ) ; <END_BUG> resourceResponse . setCachePublic ( true ) ; } return resourceResponse ; } private ResourceResponse sendResourceError ( ResourceResponse resourceResponse , int errorCode , String errorMessage ) { } private IResourceStream getResourceStream ( ) { } private boolean accept ( Class < ? > scope , String path ) { } public static boolean exists ( final Class < ? > scope , final String path , final Locale locale , final String style , final String variation ) { } }

Fix:
resourceResponse . setCacheDurationToMaximum ( ) ;
Buggy code:
public class FileParser { private static LinkedList < Node > nodes = new LinkedList < Node > ( ) ; private static String [ ] lines ; public static Graph [ ] parse ( String path ) { } private static String stringCleanup ( String line ) { String edit ; String [ ] split = line . split ( "[(]" ) ; edit = split [ 0 ] ; for ( int i = 1 ; i < ( split . length ) ; i ++ ) { edit += "<seq2seq4repair_space>(" + ( split [ i ] ) ; } while ( edit . contains ( "<seq2seq4repair_space>" ) ) { edit = edit . replace ( "<seq2seq4repair_space>" , "<seq2seq4repair_space>" ) ; } edit = edit . replace ( "(<seq2seq4repair_space>" , "(" ) ; edit = edit . replace ( "<seq2seq4repair_space>)" , ")" ) ; edit = edit . replace ( "<seq2seq4repair_space>=" , "=" ) ; edit = edit . replace ( "=<seq2seq4repair_space>" , "=" ) ; while ( edit . endsWith ( "<seq2seq4repair_space>" ) ) { <START_BUG> edit = edit . substring ( 0 , ( ( edit . length ( ) ) - 2 ) ) ; <END_BUG> } while ( edit . startsWith ( "<seq2seq4repair_space>" ) ) { edit = edit . substring ( 1 ) ; } return edit ; } private static Node [ ] makeNodes ( String [ ] line ) { } private static void parseLine ( String [ ] line ) { } private static LinkedList < Node > findHeads ( ) { } }

Fix:
edit = edit . substring ( 0 , ( ( edit . length ( ) ) - 1 ) ) ;
Buggy code:
public class FormInput extends WicketExamplePage { private static final List LOCALES = Arrays . asList ( new Locale [ ] { Locale . ENGLISH , new Locale ( "nl" ) , Locale . GERMAN , Locale . SIMPLIFIED_CHINESE } ) ; private static final List NUMBERS = Arrays . asList ( new String [ ] { "1" , "2" , "3" } ) ; private static final List SITES = Arrays . asList ( new String [ ] { "The<seq2seq4repair_space>Server<seq2seq4repair_space>Side" , "Java<seq2seq4repair_space>Lobby" , "Java.Net" } ) ; public FormInput ( ) { } public void setLocale ( Locale locale ) { } private class InputForm extends Form { public InputForm ( String name ) { } public void onSubmit ( ) { } } private final class LocaleDropDownChoice extends DropDownChoice { public LocaleDropDownChoice ( String id ) { } protected boolean wantOnSelectionChangedNotifications ( ) { } public void onSelectionChanged ( Object newSelection ) { } } private final class LocaleChoiceRenderer extends ChoiceRenderer { public LocaleChoiceRenderer ( ) { } <START_BUG> public String getDisplayValue ( Object object ) { <END_BUG> Locale locale = ( ( Locale ) ( object ) ) ; String display = locale . getDisplayName ( getLocale ( ) ) ; return display ; } } private static final class LinesListView extends ListView { public LinesListView ( String id ) { } protected void populateItem ( ListItem item ) { } } }

Fix:
public Object getDisplayValue ( Object object ) {