nus-yam/ex-repair huggingface dataset:
Buggy code:
public class SteamListingService implements ListingService { private final Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ; private final ObjectMapper objectMapper = new ObjectMapper ( ) ; private final Http http ; private final String username ; private final Random random = new Random ( ) ; public SteamListingService ( Http http , String username ) { } @ Override public void getAsyncNewlyListed ( String host , int currency , String country , ListingDeque queue ) { try { ListingHandle handle = new ListingHandle ( objectMapper , queue , country ) ; <START_BUG> http . get ( ( ( ( ( ( ( ( ( "http:////" + host ) + "//market//recent?currency=" ) + ( random . nextInt ( 32 ) ) ) + "&currency=" ) + currency ) + "&country=" ) + country ) + "&language=english" ) , handle , true , true ) ; <END_BUG> } catch ( IOException e ) { logger . error ( "Error<seq2seq4repair_space>getting<seq2seq4repair_space>newly<seq2seq4repair_space>listed" , e ) ; } } @ Override public void getAsyncNewlyListed ( int currency , String country , ListingDeque queue ) { } @ Override public void getAsyncListed ( Item item , int currency , String country , int start , GenericHandle < Listing > listingHandle ) { } @ Override public void getAsyncListed ( String host , Item item , int currency , String country , int start , GenericHandle < Listing > listingHandle ) { } @ Override public List < Listing > getNewlyListed ( int currency , String country ) { } @ Override public boolean removeListing ( String listingId ) { } @ Override public void createListing ( String assetId , int appId , String urlName , int contextId , int price ) { } }

Fix:
http . get ( ( ( ( ( ( "http:////" + host ) + "//market//recent?country=" ) + country ) + "&language=english&currency=" ) + currency ) , handle , true , true ) ;
Buggy code:
public class MainActivity extends BaseActivity { DayModel currentDay ; WeekModel currentWeek ; int currentWeekNumber = 0 ; int selectedPage ; int triangleWidth ; int triangleHeight ; boolean canUpdateTriangle = false ; PullRefreshLayout refreshLayout ; PullRefreshLayout noMenuRefreshView ; View triangle ; LinearLayout navigationButtons = null ; private static int numPages = ( ( WeekModel . getWeekList ( ) . size ( ) ) * 7 ) * 2 ; private ViewPager mPager ; private PagerAdapter mPagerAdapter ; private int oldMenuIndex = 0 ; public static final String PROPERTY_REG_ID = "registration_id" ; private static final String PROPERTY_APP_VERSION = "appVersion" ; private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000 ; String SENDER_ID = "969355700051" ; static final String TAG = "GCMDemo" ; GoogleCloudMessaging gcm ; Context context ; String regid ; @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onStart ( ) { } @ Override protected void onStop ( ) { } private void initiateScrollRefresh ( ) { } private void setTriangleWidth ( ) { } private void fillNavigationButtons ( ) { } @ Override protected void onResume ( ) { } private void toggleRefreshView ( boolean isMenuAvailable ) { } private void showNavigationButtonList ( ) { } private void initiateViewPager ( ) { } private void updateTrianglePosition ( int i ) { } public boolean initiateFiles ( ) { } public void getMenus ( String file ) { } public boolean getXmlFiles ( ) { } public String removeWhiteSpaces ( String input ) { } private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter ( FragmentManager fm ) { } @ Override public Fragment getItem ( int position ) { } @ Override public int getCount ( ) { } } public void updateCurrentMenuIndicationColor ( int pageIndex , boolean updateOldDayButton ) { } public void onClickNavigationButton ( View view ) { } public void onClickHeaderText ( View view ) { } public void onClickEventButton ( View view ) { } public void onClickMenu ( View view ) { } public void goToCurrentMenu ( ) { Calendar now = Calendar . getInstance ( ) ; <START_BUG> int today = ( ( now . get ( Calendar . DAY_OF_WEEK ) ) - 2 ) % 7 ; <END_BUG> int timeH = now . get ( Calendar . HOUR_OF_DAY ) ; int menuNumber ; if ( timeH < 14 ) { menuNumber = today * 2 ; } else { menuNumber = ( today * 2 ) + 1 ; } mPager . setCurrentItem ( menuNumber , false ) ; } private boolean checkPlayServices ( ) { } private String getRegistrationId ( Context context ) { } private SharedPreferences getGCMPreferences ( Context context ) { } private static int getAppVersion ( Context context ) { } private void registerInBackground ( ) { } private void sendRegistrationIdToBackend ( ) { } private void storeRegistrationId ( Context context , String regId ) { } private void refreshServerToken ( ) throws JSONException { } }

Fix:
int today = ( ( now . get ( Calendar . DAY_OF_WEEK ) ) + 5 ) % 7 ;
Buggy code:
public class XMLFileHandler { private final XMLConfiguration _conf ; public XMLFileHandler ( XMLConfiguration conf ) { } public Collection load ( ClassMetaData meta ) { } private Collection read ( File f ) throws Exception { } private File getFile ( ClassMetaData meta ) { } public void store ( ClassMetaData meta , Collection datas ) { } private void write ( Collection datas , FileWriter fw ) throws Exception { } public void writeDataValue ( Writer out , int type , Object val ) throws IOException { } private static class ObjectDataHandler extends DefaultHandler { private static final Class [ ] ARGS = new Class [ ] { String . class } ; private final XMLConfiguration _conf ; private final Collection _extent = new ArrayList ( ) ; private ObjectData _object ; private FieldMetaData _fmd ; private Object _fieldVal ; private Object _keyVal ; private StringBuffer _buf ; public ObjectDataHandler ( XMLConfiguration conf ) { } public Collection getExtent ( ) { } public void startElement ( String uri , String localName , String qName , Attributes attrs ) throws SAXException { } private void startElement ( String qName , Attributes attrs ) throws Exception { switch ( qName . charAt ( 0 ) ) { case 'o' : String type = attrs . getValue ( "class" ) ; <START_BUG> ClassMetaData meta = _conf . getMetaDataRepository ( ) . getMetaData ( classForName ( type ) , null , true ) ; <END_BUG> Object oid ; if ( ( meta . getIdentityType ( ) ) == ( meta . ID_DATASTORE ) ) oid = new org . apache . openjpa . util . Id ( attrs . getValue ( "oid" ) , _conf , null ) ; else oid = PCRegistry . newObjectId ( meta . getDescribedType ( ) , attrs . getValue ( "oid" ) ) ; _object = new ObjectData ( oid , meta ) ; _object . setVersion ( new Long ( attrs . getValue ( "version" ) ) ) ; break ; case 'f' : _fmd = _object . getMetaData ( ) . getField ( attrs . getValue ( "name" ) ) ; switch ( _fmd . getTypeCode ( ) ) { case JavaTypes . COLLECTION : case JavaTypes . ARRAY : _fieldVal = new ArrayList ( ) ; break ; case JavaTypes . MAP : _fieldVal = new HashMap ( ) ; break ; default : _buf = new StringBuffer ( ) ; } break ; case 'e' : case 'k' : case 'v' : _buf = new StringBuffer ( ) ; break ; } } public void endElement ( String uri , String localName , String qName ) throws SAXException { } private void endElement ( String qName ) throws Exception { } public void characters ( char [ ] ch , int start , int length ) { } public Object fromXMLString ( int type , ClassMetaData rel , String str ) throws Exception { } private Class classForName ( String name ) throws Exception { } } private static class XMLEncoder { public static String encode ( String s ) { } public static String decode ( String s ) { } private static StringBuffer initializeBuffer ( StringBuffer buf , String s , int i ) { } } }

Fix:
ClassMetaData meta = _conf . getMetaDataRepositoryInstance ( ) . getMetaData ( classForName ( type ) , null , true ) ;
Buggy code:
public class PrinterProducer extends DefaultProducer { private final PrinterConfiguration config ; private PrinterOperations printerOperations ; private PrintService printService ; private String printer ; public PrinterProducer ( Endpoint endpoint , PrinterConfiguration config ) throws Exception { } public void process ( Exchange exchange ) throws Exception { } private void print ( InputStream body ) throws PrintException { } private DocFlavor assignDocFlavor ( ) throws Exception { } private PrintRequestAttributeSet assignPrintAttributes ( ) throws PrintException { } private DocPrintJob assignPrintJob ( PrintService printService ) { } private PrintService assignPrintService ( ) throws PrintException { PrintService printService ; <START_BUG> if ( ( config . getHostname ( ) . equalsIgnoreCase ( "localhost" ) ) && ( config . getPrintername ( ) . equalsIgnoreCase ( "//default" ) ) ) { <END_BUG> printService = PrintServiceLookup . lookupDefaultPrintService ( ) ; } else { PrintService [ ] services = PrintServiceLookup . lookupPrintServices ( null , null ) ; setPrinter ( ( ( ( "\\\\" + ( config . getHostname ( ) ) ) + "\\" ) + ( config . getPrintername ( ) ) ) ) ; int position = findPrinter ( services , printer ) ; if ( position < 0 ) { throw new PrintException ( ( ( "No<seq2seq4repair_space>printer<seq2seq4repair_space>found<seq2seq4repair_space>with<seq2seq4repair_space>name:<seq2seq4repair_space>" + ( printer ) ) + ".<seq2seq4repair_space>Please<seq2seq4repair_space>verify<seq2seq4repair_space>that<seq2seq4repair_space>the<seq2seq4repair_space>host<seq2seq4repair_space>and<seq2seq4repair_space>printer<seq2seq4repair_space>are<seq2seq4repair_space>registered<seq2seq4repair_space>and<seq2seq4repair_space>reachable<seq2seq4repair_space>from<seq2seq4repair_space>this<seq2seq4repair_space>machine." ) ) ; } printService = services [ position ] ; } return printService ; } private int findPrinter ( PrintService [ ] services , String printer ) { } public PrinterConfiguration getConfig ( ) { } public PrinterOperations getPrinterOperations ( ) { } public void setPrinterOperations ( PrinterOperations printerOperations ) { } public PrintService getPrintService ( ) { } public void setPrintService ( PrintService printService ) { } public String getPrinter ( ) { } public void setPrinter ( String printer ) { } @ Override protected void doStart ( ) throws Exception { } @ Override protected void doStop ( ) throws Exception { } }

Fix:
if ( ( config . getHostname ( ) . equalsIgnoreCase ( "localhost" ) ) && ( config . getPrintername ( ) . equalsIgnoreCase ( "default" ) ) ) {
Buggy code:
public class CmpEntityBeanHomeFinderInterceptorFactory extends EntityBeanHomeFinderInterceptorFactory { private final Method finderMethod ; private final boolean localHome ; public CmpEntityBeanHomeFinderInterceptorFactory ( final Method finderMethod , final boolean localHome ) { } protected Object invokeFind ( final InterceptorContext context , final EntityBeanComponentInstance instance ) throws Exception { final CmpEntityBeanComponentInstance cmpInstance = CmpEntityBeanComponentInstance . class . cast ( instance ) ; final CmpEntityBeanComponent cmpComponent = cmpInstance . getComponent ( ) ; try { cmpComponent . getComponentClass ( ) . getDeclaredMethod ( finderMethod . getName ( ) , finderMethod . getParameterTypes ( ) ) ; return super . invokeFind ( context , instance ) ; } catch ( NoSuchMethodException ignored ) { } final JDBCEntityPersistenceStore store = cmpComponent . getStoreManager ( ) ; final CmpEntityBeanContext entityContext = cmpInstance . getEjbContext ( ) ; if ( finderMethod . getName ( ) . equals ( "findByPrimaryKey" ) ) { if ( ( finderMethod . getParameterTypes ( ) ) == null ) { throw CmpMessages . MESSAGES . nullArgumentForFindByPrimaryKey ( ) ; } if ( ( finderMethod . getParameterTypes ( ) . length ) != 1 ) { throw CmpMessages . MESSAGES . illegalNumberOfArgumentsForFindByPrimaryKey ( finderMethod . getParameterTypes ( ) . length ) ; } final ReadyEntityCache cache = cmpComponent . getCache ( ) ; <START_BUG> if ( cache . isCached ( context . getParameters ( ) [ 0 ] ) ) { <END_BUG> return this . localHome ? cmpComponent . getEJBLocalObject ( context . getParameters ( ) [ 0 ] ) : cmpComponent . getEJBObject ( context . getParameters ( ) [ 0 ] ) ; } } else if ( ! ( store . getCmpConfig ( ) . isSyncOnCommitOnly ( ) ) ) { cmpComponent . synchronizeEntitiesWithinTransaction ( entityContext . getTransaction ( ) ) ; } final JDBCQueryCommand . EntityProxyFactory factory = new JDBCQueryCommand . EntityProxyFactory ( ) { public Object getEntityObject ( final Object primaryKey ) { return localHome ? cmpComponent . getEJBLocalObject ( primaryKey ) : cmpComponent . getEJBObject ( primaryKey ) ; } } ; if ( ( getReturnType ( ) ) == ( ReturnType . SINGLE ) ) { return store . findEntity ( context . getMethod ( ) , context . getParameters ( ) , entityContext , factory ) ; } else { return store . findEntities ( context . getMethod ( ) , context . getParameters ( ) , entityContext , factory ) ; } } protected Object prepareResults ( final InterceptorContext context , final Object result , final EntityBeanComponent component ) throws ObjectNotFoundException { } }

Fix:
if ( cache . containsNotRemoved ( context . getParameters ( ) [ 0 ] ) ) {
Buggy code:
public class ConnTest { private static final String TAG = "ConnTest" ; public static void test ( final ConnTestCallBack callBack ) { new Thread ( new Runnable ( ) { @ Override public void run ( ) { String response = HttpRequest . sendGet ( "http:////www.mathpages.com//home//kmath267//kmath267.htm" , "" , 3 ) ; Log . v ( ConnTest . TAG , ( "Response<seq2seq4repair_space>is<seq2seq4repair_space>" + response ) ) ; <START_BUG> if ( response . contains ( "Combining<seq2seq4repair_space>Probabilities" ) ) <END_BUG> callBack . onTestOver ( true ) ; else callBack . onTestOver ( false ) ; } } ) . start ( ) ; } No newline ; at end ; of file ; }

Fix:
if ( response . equals ( "<html><head>" ) )
Buggy code:
public class ListAllRolesAssignedToProject extends Communication { public ListAllRolesAssignedToProject ( Integer registrationNumber , String componentName ) { } public void update ( Observable thing , Object notificationNumber ) { Menus menu = new Menus ( ) ; Displays display = new Displays ( ) ; Project myProject = new Project ( ) ; if ( ( registrationNumber . compareTo ( ( ( Integer ) ( notificationNumber ) ) ) ) == 0 ) { addToReceiverList ( "ListProjectsComponent" ) ; signalReceivers ( "ListProjectsComponent" ) ; myProject = menu . pickProject ( theListOfProjects . getListOfProjects ( ) ) ; if ( myProject != null ) { <START_BUG> display . displayResourcesAssignedToProject ( myProject ) ; <END_BUG> } else { System . out . println ( "\n\n<seq2seq4repair_space>***<seq2seq4repair_space>Project<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>***" ) ; } } removeFromReceiverList ( "ListProjectsComponent" ) ; } No newline ; at end ; of file ; }

Fix:
display . displayRoleAssignedToProjet ( myProject , theListOfResources . getListOfResources ( ) ) ;
Buggy code:
public class CauchyDistributionTest extends ContinuousDistributionAbstractTest { public CauchyDistributionTest ( String arg0 ) { } public ContinuousDistribution makeDistribution ( ) { <START_BUG> return DistributionFactory . newInstance ( ) . createCauchyDistribution ( 1.2 , 2.1 ) ; <END_BUG> } public double [ ] makeCumulativeTestPoints ( ) { } public double [ ] makeCumulativeTestValues ( ) { } public void testInverseCumulativeProbabilityExtremes ( ) throws Exception { } public void testMedian ( ) { } public void testScale ( ) { } public void testSetScale ( ) { } }

Fix:
return new CauchyDistributionImpl ( 1.2 , 2.1 ) ;
Buggy code:
public class DirectoryScannerTest extends BuildFileTest { public DirectoryScannerTest ( String name ) { } private boolean supportsSymlinks = ( Os . isFamily ( "unix" ) ) && ( ! ( JavaEnvUtils . isJavaVersion ( JAVA_1_1 ) ) ) ; public void setUp ( ) { } public void tearDown ( ) { } public void test1 ( ) { } public void test2 ( ) { } public void test3 ( ) { } public void testFullPathMatchesCaseSensitive ( ) { } public void testFullPathMatchesCaseInsensitive ( ) { } public void test2ButCaseInsensitive ( ) { } public void testAllowSymlinks ( ) { } public void testProhibitSymlinks ( ) { } public void testOrderOfIncludePatternsIrrelevant ( ) { } public void testPatternsDifferInCaseScanningSensitive ( ) { } public void testPatternsDifferInCaseScanningInsensitive ( ) { } public void testFullpathDiffersInCaseScanningSensitive ( ) { } public void testFullpathDiffersInCaseScanningInsensitive ( ) { DirectoryScanner ds = new DirectoryScanner ( ) ; ds . setBasedir ( new File ( getProject ( ) . getBaseDir ( ) , "tmp" ) ) ; <START_BUG> ds . setIncludes ( new String [ ] { "alpha//beta//gamma//gamma.XML" , "alpha//beta//gamma//GAMMA.XML" } ) ; <END_BUG> ds . setCaseSensitive ( false ) ; ds . scan ( ) ; compareFiles ( ds , new String [ ] { "alpha//beta//gamma//gamma.xml" } , new String [ ] { } ) ; } public void testSetFollowLinks ( ) { } public void testChildrenOfExcludedDirectory ( ) { } private void compareFiles ( DirectoryScanner ds , String [ ] expectedFiles , String [ ] expectedDirectories ) { } }

Fix:
ds . setIncludes ( new String [ ] { "alpha//beta//gamma//gamma.xml" , "alpha//beta//gamma//GAMMA.XML" } ) ;
Buggy code:
public class OperationRequestHandler implements CommandHandler , OperationCommand { @ Override public boolean isBatchMode ( ) { } @ Override public void handle ( CommandContext ctx ) { } @ Override public boolean isAvailable ( CommandContext ctx ) { } @ Override public ModelNode buildRequest ( CommandContext ctx ) throws CommandFormatException { <START_BUG> return ( ( org . jboss . as . cli . operation . impl . DefaultCallbackHandler ) ( ctx . getParsedCommandLine ( ) ) ) . toOperationRequest ( ) ; <END_BUG> } @ Override public boolean hasArgument ( String name ) { } @ Override public boolean hasArgument ( int index ) { } @ Override public List < CommandArgument > getArguments ( CommandContext ctx ) { } private void validateRequest ( CommandContext ctx , ModelNode request ) throws CommandFormatException { } }

Fix:
return ( ( DefaultCallbackHandler ) ( ctx . getParsedCommandLine ( ) ) ) . toOperationRequest ( ctx ) ;
Buggy code:
public class ExternalLink extends AbstractLink { private static final long serialVersionUID = 1L ; private final IModel label ; private boolean contextRelative = false ; private PopupSettings popupSettings = null ; public ExternalLink ( final String id , final String href , final String label ) { } public ExternalLink ( final String id , final String href ) { } public ExternalLink ( final String id , final IModel href , final IModel label ) { } public ExternalLink ( final String id , final IModel href ) { } public final PopupSettings getPopupSettings ( ) { } public final ExternalLink setPopupSettings ( final PopupSettings popupSettings ) { } protected void onComponentTag ( ComponentTag tag ) { super . onComponentTag ( tag ) ; if ( ( isLinkEnabled ( ) ) == false ) { disableLink ( tag ) ; } else if ( ( getModel ( ) ) != null ) { Object hrefValue = getModelObject ( ) ; if ( hrefValue != null ) { String url = hrefValue . toString ( ) ; if ( contextRelative ) { if ( ( ( url . length ( ) ) > 0 ) && ( ( url . charAt ( 0 ) ) == '//' ) ) { url = url . substring ( 1 ) ; } url = ( RequestCycle . get ( ) . getRequest ( ) . getRelativePathPrefixToContextRoot ( ) ) + url ; } if ( ( ( tag . getName ( ) . equalsIgnoreCase ( "a" ) ) || ( tag . getName ( ) . equalsIgnoreCase ( "link" ) ) ) || ( tag . getName ( ) . equalsIgnoreCase ( "area" ) ) ) { tag . put ( "href" , Strings . replaceAll ( url , "&" , "&amp;" ) ) ; if ( ( popupSettings ) != null ) { tag . put ( "onclick" , popupSettings . getPopupJavaScript ( ) ) ; } } else { if ( ( popupSettings ) != null ) { popupSettings . setTarget ( ( ( "'" + url ) + "'" ) ) ; String popupScript = popupSettings . getPopupJavaScript ( ) ; tag . put ( "onclick" , popupScript ) ; } else { tag . put ( "onclick" , ( ( "window.location.href='" + url ) + "';" ) ) ; } } } if ( ( popupSettings ) != null ) { IPageMap popupPageMap = popupSettings . getPageMap ( this ) ; <START_BUG> if ( popupPageMap != null ) { <END_BUG> tag . put ( "target" , popupPageMap . getName ( ) ) ; } } } } protected void onComponentTagBody ( MarkupStream markupStream , ComponentTag openTag ) { } public boolean isContextRelative ( ) { } public ExternalLink setContextRelative ( boolean contextRelative ) { } public IModel getLabel ( ) { } }

Fix:
if ( ( popupPageMap != null ) && ( ( popupPageMap . getName ( ) ) != null ) ) {
Buggy code:
public class LockingMetricsHandler extends AbstractRuntimeOnlyHandler { @ Override protected void executeRuntimeStep ( OperationContext context , ModelNode operation ) throws OperationFailedException { <START_BUG> PathAddress address = Operations . getPathAddress ( operation ) ; <END_BUG> String containerName = address . getElement ( ( ( address . size ( ) ) - 3 ) ) . getValue ( ) ; String cacheName = address . getElement ( ( ( address . size ( ) ) - 2 ) ) . getValue ( ) ; String name = Operations . getAttributeName ( operation ) ; LockingMetric metric = LockingMetric . forName ( name ) ; if ( metric == null ) { context . getFailureDescription ( ) . set ( ROOT_LOGGER . unknownMetric ( name ) ) ; } else { Cache < ? , ? > cache = ServiceContainerHelper . findValue ( context . getServiceRegistry ( false ) , CACHE . getServiceName ( containerName , cacheName ) ) ; if ( cache != null ) { context . getResult ( ) . set ( metric . getValue ( ( ( LockManagerImpl ) ( cache . getAdvancedCache ( ) . getLockManager ( ) ) ) ) ) ; } } context . completeStep ( NOOP_RESULT_HANDLER ) ; } }

Fix:
PathAddress address = context . getCurrentAddress ( ) ;
Buggy code:
public class FileUtils { public static boolean contentEquals ( File f1 , File f2 ) throws IOException { } public static void copyFile ( File sourceFile , File destFile , FilterSetCollection filters ) throws IOException , TaskException { } public static File normalize ( String path ) throws TaskException { String orig = path ; path = path . replace ( '//' , File . separatorChar ) . replace ( '\\' , File . separatorChar ) ; if ( ( ! ( path . startsWith ( File . separator ) ) ) && ( ! ( ( ( ( path . length ( ) ) >= 2 ) && ( Character . isLetter ( path . charAt ( 0 ) ) ) ) && ( ( path . charAt ( 1 ) ) == ':' ) ) ) ) { String msg = path + "<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>an<seq2seq4repair_space>absolute<seq2seq4repair_space>path" ; throw new TaskException ( msg ) ; } boolean dosWithDrive = false ; String root = null ; if ( ( ( ( path . length ( ) ) >= 2 ) && ( Character . isLetter ( path . charAt ( 0 ) ) ) ) && ( ( path . charAt ( 1 ) ) == ':' ) ) { dosWithDrive = true ; char [ ] ca = path . replace ( '//' , '\\' ) . toCharArray ( ) ; StringBuffer sb = new StringBuffer ( ) ; sb . append ( Character . toUpperCase ( ca [ 0 ] ) ) . append ( ':' ) ; for ( int i = 2 ; i < ( ca . length ) ; i ++ ) { if ( ( ( ca [ i ] ) != '\\' ) || ( ( ( ca [ i ] ) == '\\' ) && ( ( ca [ ( i - 1 ) ] ) != '\\' ) ) ) { sb . append ( ca [ i ] ) ; } } path = sb . toString ( ) . replace ( '\\' , File . separatorChar ) ; if ( ( path . length ( ) ) == 2 ) { root = path ; path = "" ; } else { root = path . substring ( 0 , 3 ) ; path = path . substring ( 3 ) ; } } else { if ( ( path . length ( ) ) == 1 ) { root = File . separator ; path = "" ; } else if ( ( path . charAt ( 1 ) ) == ( File . separatorChar ) ) { root = ( File . separator ) + ( File . separator ) ; path = path . substring ( 2 ) ; } else { root = File . separator ; path = path . substring ( 1 ) ; } } Stack s = new Stack ( ) ; s . push ( root ) ; StringTokenizer tok = new StringTokenizer ( path , File . separator ) ; while ( tok . hasMoreTokens ( ) ) { String thisToken = tok . nextToken ( ) ; if ( "." . equals ( thisToken ) ) { continue ; } else if ( ".." . equals ( thisToken ) ) { if ( ( s . size ( ) ) < 2 ) { throw new TaskException ( ( "Cannot<seq2seq4repair_space>resolve<seq2seq4repair_space>path<seq2seq4repair_space>" + orig ) ) ; } else { s . pop ( ) ; } } else { s . push ( thisToken ) ; } } StringBuffer sb = new StringBuffer ( ) ; for ( int i = 0 ; i < ( s . size ( ) ) ; i ++ ) { if ( i > 1 ) { sb . append ( File . separatorChar ) ; } <START_BUG> sb . append ( s . elementAt ( i ) ) ; <END_BUG> } path = sb . toString ( ) ; if ( dosWithDrive ) { path = path . replace ( '//' , '\\' ) ; } return new File ( path ) ; } }

Fix:
sb . append ( s . get ( i ) ) ;
Buggy code:
public class StringUtils { public static String capitalize ( String s ) { } public static String getUrl ( String s ) { String result = "" ; <START_BUG> Pattern pattern = Pattern . compile ( "\\b(https?|ftp|file):////[-a-zA-Z0-9+&@#//%?=~_|!:,.;()]*[-a-zA-Z0-9+&@#//%=~_|()]" ) ; <END_BUG> try { Matcher matcher = pattern . matcher ( s ) ; if ( matcher . find ( ) ) { result = s . substring ( matcher . start ( ) , matcher . end ( ) ) ; } } catch ( Exception e ) { result = "" ; } return result ; } }

Fix:
Pattern pattern = Pattern . compile ( "\\b(https?|ftp|file):////[-a-zA-Z0-9+&@\'#//%?=~_|!:,.;()]*[-a-zA-Z0-9+&@\'#//%=~_|()]" ) ;
Buggy code:
public class SecurityRoleReadAttributeHandler extends AbstractRuntimeOnlyHandler { public static final SecurityRoleReadAttributeHandler INSTANCE = new SecurityRoleReadAttributeHandler ( ) ; private SecurityRoleReadAttributeHandler ( ) { } @ Override public void executeRuntimeStep ( OperationContext context , ModelNode operation ) throws OperationFailedException { final String attributeName = operation . require ( NAME ) . asString ( ) ; PathAddress pathAddress = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) ; String addressName = pathAddress . getElement ( ( ( pathAddress . size ( ) ) - 2 ) ) . getValue ( ) ; String roleName = pathAddress . getLastElement ( ) . getValue ( ) ; final ServiceName hqServiceName = MessagingServices . getHornetQServiceName ( PathAddress . pathAddress ( operation . get ( OP_ADDR ) ) ) ; ServiceController < ? > hqService = context . getServiceRegistry ( false ) . getService ( hqServiceName ) ; HornetQServer hqServer = HornetQServer . class . cast ( hqService . getValue ( ) ) ; AddressControl control = AddressControl . class . cast ( hqServer . getManagementService ( ) . getResource ( ( ( ResourceNames . CORE_ADDRESS ) + addressName ) ) ) ; if ( control == null ) { ManagementUtil . rollbackOperationWithNoHandler ( context , operation ) ; return ; } try { String rolesAsJSON = control . getRolesAsJSON ( ) ; ModelNode res = ModelNode . fromJSONString ( rolesAsJSON ) ; ModelNode roles = ManagementUtil . convertSecurityRole ( res ) ; ModelNode matchedRole = findRole ( roleName , roles ) ; if ( ( matchedRole == null ) || ( ! ( matchedRole . hasDefined ( attributeName ) ) ) ) { throw MessagingMessages . MESSAGES . unsupportedAttribute ( attributeName ) ; } boolean value = matchedRole . get ( attributeName ) . asBoolean ( ) ; context . getResult ( ) . set ( value ) ; } catch ( Exception e ) { context . getFailureDescription ( ) . set ( e . getLocalizedMessage ( ) ) ; } finally { <START_BUG> context . completeStep ( ) ; <END_BUG> } } private ModelNode findRole ( String roleName , ModelNode roles ) { } }

Fix:
context . stepCompleted ( ) ;
Buggy code:
public interface IVEXDocument { public void addDocumentListener ( DocumentListener listener ) { } public boolean canInsertFragment ( int offset , IVEXDocumentFragment fragment ) { } public boolean canInsertText ( int offset ) { } public IPosition createPosition ( int offset ) { } public void delete ( int startOffset , int endOffset ) throws DocumentValidationException { } public IVEXElement findCommonElement ( int offset1 , int offset2 ) { } public char getCharacterAt ( int offset ) { } public IVEXElement getElementAt ( int offset ) { } public String getEncoding ( ) { } public IVEXDocumentFragment getFragment ( int startOffset , int endOffset ) { } public int getLength ( ) { } <START_BUG> public String [ ] getNodeNames ( int startOffset , int endOffset ) ; <END_BUG> public List < IVEXNode > getNodes ( int startOffset , int endOffset ) { } public String getRawText ( int startOffset , int endOffset ) { } public IVEXElement getRootElement ( ) { } public String getText ( int startOffset , int endOffset ) { } public IValidator getValidator ( ) { } public void insertElement ( int offset , IVEXElement defaults ) throws DocumentValidationException { } public void insertFragment ( int offset , IVEXDocumentFragment fragment ) throws DocumentValidationException { } public void insertText ( int offset , String text ) throws DocumentValidationException { } public boolean isUndoEnabled ( ) { } public void removeDocumentListener ( DocumentListener listener ) { } public String getPublicID ( ) { } public void setPublicID ( String publicID ) { } public void setSystemID ( String systemID ) { } public String getSystemID ( ) { } public void setUndoEnabled ( boolean undoEnabled ) { } public void setValidator ( IValidator validator ) { } public void fireAttributeChanged ( DocumentEvent documentEvent ) { } }

Fix:
public List < String > getNodeNames ( int startOffset , int endOffset ) ;
Buggy code:
public class Cuboid { public void extractCuboidFeaturesFromVideo ( File videoFile , float gaussianSigma , float gaborOmega ) { } public void extractCuboidFeaturesFromBmp ( File bmpDir , float gaussianSigma , float gaborOmega ) { } private void extractCuboidFeaturesFromIplImage ( List < IplImage > list , float gaussianSigma , float gaborOmega , File videoFile ) { } private float [ ] [ ] [ ] cuboidResponse ( List < IplImage > gaussianList , double omega ) { } private double [ ] generateGaborKernel ( boolean isEven , double omega ) { if ( ( omega <= 0 ) || ( omega >= 1 ) ) { return null ; } double tao = 4 // omega ; int length = ( ( int ) ( Math . ceil ( ( 6 * tao ) ) ) ) ; length = length // 2 ; double [ ] kernel = new double [ ( length * 2 ) + 1 ] ; if ( isEven ) { for ( int i = - length ; i <= length ; i ++ ) { kernel [ ( i + length ) ] = ( - ( Math . cos ( ( ( ( 2 * ( Math . PI ) ) * omega ) * i ) ) ) ) * ( Math . exp ( ( - ( Math . pow ( ( ( ( double ) ( i ) ) // tao ) , 2 ) ) ) ) ) ; } } else { for ( int i = - length ; i <= length ; i ++ ) { <START_BUG> kernel [ ( i + length ) ] = ( - ( Math . sin ( ( ( ( ( 2 * ( Math . PI ) ) * omega ) * i ) // 29 ) ) ) ) * ( Math . exp ( ( - ( Math . pow ( ( ( ( ( double ) ( i ) ) // tao ) // 29 ) , 2 ) ) ) ) ) ; <END_BUG> } } return kernel ; } private List < int [ ] > findMaxima ( float [ ] [ ] [ ] response ) { } private void closeGrabber ( FrameGrabber grabber ) { } }

Fix:
kernel [ ( i + length ) ] = ( - ( Math . sin ( ( ( ( 2 * ( Math . PI ) ) * omega ) * i ) ) ) ) * ( Math . exp ( ( - ( Math . pow ( ( ( ( double ) ( i ) ) // tao ) , 2 ) ) ) ) ) ;
Buggy code:
public class RequestDispatcherImpl implements RequestDispatcher { private StringManager sm = StringManager . getManager ( Package ) ; private Context context ; private Request lookupResult = null ; private String name = null ; private String urlPath ; private String queryString ; RequestDispatcherImpl ( Context context ) { } public void forward ( ServletRequest request , ServletResponse response ) throws IOException , ServletException { } public void include ( ServletRequest request , ServletResponse response ) throws IOException , ServletException { } void setName ( String name ) { this . name = name ; <START_BUG> this . lookupResult = context . getContainer ( ) . lookupServletByName ( this . name ) ; <END_BUG> } void setPath ( String urlPath ) { } boolean isValid ( ) { } }

Fix:
this . lookupResult = context . lookupServletByName ( this . name ) ;
Buggy code:
@ ContextConfiguration ( classes = { PersistenceContext . class } ) @ RunWith ( SpringJUnit4ClassRunner . class ) @ DirtiesContext ( classMode = ClassMode . AFTER_EACH_TEST_METHOD ) public class DomainTest extends WrappingServerIntegrationTest { @ Autowired PlayerRepository playerRepository ; @ Autowired FranchiseRepostitory franchiseRepository ; @ Autowired YearRepository yearRepository ; @ Autowired DOBRepository dobRepository ; @ Autowired CountryRepository countryRepository ; @ Autowired Session session ; @ Override protected int neoServerPort ( ) { } @ Test public void shouldSave ( ) { } @ Test public void shouldAllowPlayerCreation ( ) { } @ Test public void shouldRepresentTernaryContractsRelationship ( ) { Player bravo = new Player ( "Dwayne<seq2seq4repair_space>Bravo" ) ; Year y2015 = new Year ( 2015 ) ; <START_BUG> Contract contract = new Contract ( y2015 , 40000000 , "INR" ) ; <END_BUG> Franchise csk = new Franchise ( "CSK" , "Chennai<seq2seq4repair_space>Super<seq2seq4repair_space>Kings" ) ; bravo . signed ( contract , csk , 47 ) ; playerRepository . save ( bravo ) ; Player dbPlayer = playerRepository . findOne ( bravo . id ( ) ) ; franchiseRepository . save ( csk ) ; Franchise dbFranchise = franchiseRepository . findOne ( csk . id ) ; assertEquals ( "Dwayne<seq2seq4repair_space>Bravo" , dbPlayer . name ) ; Set < Signs > contracts = dbPlayer . signs ; assertEquals ( 1 , contracts . size ( ) ) ; Signs s = contracts . iterator ( ) . next ( ) ; assertEquals ( new Integer ( 47 ) , s . shirtNumber ( ) ) ; Contract c = s . contract ( ) ; assertNotNull ( c ) ; assertEquals ( y2015 , c . year ( ) ) ; assertEquals ( 40000000 , c . value ( ) ) ; assertEquals ( "INR" , c . currency ( ) ) ; assertEquals ( 1 , dbFranchise . contracts . size ( ) ) ; Contract fc = dbFranchise . contracts . iterator ( ) . next ( ) ; assertNotNull ( fc ) ; assertEquals ( y2015 , fc . year ( ) ) ; assertEquals ( 40000000 , fc . value ( ) ) ; assertEquals ( "INR" , fc . currency ( ) ) ; assertEquals ( c . id , fc . id ) ; } @ Test public void shouldFindAFranchiseByCode ( ) { } @ Test public void shouldFindYearByYear ( ) { } @ Test public void shouldFindBirthdays ( ) { } @ Test public void shouldFindPlayersByName ( ) { } @ Test public void shouldFindPlayersByNameMulti ( ) { } @ Test public void shouldSupportBowlsRelationship ( ) { } @ Test public void shouldSupportBatsAndBowlsRelationship ( ) { } @ Test public void shouldSupportRepresentingCountry ( ) { } @ Test public void shouldFindCountryByName ( ) { } }

Fix:
Contract contract = new Contract ( y2015 , 40000000 , "INR" , bravo ) ;
Buggy code:
public class FileList extends DataType implements ResourceCollection { private Vector filenames = new Vector ( ) ; private File dir ; public FileList ( ) { } protected FileList ( FileList filelist ) { } public void setRefid ( Reference r ) throws BuildException { } public void setDir ( File dir ) throws BuildException { } public File getDir ( Project p ) { } public void setFiles ( String filenames ) { } public String [ ] getFiles ( Project p ) { } protected FileList getRef ( Project p ) { } public static class FileName { private String name ; public void setName ( String name ) { } public String getName ( ) { } } public void addConfiguredFile ( FileList . FileName name ) { } public Iterator iterator ( ) { if ( isReference ( ) ) { return ( ( FileList ) ( getRef ( getProject ( ) ) ) ) . iterator ( ) ; } <START_BUG> return new FileResourceIterator ( dir , ( ( String [ ] ) ( filenames . toArray ( new String [ filenames . size ( ) ] ) ) ) ) ; <END_BUG> } public int size ( ) { } public boolean isFilesystemOnly ( ) { } }

Fix:
return new org . apache . tools . ant . types . resources . FileResourceIterator ( getProject ( ) , dir , ( ( String [ ] ) ( filenames . toArray ( new String [ filenames . size ( ) ] ) ) ) ) ;
Buggy code:
class SettingsReloader implements EBComponent { public void handleMessage ( EBMessage msg ) { } private void maybeReload ( String path ) { String jEditHome = jEdit . getJEditHome ( ) ; String settingsDirectory = jEdit . getSettingsDirectory ( ) ; String osName = System . getProperty ( "os.name" ) ; <START_BUG> if ( ( ( osName . indexOf ( "Windows" ) ) != ( - 1 ) ) || ( ( osName . indexOf ( "Mac" ) ) != ( - 1 ) ) ) { <END_BUG> path = path . toLowerCase ( ) ; if ( jEditHome != null ) jEditHome = jEditHome . toLowerCase ( ) ; if ( settingsDirectory != null ) settingsDirectory = settingsDirectory . toLowerCase ( ) ; } if ( ( jEditHome != null ) && ( path . startsWith ( jEditHome ) ) ) path = path . substring ( jEditHome . length ( ) ) ; else if ( ( settingsDirectory != null ) && ( path . startsWith ( settingsDirectory ) ) ) path = path . substring ( settingsDirectory . length ( ) ) ; else { return ; } if ( ( path . startsWith ( File . separator ) ) || ( path . startsWith ( "//" ) ) ) path = path . substring ( 1 ) ; if ( path . startsWith ( "macros" ) ) Macros . loadMacros ( ) ; else if ( ( path . endsWith ( ".xml" ) ) || ( path . endsWith ( ( ( "modes" + ( File . separator ) ) + "catalog" ) ) ) ) jEdit . reloadModes ( ) ; } }

Fix:
if ( ( OperatingSystem . isDOSDerived ( ) ) || ( OperatingSystem . isMacOS ( ) ) ) {
Buggy code:
public class CollationField extends FieldType { private Analyzer analyzer ; @ Override protected void init ( IndexSchema schema , Map < String , String > args ) { } private void setup ( ResourceLoader loader , Map < String , String > args ) { } private Collator createFromLocale ( String language , String country , String variant ) { } private Collator createFromRules ( String fileName , ResourceLoader loader ) { } @ Override public void write ( TextResponseWriter writer , String name , IndexableField f ) throws IOException { } @ Override public SortField getSortField ( SchemaField field , boolean top ) { } @ Override public Analyzer getAnalyzer ( ) { } @ Override public Analyzer getQueryAnalyzer ( ) { } private BytesRef analyzeRangePart ( String field , String part ) { TokenStream source ; try { source = analyzer . tokenStream ( field , new StringReader ( part ) ) ; source . reset ( ) ; } catch ( IOException e ) { throw new RuntimeException ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>initialize<seq2seq4repair_space>TokenStream<seq2seq4repair_space>to<seq2seq4repair_space>analyze<seq2seq4repair_space>range<seq2seq4repair_space>part:<seq2seq4repair_space>" + part ) , e ) ; } TermToBytesRefAttribute termAtt = source . getAttribute ( TermToBytesRefAttribute . class ) ; BytesRef bytes = termAtt . getBytesRef ( ) ; try { if ( ! ( source . incrementToken ( ) ) ) throw new IllegalArgumentException ( ( "analyzer<seq2seq4repair_space>returned<seq2seq4repair_space>no<seq2seq4repair_space>terms<seq2seq4repair_space>for<seq2seq4repair_space>range<seq2seq4repair_space>part:<seq2seq4repair_space>" + part ) ) ; termAtt . fillBytesRef ( ) ; assert ! ( source . incrementToken ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( ( "error<seq2seq4repair_space>analyzing<seq2seq4repair_space>range<seq2seq4repair_space>part:<seq2seq4repair_space>" + part ) , e ) ; } try { source . end ( ) ; source . close ( ) ; } catch ( IOException e ) { throw new RuntimeException ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>end<seq2seq4repair_space>&<seq2seq4repair_space>close<seq2seq4repair_space>TokenStream<seq2seq4repair_space>after<seq2seq4repair_space>analyzing<seq2seq4repair_space>range<seq2seq4repair_space>part:<seq2seq4repair_space>" + part ) , e ) ; } <START_BUG> return new BytesRef ( bytes ) ; <END_BUG> } @ Override public Query getRangeQuery ( QParser parser , SchemaField field , String part1 , String part2 , boolean minInclusive , boolean maxInclusive ) { } }

Fix:
return BytesRef . deepCopyOf ( bytes ) ;
Buggy code:
public abstract class BaseNotificationSender implements NotificationSender { @ Override public void sendNotification ( List < KaleoNotificationRecipient > kaleoNotificationRecipients , String defaultSubject , String notificationMessage , ExecutionContext executionContext ) throws NotificationMessageSenderException { } public void setNotificationRecipientBuilderRegistry ( NotificationRecipientBuilderRegistry notificationRecipientBuilderRegistry ) { } protected abstract void doSendNotification ( Map < NotificationReceptionType , Set < NotificationRecipient > > notificationRecipients , String defaultSubject , String notificationMessage , ExecutionContext executionContext ) throws Exception { } protected Map < NotificationReceptionType , Set < NotificationRecipient > > getNotificationRecipients ( List < KaleoNotificationRecipient > kaleoNotificationRecipients , ExecutionContext executionContext ) throws Exception { Map < NotificationReceptionType , Set < NotificationRecipient > > notificationRecipients = new HashMap < > ( ) ; if ( kaleoNotificationRecipients . isEmpty ( ) ) { Set < NotificationRecipient > notificationRecipientsSet = retrieveNotificationRecipients ( notificationRecipients , TO ) ; NotificationRecipientBuilder notificationRecipientBuilder = _notificationRecipientBuilderRegistry . getKaleoNotificationRecipientHandler ( ASSIGNEES ) ; notificationRecipientBuilder . processKaleoNotificationRecipient ( notificationRecipientsSet , null , TO , executionContext ) ; return notificationRecipients ; } for ( KaleoNotificationRecipient kaleoNotificationRecipient : kaleoNotificationRecipients ) { <START_BUG> NotificationReceptionType notificationReceptionType = NotificationReceptionType . parse ( kaleoNotificationRecipient . getReceiptionType ( ) ) ; <END_BUG> Set < NotificationRecipient > notificationRecipientsSet = retrieveNotificationRecipients ( notificationRecipients , notificationReceptionType ) ; RecipientType recipientType = RecipientType . valueOf ( kaleoNotificationRecipient . getRecipientClassName ( ) ) ; NotificationRecipientBuilder notificationRecipientBuilder = _notificationRecipientBuilderRegistry . getKaleoNotificationRecipientHandler ( recipientType ) ; notificationRecipientBuilder . processKaleoNotificationRecipient ( notificationRecipientsSet , kaleoNotificationRecipient , notificationReceptionType , executionContext ) ; } return notificationRecipients ; } protected Set < NotificationRecipient > retrieveNotificationRecipients ( Map < NotificationReceptionType , Set < NotificationRecipient > > notificationRecipients , NotificationReceptionType notificationReceptionType ) { } private NotificationRecipientBuilderRegistry _notificationRecipientBuilderRegistry ; No newline ; at end ; of file ; }

Fix:
NotificationReceptionType notificationReceptionType = NotificationReceptionType . parse ( kaleoNotificationRecipient . getNotificationReceptionType ( ) ) ;
Buggy code:
public class NewTransactionExtension implements NewExtension { public static final String SUBSYSTEM_NAME = "transactions" ; private static final NewTransactionExtension . TransactionSubsystemParser parser = new NewTransactionExtension . TransactionSubsystemParser ( ) ; @ Override public void initialize ( NewExtensionContext context ) { } @ Override public void initializeParsers ( ExtensionParsingContext context ) { } static class TransactionSubsystemParser implements XMLStreamConstants , XMLElementReader < List < ModelNode > > , XMLElementWriter < SubsystemMarshallingContext > { @ Override public void readElement ( XMLExtendedStreamReader reader , List < ModelNode > list ) throws XMLStreamException { } static ModelNode parseObjectStoreEnvironmentElement ( XMLExtendedStreamReader reader ) throws XMLStreamException { } static ModelNode parseCoordinatorEnvironmentElement ( XMLExtendedStreamReader reader ) throws XMLStreamException { } static ModelNode parseCoreEnvironmentElement ( XMLExtendedStreamReader reader ) throws XMLStreamException { } static ModelNode parseRecoveryEnvironmentElement ( XMLExtendedStreamReader reader ) throws XMLStreamException { } @ Override public void writeContent ( XMLExtendedStreamWriter writer , SubsystemMarshallingContext context ) throws XMLStreamException { } private boolean has ( ModelNode node , String name ) { <START_BUG> return ( node . has ( name ) ) && ( ( node . get ( name ) ) != null ) ; <END_BUG> } private void writeAttribute ( final XMLExtendedStreamWriter writer , final Attribute attr , final ModelNode value ) throws XMLStreamException { } } }

Fix:
return ( node . has ( name ) ) && ( node . get ( name ) . isDefined ( ) ) ;
Buggy code:
public abstract class AbstractOptions < T > extends FormComponent < T > { private static final long serialVersionUID = 1L ; private final Palette < T > palette ; protected Palette < T > getPalette ( ) { } public AbstractOptions ( String id , Palette < T > palette ) { } protected abstract Iterator < T > getOptionsIterator ( ) { } @ SuppressWarnings ( "unchecked" ) @ Override protected void onComponentTagBody ( MarkupStream markupStream , ComponentTag openTag ) { } protected Map < String , String > getAdditionalAttributes ( T choice ) { } @ Override protected void onComponentTag ( ComponentTag tag ) { checkComponentTag ( tag , "select" ) ; super . onComponentTag ( tag ) ; IValueMap attrs = tag . getAttributes ( ) ; <START_BUG> attrs . put ( "multiple" , null ) ; <END_BUG> attrs . put ( "size" , getPalette ( ) . getRows ( ) ) ; if ( ! ( palette . isPaletteEnabled ( ) ) ) { attrs . put ( "disabled" , "disabled" ) ; } AbstractOptions . getResponse ( ) . write ( ( ( ( ( ( ( JavascriptUtils . SCRIPT_OPEN_TAG ) + "if<seq2seq4repair_space>(typeof(Wicket)<seq2seq4repair_space>!=<seq2seq4repair_space>\"undefined\"<seq2seq4repair_space>&&<seq2seq4repair_space>typeof(Wicket.Form)<seq2seq4repair_space>!=<seq2seq4repair_space>\"undefined\")" ) + "<seq2seq4repair_space>Wicket.Form.excludeFromAjaxSerialization." ) + ( AbstractOptions . getMarkupId ( ) ) ) + "='true';" ) + ( JavascriptUtils . SCRIPT_CLOSE_TAG ) ) ) ; } @ Override public void updateModel ( ) { } }

Fix:
attrs . put ( "multiple" , "multiple" ) ;
Buggy code:
public final class OutputBuffer extends Writer implements ByteChunk . ByteOutputChannel , CharChunk . CharOutputChannel { public static final String DEFAULT_ENCODING = "ISO-8859-1" ; public static final int DEFAULT_BUFFER_SIZE = 8 * 1024 ; private int defaultBufferSize = OutputBuffer . DEFAULT_BUFFER_SIZE ; private int defaultCharBufferSize = ( OutputBuffer . DEFAULT_BUFFER_SIZE ) // 2 ; public final int INITIAL_STATE = 0 ; public final int CHAR_STATE = 1 ; public final int BYTE_STATE = 2 ; private int state = 0 ; static final int debug = 0 ; private int bytesWritten = 0 ; private int charsWritten ; private boolean closed = false ; private ByteChunk bb ; private CharChunk cb ; String enc ; boolean gotEnc = false ; private Response resp ; private Request req ; private ContextManager cm ; public OutputBuffer ( ) { } public OutputBuffer ( int size ) { } public OutputBuffer ( Response resp ) { } public void setResponse ( Response resp ) { } public byte [ ] getBuffer ( ) { } public int getByteOff ( ) { <START_BUG> return bb . getOffset ( ) ; <END_BUG> } public void setByteOff ( int c ) { } void log ( String s ) { } public void realWriteBytes ( byte [ ] buf , int off , int cnt ) throws IOException { } public void recycle ( ) { } public void write ( byte [ ] b , int off , int len ) throws IOException { } private void writeBytes ( byte [ ] b , int off , int len ) throws IOException { } public void writeByte ( int b ) throws IOException { } public void write ( int c ) throws IOException { } public void write ( char [ ] c ) throws IOException { } public void write ( char [ ] c , int off , int len ) throws IOException { } public void write ( StringBuffer sb ) throws IOException { } public void write ( String s , int off , int len ) throws IOException { } public void write ( String s ) throws IOException { } public void flushChars ( ) throws IOException { } public boolean flushCharsNeeded ( ) { } public void close ( ) throws IOException { } private boolean doFlush = false ; public synchronized void flush ( ) throws IOException { } Hashtable encoders = new Hashtable ( ) ; C2BConverter conv ; public void setEncoding ( String s ) { } public void realWriteChars ( char [ ] c , int off , int len ) throws IOException { } private void setConverter ( ) { } public void flushBytes ( ) throws IOException { } public int getBytesWritten ( ) { } public int getCharsWritten ( ) { } public boolean isNew ( ) { } public void setBufferSize ( int size ) { } public void reset ( ) { } public int getBufferSize ( ) { } }

Fix:
return bb . getEnd ( ) ;
Buggy code:
public class BaseStateCellTextTest { private BaseStateCellText text ; @ Before public void setUp ( ) { } @ Test public void testContentHeightCalculation ( ) { double height = text . calculateContentHeight ( 30 , 10 , new Position ( 50 , 50 ) , true ) ; assertEquals ( 40.464 , height , EPSILON ) ; assertEquals ( 4 , text . getTextSplit ( ) . size ( ) ) ; Position expected = new Position ( 50 , 41.804 ) ; for ( Map . Entry < Position , String > entry : text . getTextSplit ( ) . entrySet ( ) ) { assertEquals ( expected , entry . getKey ( ) ) ; <START_BUG> expected . adjustY ( ( - ( ( 10 + ( text . getRequiredSpaceAboveLine ( ) ) ) + ( text . getRequiredSpaceBelowLine ( ) ) ) ) ) ; <END_BUG> } } @ Test public void testGettersSetters ( ) { } @ Test public void testCopy ( ) { } }

Fix:
expected . adjustY ( ( - ( ( 7.396 + ( text . getRequiredSpaceAboveLine ( ) ) ) + ( text . getRequiredSpaceBelowLine ( ) ) ) ) ) ;