nus-yam/ex-repair huggingface dataset:
Buggy code:
public class FormTagTests extends AbstractHtmlElementTagTests { private static final String REQUEST_URI = "//my//form" ; private static final String QUERY_STRING = "foo=bar" ; private FormTag tag ; private MockHttpServletRequest request ; @ Override @ SuppressWarnings ( "serial" ) protected void onSetUp ( ) { } @ Override protected void extendRequest ( MockHttpServletRequest request ) { } public void testWriteForm ( ) throws Exception { } public void testWithActionFromRequest ( ) throws Exception { } public void testPrependServletPath ( ) throws Exception { } public void testWithNullResolvedCommand ( ) throws Exception { } public void testXSSScriptingExploitWhenActionIsResolvedFromQueryString ( ) throws Exception { } public void testGet ( ) throws Exception { } public void testPost ( ) throws Exception { } public void testPut ( ) throws Exception { } public void testDelete ( ) throws Exception { } public void testCustomMethodParameter ( ) throws Exception { } public void testClearAttributesOnFinally ( ) throws Exception { } public void testRequestDataValueProcessorHooks ( ) throws Exception { String action = "//my//form?foo=bar" ; RequestDataValueProcessor processor = getMockRequestDataValueProcessor ( ) ; given ( processor . processAction ( this . request , action , "post" ) ) . willReturn ( action ) ; given ( processor . getExtraHiddenFields ( this . request ) ) . willReturn ( Collections . singletonMap ( "key" , "value" ) ) ; this . tag . doStartTag ( ) ; this . tag . doEndTag ( ) ; this . tag . doFinally ( ) ; String output = getOutput ( ) ; <START_BUG> assertEquals ( "<input<seq2seq4repair_space>type=\"hidden\"<seq2seq4repair_space>name=\"key\"<seq2seq4repair_space>value=\"value\"<seq2seq4repair_space>//>" , getInputTag ( output ) ) ; <END_BUG> FormTagTests . assertFormTagOpened ( output ) ; FormTagTests . assertFormTagClosed ( output ) ; } private String getFormTag ( String output ) { } private String getInputTag ( String output ) { } private static void assertFormTagOpened ( String output ) { } private static void assertFormTagClosed ( String output ) { } }

Fix:
assertEquals ( "<div>\n<input<seq2seq4repair_space>type=\"hidden\"<seq2seq4repair_space>name=\"key\"<seq2seq4repair_space>value=\"value\"<seq2seq4repair_space>//>\n<//div>" , getInputTag ( output ) ) ;
Buggy code:
public class CopyPackageFragmentRootOperation extends JavaModelOperation { IPath destination ; int updateResourceFlags ; int updateModelFlags ; IClasspathEntry sibling ; public CopyPackageFragmentRootOperation ( IPackageFragmentRoot root , IPath destination , int updateResourceFlags , int updateModelFlags , IClasspathEntry sibling ) { } protected void executeOperation ( ) throws JavaModelException { } protected void copyResource ( IPackageFragmentRoot root , IClasspathEntry rootEntry , final IWorkspaceRoot workspaceRoot ) throws JavaModelException { } protected void addEntryToClasspath ( IClasspathEntry rootEntry , IWorkspaceRoot workspaceRoot ) throws JavaModelException { } protected IClasspathEntry copy ( IClasspathEntry entry ) throws JavaModelException { switch ( entry . getEntryKind ( ) ) { case IClasspathEntry . CPE_CONTAINER : return JavaCore . newContainerEntry ( entry . getPath ( ) , entry . isExported ( ) ) ; case IClasspathEntry . CPE_LIBRARY : return JavaCore . newLibraryEntry ( this . destination , entry . getSourceAttachmentPath ( ) , entry . getSourceAttachmentRootPath ( ) , entry . isExported ( ) ) ; case IClasspathEntry . CPE_PROJECT : return JavaCore . newProjectEntry ( entry . getPath ( ) , entry . isExported ( ) ) ; case IClasspathEntry . CPE_SOURCE : <START_BUG> return JavaCore . newSourceEntry ( this . destination , entry . getExclusionPatterns ( ) , entry . getOutputLocation ( ) ) ; <END_BUG> case IClasspathEntry . CPE_VARIABLE : return JavaCore . newVariableEntry ( entry . getPath ( ) , entry . getSourceAttachmentPath ( ) , entry . getSourceAttachmentRootPath ( ) , entry . isExported ( ) ) ; default : throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . ELEMENT_DOES_NOT_EXIST , this . getElementToProcess ( ) ) ) ; } } public IJavaModelStatus verify ( ) { } }

Fix:
return JavaCore . newSourceEntry ( this . destination , entry . getInclusionPatterns ( ) , entry . getExclusionPatterns ( ) , entry . getOutputLocation ( ) ) ;
Buggy code:
public interface VEXElement extends VEXNode { public void addChild ( VEXElement child ) { } public Object clone ( ) { } public String getAttribute ( String name ) { } public List < String > getAttributeNames ( ) { } public Iterator getChildIterator ( ) { } <START_BUG> public VEXElement [ ] getChildElements ( ) ; <END_BUG> public VEXNode [ ] getChildNodes ( ) { } public VEXDocument getDocument ( ) { } public String getName ( ) { } public boolean isEmpty ( ) { } public void removeAttribute ( String name ) throws DocumentValidationException { } public void setAttribute ( String name , String value ) throws DocumentValidationException { } public VEXElement getParent ( ) { } public void setParent ( VEXElement parent ) { } public String toString ( ) { } public void setContent ( Content content , int offset , int i ) { } public void insertChild ( int index , VEXElement child ) { } }

Fix:
public List < VEXElement > getChildElements ( ) ;
Buggy code:
public class BootStrapperTest { @ Test public void testGuessToken ( ) throws IOException { StorageService ss = StorageService . instance ( ) ; generateFakeEndpoints ( 3 ) ; InetAddress one = InetAddress . getByName ( "127.0.0.2" ) ; InetAddress two = InetAddress . getByName ( "127.0.0.3" ) ; InetAddress three = InetAddress . getByName ( "127.0.0.4" ) ; Map < InetAddress , Double > load = new HashMap < InetAddress , Double > ( ) ; load . put ( one , 1.0 ) ; load . put ( two , 2.0 ) ; load . put ( three , 3.0 ) ; TokenMetadata tmd = ss . getTokenMetadata ( ) ; InetAddress source = BootStrapper . getBootstrapSource ( tmd , load ) ; assert three . equals ( source ) ; InetAddress myEndpoint = InetAddress . getByName ( "127.0.0.1" ) ; Range range3 = ss . getPrimaryRangeForEndPoint ( three ) ; Token fakeToken = ( ( IPartitioner ) ( StorageService . getPartitioner ( ) ) ) . midpoint ( range3 . left ( ) , range3 . right ( ) ) ; assert range3 . contains ( fakeToken ) ; <START_BUG> ss . onChange ( myEndpoint , STATE_BOOTSTRAPPING , new org . apache . cassandra . gms . ApplicationState ( ss . getPartitioner ( ) . getTokenFactory ( ) . toString ( fakeToken ) ) ) ; <END_BUG> tmd = ss . getTokenMetadata ( ) ; InetAddress source2 = BootStrapper . getBootstrapSource ( tmd , load ) ; assert two . equals ( source2 ) : source2 ; } @ Test public void testSourceTargetComputation ( ) throws UnknownHostException { } private void testSourceTargetComputation ( int numOldNodes ) throws UnknownHostException { } private void generateFakeEndpoints ( int numOldNodes ) throws UnknownHostException { } }

Fix:
ss . onChange ( myEndpoint , MOVE_STATE , new org . apache . cassandra . gms . ApplicationState ( ( ( ( StorageService . STATE_BOOTSTRAPPING ) + ( StorageService . Delimiter ) ) + ( ss . getPartitioner ( ) . getTokenFactory ( ) . toString ( fakeToken ) ) ) ) ) ;
Buggy code:
public class WWinKeyBindingService { private long updateNumber = 0 ; private HashMap globalActionDefIdToAction = new HashMap ( ) ; private HashMap actionSetDefIdToAction = new HashMap ( ) ; private IPropertyChangeListener propertyListener ; private KeyBindingService activeService ; private WorkbenchWindow window ; private AcceleratorMenu accMenu ; private VerifyListener verifyListener = new VerifyListener ( ) { public void verifyText ( VerifyEvent event ) { } } ; private void setStatusLineMessage ( KeySequence keySequence ) { } public void clear ( ) { } public void pressed ( KeyStroke stroke ) { } public void invoke ( String action ) { } public WWinKeyBindingService ( final WorkbenchWindow window ) { } public void dispose ( ) { } public void registerGlobalAction ( IAction action ) { } public void registerActionSets ( IActionSet [ ] sets ) { } public long getUpdateNumber ( ) { } public HashMap getMapping ( ) { } public IWorkbenchWindow getWindow ( ) { } public void update ( IWorkbenchPart part , boolean force ) { if ( part == null ) return ; String [ ] oldScopeIds = new String [ 0 ] ; if ( ( activeService ) != null ) oldScopeIds = activeService . getScopeIds ( ) ; activeService = ( ( KeyBindingService ) ( part . getSite ( ) . getKeyBindingService ( ) ) ) ; clear ( ) ; String [ ] newScopeIds = new String [ 0 ] ; if ( ( activeService ) != null ) newScopeIds = activeService . getScopeIds ( ) ; <START_BUG> if ( force || ( ( Util . compare ( oldScopeIds , newScopeIds ) ) == 0 ) ) { <END_BUG> Scope [ ] scopes = new Scope [ newScopeIds . length ] ; for ( int i = 0 ; i < ( newScopeIds . length ) ; i ++ ) scopes [ i ] = KeyBindingManager . getInstance ( ) . getScopeForId ( newScopeIds [ i ] ) ; KeyBindingManager . getInstance ( ) . setScopes ( scopes ) ; WorkbenchWindow w = ( ( WorkbenchWindow ) ( getWindow ( ) ) ) ; MenuManager menuManager = w . getMenuManager ( ) ; menuManager . update ( TEXT ) ; } } public String getDefinitionId ( int [ ] accelerators ) { } public void updateAccelerators ( ) { } }

Fix:
if ( force || ( ( Util . compare ( oldScopeIds , newScopeIds ) ) != 0 ) ) {
Buggy code:
public class ViewFactory { static boolean DEBUG = false ; private WorkbenchPage page ; private IViewRegistry viewReg ; private ReferenceCounter counter ; private HashMap mementoTable = new HashMap ( ) ; public ViewFactory ( WorkbenchPage page , IViewRegistry reg ) { } public IViewReference createView ( final String id ) throws PartInitException { } public IStatus restoreView ( final IViewReference ref ) { } public IStatus saveState ( IMemento memento ) { } public IStatus restoreState ( IMemento memento ) { } private void destroyView ( IViewDescriptor desc , IViewPart view ) { } public IViewReference getView ( String id ) { } public IViewReference [ ] getViews ( ) { } public boolean hasView ( String id ) { } public void releaseView ( String id ) { } private class ViewReference extends WorkbenchPartReference implements IViewReference { private IViewPart part ; private String viewId ; public ViewReference ( String id ) { } public boolean isFastView ( ) { } public IViewPart getView ( boolean restore ) { } public void setPart ( IWorkbenchPart part ) { } public String getRegisteredName ( ) { } public IWorkbenchPart getPart ( boolean restore ) { if ( ( part ) != null ) return part ; if ( restore ) { <START_BUG> IStatus status = restoreView ( this ) ; <END_BUG> } return part ; } public String getTitle ( ) { } public Image getTitleImage ( ) { } public String getId ( ) { } public void setPane ( PartPane pane ) { } public PartPane getPane ( ) { } public String getTitleToolTip ( ) { } } }

Fix:
restoreView ( this ) ;
Buggy code:
public class PropertyTestHelper { protected static final String USER_NAME = "Aldo.Raine" ; protected static final String ROLES = "admin,<seq2seq4repair_space>jms" ; protected ConsoleMock consoleMock ; protected StateValues values ; @ Before public void setUp ( ) throws IOException { ArrayList < File > usersPropertyFileList = new ArrayList < File > ( ) ; ArrayList < File > rolesPropertyFileList = new ArrayList < File > ( ) ; File usersPropertyFile = File . createTempFile ( "UpdateUser" , null ) ; usersPropertyFile . deleteOnExit ( ) ; File rolesPropertyFile = File . createTempFile ( "UpdateRoles" , null ) ; rolesPropertyFile . deleteOnExit ( ) ; usersPropertyFileList . add ( usersPropertyFile ) ; rolesPropertyFileList . add ( rolesPropertyFile ) ; values = new StateValues ( ) ; values . setPropertiesFiles ( usersPropertyFileList ) ; values . setRoleFiles ( rolesPropertyFileList ) ; values . setUserName ( PropertyTestHelper . USER_NAME ) ; <START_BUG> values . setPassword ( "******" . toCharArray ( ) ) ; <END_BUG> values . setRealm ( "Management" ) ; consoleMock = new ConsoleMock ( ) ; } protected Properties loadProperties ( String filePath ) throws IOException , StartException { } protected void assertUserPropertyFile ( String userName ) throws IOException , StartException { } protected void assertRolePropertyFile ( String userName ) throws IOException , StartException { } }

Fix:
values . setPassword ( "1sT%l<[pzD" . toCharArray ( ) ) ;
Buggy code:
public class Box2DTest extends ApplicationAdapter { SpriteBatch batch ; Sprite [ ] sprites ; World world ; OrthographicCamera c ; Box2DDebugRenderer debugRenderer ; Body [ ] bodies ; final int WIDTH = 100 ; final int HEIGHT = 100 ; float mX ; float mY ; float ratio ; @ Override public void create ( ) { } @ Override public void render ( ) { if ( input . isTouched ( ) ) { float x = input . getX ( ) ; float y = input . getY ( ) ; Vector3 worldVector = c . unproject ( new Vector3 ( x , y , 0 ) ) ; <START_BUG> createExplosion ( worldVector . x , worldVector . y ) ; <END_BUG> } if ( input . isKeyPressed ( ESCAPE ) ) app . exit ( ) ; world . step ( ( 1 // 60.0F ) , 6 , 2 ) ; gl . glClearColor ( 0 , 0 , 0 , 1 ) ; gl . glClear ( GL_COLOR_BUFFER_BIT ) ; batch . begin ( ) ; for ( int i = 0 ; i < ( bodies . length ) ; i ++ ) { Vector2 pos = bodies [ i ] . getPosition ( ) ; sprites [ i ] . setPosition ( ( ( pos . x ) - ( ( sprites [ i ] . getWidth ( ) ) // 2 ) ) , ( ( pos . y ) - ( ( sprites [ i ] . getHeight ( ) ) // 2 ) ) ) ; sprites [ i ] . setRotation ( ( ( MathUtils . radiansToDegrees ) * ( bodies [ i ] . getAngle ( ) ) ) ) ; sprites [ i ] . draw ( batch ) ; } batch . end ( ) ; debugRenderer . render ( world , c . combined ) ; } private void createExplosion ( float x , float y , float maxForce ) { } No newline ; at end ; of file ; }

Fix:
createExplosion ( worldVector . x , worldVector . y , 2000 ) ;
Buggy code:
public class RadioChoice < T > extends AbstractSingleSelectChoice < T > implements IOnChangeListener { private static final long serialVersionUID = 1L ; private class SuffixChange extends Change { private static final long serialVersionUID = 1L ; final String prevSuffix ; SuffixChange ( String prevSuffix ) { } @ Override public void undo ( ) { } @ Override public String toString ( ) { } } private class PrefixChange extends Change { private static final long serialVersionUID = 1L ; private final String prevPrefix ; PrefixChange ( String prevSuffix ) { } @ Override public void undo ( ) { } @ Override public String toString ( ) { } } private String prefix = "" ; private String suffix = "<br<seq2seq4repair_space>//>\n" ; public RadioChoice ( final String id ) { } public RadioChoice ( final String id , final List < T > choices ) { } public RadioChoice ( final String id , final List < T > choices , final IChoiceRenderer < T > renderer ) { } public RadioChoice ( final String id , IModel < T > model , final List < T > choices ) { } public RadioChoice ( final String id , IModel < T > model , final List < T > choices , final IChoiceRenderer < T > renderer ) { } public RadioChoice ( String id , IModel < List < ? extends T > > choices ) { } public RadioChoice ( String id , IModel < T > model , IModel < List < ? extends T > > choices ) { } public RadioChoice ( String id , IModel < List < ? extends T > > choices , IChoiceRenderer < T > renderer ) { } public RadioChoice ( String id , IModel < T > model , IModel < List < ? extends T > > choices , IChoiceRenderer < T > renderer ) { } @ Override protected void onComponentTag ( ComponentTag tag ) { } public void onSelectionChanged ( ) { RadioChoice . convertInput ( ) ; RadioChoice . updateModel ( ) ; <START_BUG> onSelectionChanged ( RadioChoice . getModelObject ( ) ) ; <END_BUG> } protected void onSelectionChanged ( Object newSelection ) { } protected boolean wantOnSelectionChangedNotifications ( ) { } @ Override protected boolean getStatelessHint ( ) { } public String getPrefix ( ) { } public final RadioChoice < T > setPrefix ( String prefix ) { } public String getSuffix ( ) { } public final RadioChoice < T > setSuffix ( String suffix ) { } @ Override protected final void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } }

Fix:
onSelectionChanged ( RadioChoice . getDefaultModelObject ( ) ) ;
Buggy code:
public class InstructionElement extends CodeElement { private final String opcode ; private final ArgumentElement [ ] argumentElements ; public InstructionElement ( Location location , String opcode , ArgumentElement [ ] argumentElements ) { } public String getOpcode ( ) { } public ArgumentElement [ ] getArgumentElements ( ) { } @ Override public String toString ( ) { } public boolean equals ( Object o ) { if ( o == ( this ) ) { return true ; } if ( ! ( o instanceof InstructionElement ) ) { return false ; } InstructionElement inst = ( ( InstructionElement ) ( o ) ) ; <START_BUG> return new EqualsBuilder ( ) . appendSuper ( super . equals ( o ) ) . append ( inst . opcode , opcode ) . append ( inst . argumentElements , argumentElements ) . isEquals ( ) ; <END_BUG> } @ Override public int hashCode ( ) { } }

Fix:
return new EqualsBuilder ( ) . appendSuper ( super . equals ( o ) ) . append ( inst . opcode , opcode ) . isEquals ( ) ;
Buggy code:
public final class SmoothingBicubicSplineInterpolatorTest { @ Test public void testPreconditions ( ) throws MathException { double [ ] xval = new double [ ] { 3 , 4 , 5 , 6.5 } ; double [ ] yval = new double [ ] { - 4 , - 3 , - 1 , 2.5 } ; double [ ] [ ] zval = new double [ xval . length ] [ yval . length ] ; BivariateRealGridInterpolator interpolator = new SmoothingBicubicSplineInterpolator ( ) ; @ SuppressWarnings ( "unused" ) BivariateRealFunction p = interpolator . interpolate ( xval , yval , zval ) ; double [ ] wxval = new double [ ] { 3 , 2 , 5 , 6.5 } ; try { p = interpolator . interpolate ( wxval , yval , zval ) ; Assert . fail ( "an<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>thrown" ) ; } catch ( IllegalArgumentException e ) { } double [ ] wyval = new double [ ] { - 4 , - 3 , - 1 , - 1 } ; try { p = interpolator . interpolate ( xval , wyval , zval ) ; Assert . fail ( "an<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>thrown" ) ; } catch ( IllegalArgumentException e ) { } double [ ] [ ] wzval = new double [ xval . length ] [ ( yval . length ) + 1 ] ; try { <START_BUG> p = interpolator . interpolate ( xval , wyval , zval ) ; <END_BUG> Assert . fail ( "an<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>thrown" ) ; } catch ( IllegalArgumentException e ) { } wzval = new double [ ( xval . length ) - 1 ] [ yval . length ] ; try { p = interpolator . interpolate ( xval , yval , wzval ) ; Assert . fail ( "an<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>thrown" ) ; } catch ( DimensionMismatchException e ) { } wzval = new double [ xval . length ] [ ( yval . length ) - 1 ] ; try { p = interpolator . interpolate ( xval , yval , wzval ) ; Assert . fail ( "an<seq2seq4repair_space>exception<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>thrown" ) ; } catch ( DimensionMismatchException e ) { } } @ Test public void testPlane ( ) throws MathException { } @ Test public void testParaboloid ( ) throws MathException { } }

Fix:
p = interpolator . interpolate ( xval , wyval , wzval ) ;
Buggy code:
public class HighlightGlossaryTerms { private HighlightGlossaryTerms ( ) { } public static String searchReplace ( String publicationContent , String className , String axisId , boolean onlyFirst , String language ) { } private static String highlight ( String term , String publication , String definition , String className , boolean onlyFirst ) { String highlightedAnswer = publication ; term = StringEscapeUtils . escapeHtml ( term ) ; String regex = ( "((?i)\\b" + term ) + "\\b)(?=[^>]*<)" ; <START_BUG> String replacement = ( ( ( ( ( "<a<seq2seq4repair_space>href=\"#\"<seq2seq4repair_space>class=\"" + className ) + "\"<seq2seq4repair_space>title<seq2seq4repair_space>=\"" ) + definition ) + "\"><seq2seq4repair_space>" ) + term ) + "<seq2seq4repair_space><//a>" ; <END_BUG> if ( onlyFirst ) { highlightedAnswer = highlightedAnswer . replaceFirst ( regex , replacement ) ; } else { highlightedAnswer = highlightedAnswer . replaceAll ( regex , replacement ) ; } return highlightedAnswer ; } }

Fix:
String replacement = ( ( ( ( ( "<a<seq2seq4repair_space>href=\"#\"<seq2seq4repair_space>class=\"" + className ) + "\"<seq2seq4repair_space>title<seq2seq4repair_space>=\"" ) + ( definition . replaceAll ( "\"" , "&quot;" ) ) ) + "\"><seq2seq4repair_space>" ) + term ) + "<seq2seq4repair_space><//a>" ;
Buggy code:
class CTabFolderTab extends Tab { int lastSelectedTab = 0 ; CTabFolder tabFolder1 ; Group tabFolderGroup ; Group itemGroup ; Button topButton ; Button bottomButton ; Button flatButton ; Button closeButton ; static String [ ] CTabItems1 = new String [ ] { ControlExample . getResourceString ( "CTabItem1_0" ) , ControlExample . getResourceString ( "CTabItem1_1" ) , ControlExample . getResourceString ( "CTabItem1_2" ) } ; Button foregroundSelectionButton ; Button backgroundSelectionButton ; Button itemFontButton ; Image foregroundSelectionImage ; Image backgroundSelectionImage ; Color foregroundSelectionColor ; Color backgroundSelectionColor ; Font itemFont ; Button simpleTabButton ; Button singleTabButton ; Button imageButton ; Button showMinButton ; Button showMaxButton ; Button unselectedCloseButton ; Button unselectedImageButton ; CTabFolderTab ( ControlExample instance ) { } void createColorGroup ( ) { } void createOtherGroup ( ) { } void createExampleGroup ( ) { super . createExampleGroup ( ) ; tabFolderGroup = new Group ( exampleGroup , SWT . NONE ) ; tabFolderGroup . setLayout ( new GridLayout ( ) ) ; <START_BUG> tabFolderGroup . setLayoutData ( new GridData ( ( ( ( GridData . GRAB_HORIZONTAL ) | ( GridData . HORIZONTAL_ALIGN_FILL ) ) | ( GridData . VERTICAL_ALIGN_FILL ) ) ) ) ; <END_BUG> tabFolderGroup . setText ( "CTabFolder" ) ; } void createExampleWidgets ( ) { } void createStyleGroup ( ) { } String [ ] getCustomEventNames ( ) { } Item [ ] getExampleWidgetItems ( ) { } Control [ ] getExampleWidgets ( ) { } String getTabText ( ) { } void hookCustomListener ( final String eventName ) { } void resetColorsAndFonts ( ) { } void setExampleWidgetForeground ( ) { } void setExampleWidgetBackground ( ) { } void setExampleWidgetFont ( ) { } void setExampleWidgetState ( ) { } void setSimpleTabs ( ) { } void setSingleTabs ( ) { } void setImages ( ) { } void setMinimizeVisible ( ) { } void setMaximizeVisible ( ) { } void setUnselectedCloseVisible ( ) { } void setUnselectedImageVisible ( ) { } void setItemFont ( ) { } }

Fix:
tabFolderGroup . setLayoutData ( new GridData ( SWT . FILL , SWT . FILL , true , true ) ) ;
Buggy code:
public class PopupSettings implements Serializable { private static final long serialVersionUID = 1L ; public static final int LOCATION_BAR = 1 ; public static final int MENU_BAR = 2 ; public static final int RESIZABLE = 4 ; public static final int SCROLLBARS = 8 ; public static final int STATUS_BAR = 16 ; public static final int TOOL_BAR = 32 ; private int displayFlags ; private int height = - 1 ; private int left = - 1 ; private String target = "href" ; private int top = - 1 ; private int width = - 1 ; private String windowName = null ; private String pageMapName ; public PopupSettings ( PageMap pagemap ) { } public PopupSettings ( PageMap pagemap , final int displayFlags ) { } public String getPopupJavaScript ( ) { String windowTitle = windowName ; if ( windowTitle == null ) { windowTitle = "" ; } else { windowTitle = windowTitle . replace ( ':' , '_' ) ; } <START_BUG> StringBuffer script = new StringBuffer ( ( ( "if<seq2seq4repair_space>(!window.focus)<seq2seq4repair_space>return<seq2seq4repair_space>true;<seq2seq4repair_space>window.open(" + ( target ) ) + ",<seq2seq4repair_space>'" ) ) . append ( windowTitle ) . append ( "',<seq2seq4repair_space>'" ) ; <END_BUG> script . append ( "scrollbars=" ) . append ( flagToString ( PopupSettings . SCROLLBARS ) ) ; script . append ( ",<seq2seq4repair_space>location=" ) . append ( flagToString ( PopupSettings . LOCATION_BAR ) ) ; script . append ( ",<seq2seq4repair_space>menuBar=" ) . append ( flagToString ( PopupSettings . MENU_BAR ) ) ; script . append ( ",<seq2seq4repair_space>resizable=" ) . append ( flagToString ( PopupSettings . RESIZABLE ) ) ; script . append ( ",<seq2seq4repair_space>scrollbars=" ) . append ( flagToString ( PopupSettings . SCROLLBARS ) ) ; script . append ( ",<seq2seq4repair_space>status=" ) . append ( flagToString ( PopupSettings . STATUS_BAR ) ) ; script . append ( ",<seq2seq4repair_space>toolbar=" ) . append ( flagToString ( PopupSettings . TOOL_BAR ) ) ; if ( ( width ) != ( - 1 ) ) { script . append ( ",<seq2seq4repair_space>width=" ) . append ( width ) ; } if ( ( height ) != ( - 1 ) ) { script . append ( ",<seq2seq4repair_space>height=" ) . append ( height ) ; } if ( ( left ) != ( - 1 ) ) { script . append ( ",<seq2seq4repair_space>left=" ) . append ( left ) ; } if ( ( top ) != ( - 1 ) ) { script . append ( ",<seq2seq4repair_space>top=" ) . append ( top ) ; } script . append ( "');<seq2seq4repair_space>" ) . append ( "<seq2seq4repair_space>return<seq2seq4repair_space>false;" ) ; return script . toString ( ) ; } public PopupSettings setHeight ( int popupHeight ) { } public PopupSettings setLeft ( int popupPositionLeft ) { } public void setTarget ( String target ) { } public PopupSettings setTop ( int popupPositionTop ) { } public PopupSettings setWidth ( int popupWidth ) { } public PopupSettings setWindowName ( String popupWindowName ) { } private String flagToString ( final int flag ) { } public PageMap getPageMap ( ) { } }

Fix:
StringBuffer script = new StringBuffer ( ( ( "window.open(" + ( target ) ) + ",<seq2seq4repair_space>'" ) ) . append ( windowTitle ) . append ( "',<seq2seq4repair_space>'" ) ;
Buggy code:
public class LiferayDataSource implements DataSource { private static final Logger log = Logger . getLogger ( LiferayDataSource . class ) ; private static final long ROOT_CATEGORY_ID = 0 ; private static final int QUERY_ALL = QueryUtil . ALL_POS ; private long scopeGroupId = - 1 ; private String imagePath ; private ServiceContext mbMessageServiceContext ; @ Override public List < Category > getRootCategories ( ) { } @ Override public List < Category > getSubCategories ( final Category category ) { } @ Override public List < DiscussionThread > getThreads ( final Category category ) { } private DiscussionThread wrapLiferayThread ( final MBThread liferayThread , final Category category ) throws PortalException , SystemException { } private List < MBThread > getLiferayThreads ( final long categoryId ) throws SystemException { } @ Override public Category getCategory ( final long categoryId ) { } @ Override public long getThreadCount ( final Category category ) { } @ Override public DiscussionThread getThread ( final long threadId ) { } @ Override public List < Post > getPosts ( final DiscussionThread thread ) { } private List < MBMessage > getLiferayPosts ( final long threadId ) throws SystemException { } @ Override public void save ( final Iterable < Category > categoriesToSave ) { } @ Override public void save ( final Category categoryToSave ) { } @ Override public void delete ( final Category categoryToDelete ) { } @ Override public void reportPost ( final PostReport report ) { } @ Override public long getUnreadThreadCount ( final Category category ) { } @ Override public void save ( final Post post ) { } @ Override public void ban ( final User user ) { } @ Override public void follow ( final DiscussionThread thread ) { } @ Override public void unFollow ( final DiscussionThread thread ) { } @ Override public boolean isFollowing ( final DiscussionThread thread ) { } @ Override public void delete ( final Post post ) { } @ Override public PostVote getPostVote ( final Post post ) { } @ Override public void upvote ( final Post post ) { } @ Override public void downvote ( final Post post ) { } @ Override public void removeUserVote ( final Post post ) { } @ Override public long getScore ( final Post post ) { } @ Override public void saveAsCurrentUser ( final Post post ) { } @ Override public void move ( final DiscussionThread thread , final Category destinationCategory ) { } @ Override public void sticky ( final DiscussionThread thread ) { } @ Override public void unsticky ( final DiscussionThread thread ) { } @ Override public void lock ( final DiscussionThread thread ) { } @ Override public void unlock ( final DiscussionThread thread ) { } @ Override public void delete ( final DiscussionThread thread ) { } @ Override public void setRequest ( final Object request ) { } @ Override <START_BUG> public void saveNewThread ( final DiscussionThread newThread , final Post firstPost ) { <END_BUG> throw new UnsupportedOperationException ( "Not<seq2seq4repair_space>yet<seq2seq4repair_space>implemented." ) ; } }

Fix:
public DiscussionThread saveNewThread ( final DiscussionThread newThread , final Post firstPost ) {
Buggy code:
public class CodeSnippetParsingUtil { public RecordedParsingInformation recordedParsingInformation ; private RecordedParsingInformation getRecordedParsingInformation ( CompilationResult compilationResult , CommentRecorderParser parser ) { int problemsCount = compilationResult . problemCount ; IProblem [ ] problems = null ; if ( problemsCount != 0 ) { final IProblem [ ] compilationResultProblems = compilationResult . problems ; if ( ( compilationResultProblems . length ) == problemsCount ) { problems = compilationResultProblems ; } else { System . arraycopy ( compilationResultProblems , 0 , ( problems = new IProblem [ problemsCount ] ) , 0 , problemsCount ) ; } } <START_BUG> return new RecordedParsingInformation ( problems , compilationResult . lineSeparatorPositions , parser . getCommentsPositions ( ) ) ; <END_BUG> } public ASTNode [ ] parseClassBodyDeclarations ( char [ ] source , Map settings , boolean recordParsingInformation ) { } public ASTNode [ ] parseClassBodyDeclarations ( char [ ] source , int offset , int length , Map settings , boolean recordParsingInformation ) { } public CompilationUnitDeclaration parseCompilationUnit ( char [ ] source , Map settings , boolean recordParsingInformation ) { } public Expression parseExpression ( char [ ] source , Map settings , boolean recordParsingInformation ) { } public Expression parseExpression ( char [ ] source , int offset , int length , Map settings , boolean recordParsingInformation ) { } public ConstructorDeclaration parseStatements ( char [ ] source , Map settings , boolean recordParsingInformation ) { } public ConstructorDeclaration parseStatements ( char [ ] source , int offset , int length , Map settings , boolean recordParsingInformation ) { } }

Fix:
return new RecordedParsingInformation ( problems , compilationResult . getLineSeparatorPositions ( ) , parser . getCommentsPositions ( ) ) ;
Buggy code:
public class SearchHandlerTest extends AbstractSolrTestCase { @ Override public String getSchemaFile ( ) { } @ Override public String getSolrConfigFile ( ) { } @ SuppressWarnings ( "unchecked" ) public void testInitalization ( ) { SolrCore core = h . getCore ( ) ; List < String > names0 = new ArrayList < String > ( ) ; names0 . add ( COMPONENT_NAME ) ; NamedList args = new NamedList ( ) ; args . add ( INIT_COMPONENTS , names0 ) ; SearchHandler handler = new SearchHandler ( ) ; handler . init ( args ) ; handler . inform ( core ) ; assertEquals ( 1 , handler . getComponents ( ) . size ( ) ) ; assertEquals ( core . getSearchComponent ( COMPONENT_NAME ) , handler . getComponents ( ) . get ( 0 ) ) ; names0 = new ArrayList < String > ( ) ; names0 . add ( COMPONENT_NAME ) ; List < String > names1 = new ArrayList < String > ( ) ; names1 . add ( FacetComponent . COMPONENT_NAME ) ; args = new NamedList ( ) ; <START_BUG> args . add ( INIT_FISRT_COMPONENTS , names0 ) ; <END_BUG> args . add ( INIT_LAST_COMPONENTS , names1 ) ; handler = new SearchHandler ( ) ; handler . init ( args ) ; handler . inform ( core ) ; List < SearchComponent > comps = handler . getComponents ( ) ; assertEquals ( ( 2 + ( handler . getDefaultComponets ( ) . size ( ) ) ) , comps . size ( ) ) ; assertEquals ( core . getSearchComponent ( COMPONENT_NAME ) , comps . get ( 0 ) ) ; assertEquals ( core . getSearchComponent ( FacetComponent . COMPONENT_NAME ) , comps . get ( ( ( comps . size ( ) ) - 1 ) ) ) ; } }

Fix:
args . add ( INIT_FIRST_COMPONENTS , names0 ) ;
Buggy code:
public class ReferenceGeneStorage { private static final int INDEX_START = 3 ; private static final int INDEX_END = 4 ; private static final int INDEX_SCORE = 5 ; private static final int INDEX_STRAND = 6 ; private static final int INDEX_ATTRIBUTES = 8 ; private static final int MUTATION_INDEX = 3 ; private static final int MUTATION_NAME = 0 ; private TreeSet < ReferenceGene > referenceGenes ; private Map < Integer , String > drugResMuts ; public ReferenceGeneStorage ( final String genePath , final String mutationPath ) { } private Map < Integer , String > extractMutations ( final String mutationPath ) { Map < Integer , String > temp = new HashMap < Integer , String > ( ) ; Scanner sc = new Scanner ( ReferenceGene . class . getClassLoader ( ) . getResourceAsStream ( mutationPath ) ) ; while ( sc . hasNextLine ( ) ) { String line = sc . nextLine ( ) ; if ( ! ( line . contains ( "##" ) ) ) { String [ ] columns = line . split ( "\\t" ) ; String [ ] linesplit = columns [ 0 ] . split ( ":" ) ; String [ ] info = linesplit [ 1 ] . split ( "," ) ; <START_BUG> temp . put ( Integer . valueOf ( info [ ReferenceGeneStorage . MUTATION_INDEX ] ) , info [ ReferenceGeneStorage . MUTATION_NAME ] ) ; <END_BUG> } } sc . close ( ) ; return temp ; } private TreeSet < ReferenceGene > extractReferenceGenes ( final String file ) { } public TreeSet < ReferenceGene > getReferenceGenes ( ) { } public boolean isIntragenic ( final int index ) { } private void connectGeneMutations ( ) { } public boolean containsMutationIndex ( final int index ) { } public Map < Integer , String > getDrugResistanceMutations ( ) { } }

Fix:
temp . put ( Integer . parseInt ( info [ ReferenceGeneStorage . MUTATION_INDEX ] ) , info [ ReferenceGeneStorage . MUTATION_NAME ] ) ;
Buggy code:
public class ControlEditor { public int horizontalAlignment = SWT . CENTER ; public boolean grabHorizontal = false ; public int minimumWidth = 0 ; public int verticalAlignment = SWT . CENTER ; public boolean grabVertical = false ; public int minimumHeight = 0 ; Composite parent ; Control editor ; private boolean hadFocus ; private Listener tableListener ; private Listener scrollbarListener ; public ControlEditor ( Composite parent ) { } Rectangle computeBounds ( ) { } public void dispose ( ) { } public Control getEditor ( ) { } public void layout ( ) { } void _resize ( ) { } void scroll ( Event e ) { } public void setEditor ( Control editor ) { if ( editor == null ) { this . editor = null ; return ; } this . editor = editor ; _resize ( ) ; <START_BUG> if ( ( editor == null ) || ( editor . isDisposed ( ) ) ) <END_BUG> return ; editor . setVisible ( true ) ; } }

Fix:
if ( ( ( this . editor ) == null ) || ( this . editor . isDisposed ( ) ) )
Buggy code:
public class CpioArchiveOutputStream extends ArchiveOutputStream implements CpioConstants { private CpioArchiveEntry entry ; private boolean closed = false ; private boolean finished ; private final short entryFormat ; private final HashMap names = new HashMap ( ) ; private long crc = 0 ; private long written ; private final OutputStream out ; public CpioArchiveOutputStream ( final OutputStream out , final short format ) { } public CpioArchiveOutputStream ( final OutputStream out ) { } private void ensureOpen ( ) throws IOException { } public void putArchiveEntry ( ArchiveEntry entry ) throws IOException { } private void writeHeader ( final CpioArchiveEntry e ) throws IOException { } private void writeNewEntry ( final CpioArchiveEntry entry ) throws IOException { } private void writeOldAsciiEntry ( final CpioArchiveEntry entry ) throws IOException { } private void writeOldBinaryEntry ( final CpioArchiveEntry entry , final boolean swapHalfWord ) throws IOException { } public void closeArchiveEntry ( ) throws IOException { } public void write ( final byte [ ] b , final int off , final int len ) throws IOException { } public void finish ( ) throws IOException { ensureOpen ( ) ; if ( this . finished ) { return ; } if ( ( this . entry ) != null ) { <START_BUG> closeArchiveEntry ( ) ; <END_BUG> } this . entry = new CpioArchiveEntry ( this . entryFormat ) ; this . entry . setName ( CPIO_TRAILER ) ; this . entry . setNumberOfLinks ( 1 ) ; writeHeader ( this . entry ) ; closeArchiveEntry ( ) ; } public void close ( ) throws IOException { } private void pad ( int count ) throws IOException { } private void writeBinaryLong ( final long number , final int length , final boolean swapHalfWord ) throws IOException { } private void writeAsciiLong ( final long number , final int length , final int radix ) throws IOException { } private void writeCString ( final String str ) throws IOException { } public ArchiveEntry createArchiveEntry ( File inputFile , String entryName ) throws IOException { } }

Fix:
throw new IOException ( "This<seq2seq4repair_space>archives<seq2seq4repair_space>contains<seq2seq4repair_space>unclosed<seq2seq4repair_space>entries." ) ;
Buggy code:
public class DayDV extends AbstractDateTimeDV { private static final int DAY_SIZE = 5 ; public Object getActualValue ( String content , ValidationContext context ) throws InvalidDatatypeValueException { try { return parse ( content , null ) ; } catch ( Exception ex ) { <START_BUG> throw new InvalidDatatypeValueException ( "not<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>day" ) ; <END_BUG> } } protected int [ ] parse ( String str , int [ ] date ) throws SchemaDateTimeException { } protected String dateToString ( int [ ] date ) { } }

Fix:
throw new InvalidDatatypeValueException ( "cvc-datatype-valid.1.2.1" , new Object [ ] { content , "gDay" } ) ;
Buggy code:
public class DubboCodec extends ExchangeCodec implements Codec2 { private static final Logger log = LoggerFactory . getLogger ( DubboCodec . class ) ; public static final String NAME = "dubbo" ; public static final String DUBBO_VERSION = Version . getVersion ( DubboCodec . class , Version . getVersion ( ) ) ; public static final byte RESPONSE_WITH_EXCEPTION = 0 ; public static final byte RESPONSE_VALUE = 1 ; public static final byte RESPONSE_NULL_VALUE = 2 ; public static final Object [ ] EMPTY_OBJECT_ARRAY = new Object [ 0 ] ; public static final Class < ? > [ ] EMPTY_CLASS_ARRAY = new Class < ? > [ 0 ] ; protected Object decodeBody ( Channel channel , InputStream is , byte [ ] header ) throws IOException { } private ObjectInput deserialize ( Serialization serialization , URL url , InputStream is ) throws IOException { } private byte [ ] readMessageData ( InputStream is ) throws IOException { } @ Override protected void encodeRequestData ( Channel channel , ObjectOutput out , Object data ) throws IOException { } @ Override protected void encodeResponseData ( Channel channel , ObjectOutput out , Object data ) throws IOException { } private boolean containComplexArguments ( RpcInvocation invocation ) { for ( int i = 0 ; i < ( invocation . getParameterTypes ( ) . length ) ; i ++ ) { <START_BUG> if ( ( invocation . getParameterTypes ( ) [ i ] ) != ( invocation . getArguments ( ) [ i ] ) ) { <END_BUG> return true ; } } return false ; } No newline ; at end ; of file ; }

Fix:
if ( ( invocation . getParameterTypes ( ) [ i ] ) != ( invocation . getArguments ( ) [ i ] . getClass ( ) ) ) {
Buggy code:
public abstract class NamedMember extends Member { protected String name ; public NamedMember ( JavaElement parent , String name ) { } private void appendTypeParameters ( StringBuffer buffer ) throws JavaModelException { } public String getElementName ( ) { } protected String getKey ( IField field , boolean forceOpen ) throws JavaModelException { } protected String getKey ( IMethod method , boolean forceOpen ) throws JavaModelException { StringBuffer key = new StringBuffer ( ) ; String declaringKey = getKey ( ( ( IType ) ( method . getParent ( ) ) ) , forceOpen ) ; key . append ( declaringKey ) ; key . append ( '.' ) ; String selector = method . getElementName ( ) ; key . append ( selector ) ; if ( forceOpen ) { ITypeParameter [ ] typeParameters = method . getTypeParameters ( ) ; int length = typeParameters . length ; if ( length > 0 ) { key . append ( '<' ) ; for ( int i = 0 ; i < length ; i ++ ) { ITypeParameter typeParameter = typeParameters [ i ] ; String [ ] bounds = typeParameter . getBounds ( ) ; int boundsLength = bounds . length ; char [ ] [ ] boundSignatures = new char [ boundsLength ] [ ] ; for ( int j = 0 ; j < boundsLength ; j ++ ) { boundSignatures [ j ] = Signature . createCharArrayTypeSignature ( bounds [ j ] . toCharArray ( ) , method . isBinary ( ) ) ; CharOperation . replace ( boundSignatures [ j ] , '.' , '//' ) ; } char [ ] sig = Signature . createTypeParameterSignature ( typeParameter . getElementName ( ) . toCharArray ( ) , boundSignatures ) ; key . append ( sig ) ; } key . append ( '>' ) ; } } key . append ( '(' ) ; String [ ] parameters = method . getParameterTypes ( ) ; for ( int i = 0 , length = parameters . length ; i < length ; i ++ ) key . append ( parameters [ i ] . replace ( '.' , '//' ) ) ; key . append ( ')' ) ; if ( forceOpen ) <START_BUG> key . append ( method . getReturnType ( ) ) ; <END_BUG> else key . append ( 'V' ) ; return key . toString ( ) ; } protected String getKey ( IType type , boolean forceOpen ) throws JavaModelException { } protected String getFullyQualifiedParameterizedName ( String fullyQualifiedName , String uniqueKey ) throws JavaModelException { } protected IPackageFragment getPackageFragment ( ) { } public String getFullyQualifiedName ( char enclosingTypeSeparator , boolean showParameters ) throws JavaModelException { } public String getTypeQualifiedName ( char enclosingTypeSeparator , boolean showParameters ) throws JavaModelException { } protected ITypeParameter [ ] getTypeParameters ( ) throws JavaModelException { } }

Fix:
key . append ( method . getReturnType ( ) . replace ( '.' , '//' ) ) ;
Buggy code:
public class Page < T > { public final int pageSize ; public final int offset ; public final int size ; public final int maxIndex ; public final Set < T > valueSet = new HashSet < T > ( ) ; private int maxValidIndex ; private boolean valid ; private T [ ] values ; public Page ( int pageSize , int offset , int collectionSize ) { } public void set ( int index , T value ) { } public T get ( int index ) { } public int indexOf ( T value ) { } public boolean contains ( Object value ) { } public int getPageSize ( ) { } public List < T > toImmutableList ( ) { } public void setInvalid ( ) { } public boolean isValid ( ) { } public boolean isWithinRange ( int startIndex , int numberOfItems ) { } public List < T > subList ( int startIndex , int numberOfItems ) { List < T > idList = this . toImmutableList ( ) ; <START_BUG> return idList . subList ( ( startIndex - ( offset ) ) , Math . min ( numberOfItems , maxValidIndex ) ) ; <END_BUG> } }

Fix:
return idList . subList ( ( startIndex - ( offset ) ) , Math . min ( ( ( startIndex - ( offset ) ) + numberOfItems ) , maxValidIndex ) ) ;
Buggy code:
public class BoardPanel extends JPanel { public BoardPanel ( BoardSize boardSize , int boardIndex , int teamIndex , GlassPane globalGlassPane , DropManager dropManager , boolean isJail ) { } private void createGrid ( BoardSize boardSize ) { for ( int y = boardSize . height ; y > 0 ; y -- ) { JLabel label = GuiUtility . createJLabel ( ( "" + y ) ) ; label . setHorizontalAlignment ( SwingConstants . CENTER ) ; add ( label ) ; <START_BUG> for ( int x = boardSize . width ; x > 0 ; x -- ) { <END_BUG> SquareJLabel square = new SquareJLabel ( BoardCoordinate . at ( x , y ) , true , 48 ) ; square . addMouseMotionListener ( new com . drewhannay . chesscrafter . dragNdrop . MotionAdapter ( mGlassPane ) ) ; square . addMouseListener ( new SquareListener ( square , mDropManager , mGlassPane ) ) ; add ( square ) ; mSquareLabels [ ( x - 1 ) ] [ ( y - 1 ) ] = square ; square . refresh ( ) ; } } for ( int x = 0 ; x <= ( boardSize . width ) ; x ++ ) { if ( x != 0 ) { JLabel label = GuiUtility . createJLabel ( ( "" + ( ( char ) ( ( x - 1 ) + 'A' ) ) ) ) ; label . setHorizontalAlignment ( SwingConstants . CENTER ) ; add ( label ) ; } else { add ( GuiUtility . createJLabel ( "" ) ) ; } } } public void updatePieceLocations ( Board [ ] boards ) { } public void updateJailPopulation ( Team [ ] teams ) { } public void refreshSquares ( ) { } private void createJailGrid ( BoardSize boardSize ) { } public List < SquareJLabel > highlightSquares ( Set < BoardCoordinate > coordinates ) { } private static final long serialVersionUID = 9042633590279303353L ; private SquareJLabel [ ] [ ] mSquareLabels ; private int mBoardIndex ; private int mTeamIndex ; private GlassPane mGlassPane ; private DropManager mDropManager ; }

Fix:
for ( int x = 1 ; x <= ( boardSize . width ) ; x ++ ) {
Buggy code:
public class MRCReader extends FormatReader { private static final String [ ] TYPES = new String [ ] { "mono" , "tilt" , "tilts" , "lina" , "lins" } ; private static final String [ ] MRC_SUFFIXES = new String [ ] { "mrc" , "st" , "ali" , "map" , "rec" } ; private static final int HEADER_SIZE = 1024 ; private static final int ENDIANNESS_OFFSET = 212 ; private int extHeaderSize = 0 ; public MRCReader ( ) { } public boolean isThisType ( RandomAccessInputStream stream ) throws IOException { } public byte [ ] openBytes ( int no , byte [ ] buf , int x , int y , int w , int h ) throws IOException , FormatException { FormatTools . checkPlaneParameters ( this , no , buf . length , x , y , w , h ) ; long planeSize = FormatTools . getPlaneSize ( this ) ; long offset = ( ( MRCReader . HEADER_SIZE ) + ( extHeaderSize ) ) + ( no * planeSize ) ; if ( ( ( offset + planeSize ) <= ( in . length ( ) ) ) && ( offset >= 0 ) ) { in . seek ( offset ) ; <START_BUG> readPlane ( in , x , y , w , h , buf ) ; <END_BUG> byte [ ] tmp = new byte [ w * ( FormatTools . getBytesPerPixel ( getPixelType ( ) ) ) ] ; for ( int row = 0 ; row < ( h // 2 ) ; row ++ ) { int src = row * ( tmp . length ) ; int dest = ( ( h - row ) - 1 ) * ( tmp . length ) ; System . arraycopy ( buf , src , tmp , 0 , tmp . length ) ; System . arraycopy ( buf , dest , buf , src , tmp . length ) ; System . arraycopy ( tmp , 0 , buf , dest , tmp . length ) ; } } return buf ; } public void close ( boolean fileOnly ) throws IOException { } public void initFile ( String id ) throws IOException , FormatException { } }

Fix:
readPlane ( in , x , ( ( ( getSizeY ( ) ) - h ) - y ) , w , h , buf ) ;
Buggy code:
public class TestVersion extends SingleEMFTestCase { public void setUp ( ) { } public void testVersionNumeric ( ) { } public void testVersionTimestamp ( ) { try { <START_BUG> Thread . sleep ( 50 ) ; <END_BUG> } catch ( InterruptedException e ) { } EntityManager em1 = emf . createEntityManager ( ) ; em1 . getTransaction ( ) . begin ( ) ; EntityManager em2 = emf . createEntityManager ( ) ; em2 . getTransaction ( ) . begin ( ) ; AnnoTest2 pc1 = em1 . find ( AnnoTest2 . class , new AnnoTest2 . Oid ( 5 , "bar" ) ) ; AnnoTest2 pc2 = em2 . find ( AnnoTest2 . class , new AnnoTest2 . Oid ( 5 , "bar" ) ) ; assertNotNull ( pc1 . getVersion ( ) ) ; assertEquals ( pc1 . getVersion ( ) , pc2 . getVersion ( ) ) ; pc1 . setBasic ( "75" ) ; pc2 . setBasic ( "75" ) ; em1 . getTransaction ( ) . commit ( ) ; em1 . close ( ) ; em1 = emf . createEntityManager ( ) ; pc1 = em1 . find ( AnnoTest2 . class , new AnnoTest2 . Oid ( 5 , "bar" ) ) ; Date pc1Version = pc1 . getVersion ( ) ; Date pc2Version = pc2 . getVersion ( ) ; assertTrue ( ( ( pc1Version . compareTo ( pc2Version ) ) > 0 ) ) ; em1 . close ( ) ; try { em2 . getTransaction ( ) . commit ( ) ; fail ( "Optimistic<seq2seq4repair_space>fail" ) ; } catch ( Exception e ) { } finally { em2 . close ( ) ; } } public void testVersionSubclass ( ) { } public void testVersionNoChange ( ) { } public void testNoDefaultVersionWithoutFieldOrColumn ( ) { } public void testVersionWithField ( ) { } }

Fix:
Thread . sleep ( 5000 ) ;