nus-yam/ex-repair huggingface dataset:
Buggy code:
public class XQDTSemanticBuilder implements IBuildParticipant { public void build ( IBuildContext context ) throws CoreException { } private void createMarker ( ISourceModule module , SemanticCheckError error ) throws CoreException { } private boolean isInBuildpath ( ISourceModule source ) throws ModelException { IScriptProject project = source . getScriptProject ( ) ; IBuildpathEntry [ ] entries = project . getRawBuildpath ( ) ; for ( IBuildpathEntry entry : entries ) { <START_BUG> if ( entry . getPath ( ) . equals ( source . getParent ( ) . getPath ( ) ) ) { <END_BUG> return true ; } } return false ; } public List < SemanticCheckError > check ( ISourceModule module ) throws CoreException { } }

Fix:
if ( entry . getPath ( ) . isPrefixOf ( source . getPath ( ) ) ) {
Buggy code:
final class PhysicalRowIdManager { private final RecordFile file ; private final PageManager pageman ; final FreePhysicalRowIdPageManager freeman ; private static final short DATA_PER_PAGE = ( ( short ) ( ( BLOCK_SIZE ) - ( Magic . DATA_PAGE_O_DATA ) ) ) ; private long cachedLastAllocatedRecordPage = Long . MIN_VALUE ; private short cachedLastAllocatedRecordOffset = Short . MIN_VALUE ; PhysicalRowIdManager ( RecordFile file , PageManager pageManager , FreePhysicalRowIdPageManager freeman ) throws IOException { } long insert ( byte [ ] data , int start , int length ) throws IOException { } long update ( long rowid , byte [ ] data , int start , int length ) throws IOException { } void fetch ( DataInputOutput out , long rowid ) throws IOException { } private long alloc ( int size ) throws IOException { } private long allocNew ( int size , long start ) throws IOException { } void free ( final long id ) throws IOException { final BlockIo curBlock = file . get ( Location . getBlock ( id ) ) ; final short offset = Location . getOffset ( id ) ; final int size = RecordHeader . getAvailableSize ( curBlock , offset ) ; if ( size > ( PhysicalRowIdManager . DATA_PER_PAGE ) ) { } RecordHeader . setCurrentSize ( curBlock , offset , 0 ) ; <START_BUG> file . release ( Location . getBlock ( id ) , true ) ; <END_BUG> freeman . put ( id , size ) ; } private void write ( long rowid , byte [ ] data , int start , int length ) throws IOException { } void rollback ( ) throws IOException { } void commit ( ) throws IOException { } }

Fix:
file . release ( curBlock ) ;
Buggy code:
public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { private static final boolean debugGL = true ; private static final String VERTEX_SHADER_TEXT = "#version<seq2seq4repair_space>150<seq2seq4repair_space>\n" + ( ( ( ( ( "<seq2seq4repair_space>\n" + "out<seq2seq4repair_space>vec4<seq2seq4repair_space>Position;<seq2seq4repair_space>\n" ) + "<seq2seq4repair_space>\n" ) + "void<seq2seq4repair_space>main()<seq2seq4repair_space>{<seq2seq4repair_space>\n" ) + "<seq2seq4repair_space>Position<seq2seq4repair_space>=<seq2seq4repair_space>vec4(1.0,<seq2seq4repair_space>1.0,<seq2seq4repair_space>1.0,<seq2seq4repair_space>1.0);<seq2seq4repair_space>\n" ) + "}<seq2seq4repair_space>\n" ) ; class MyShader { int shaderProgram ; int vertShader ; MyShader ( int shaderProgram , int vertShader ) { } } private TestTransformFeedbackVaryingsBug407NEWT . MyShader attachShader ( GL3 gl , String text , int type ) { } private void releaseShader ( GL3 gl , TestTransformFeedbackVaryingsBug407NEWT . MyShader myShader ) { } static final String glps = GLProfile . GL3 ; private WindowContext prepareTest ( ) throws InterruptedException , GLException { <START_BUG> final NEWTGLContext . WindowContext winctx = NEWTGLContext . createOnscreenWindow ( GLProfile . getDefault ( ) , 480 , 480 , TestTransformFeedbackVaryingsBug407NEWT . debugGL ) ; <END_BUG> if ( ! ( winctx . context . getGL ( ) . isGL3 ( ) ) ) { System . err . println ( "GL3<seq2seq4repair_space>not<seq2seq4repair_space>available" ) ; cleanupTest ( winctx ) ; return null ; } Assert . assertEquals ( GL_NO_ERROR , winctx . context . getGL ( ) . glGetError ( ) ) ; return winctx ; } private void cleanupTest ( NEWTGLContext . WindowContext winctx ) { } @ Test ( timeout = 60000 ) public void testGlTransformFeedbackVaryings_WhenVarNameOK ( ) throws InterruptedException , GLException { } @ Test ( timeout = 60000 ) public void testGlTransformFeedbackVaryings_WhenVarNameWrong ( ) throws InterruptedException , GLException { } public static void main ( String [ ] args ) throws IOException { } }

Fix:
final NEWTGLContext . WindowContext winctx = NEWTGLContext . createOnscreenWindow ( GLProfile . getMaxProgrammable ( ) , 480 , 480 , TestTransformFeedbackVaryingsBug407NEWT . debugGL ) ;
Buggy code:
public class jnamed { static final int FLAG_DNSSECOK = 1 ; static final int FLAG_SIGONLY = 2 ; Map caches ; Map znames ; Map TSIGs ; public jnamed ( String conffile ) throws IOException { } public void addPrimaryZone ( String zname , String zonefile ) throws IOException { } public void addSecondaryZone ( String zone , String remote ) throws IOException { } public void addTSIG ( String namestr , String key ) throws IOException { } public Cache getCache ( short dclass ) { } public Zone findBestZone ( Name name ) { } public RRset findExactMatch ( Name name , short type , short dclass , boolean glue ) { } void addRRset ( Name name , Message response , RRset rrset , byte section , int flags ) { } private final void addSOA ( Message response , Zone zone ) { } private final void addNS ( Message response , Zone zone , int flags ) { } private final void addCacheNS ( Message response , Cache cache , Name name ) { } private void addGlue ( Message response , Name name , int flags ) { } private void addAdditional2 ( Message response , int section , int flags ) { } private final void addAdditional ( Message response , int flags ) { } byte addAnswer ( Message response , Name name , short type , short dclass , int iterations , int flags ) { } TSIG findTSIG ( Name name ) { } byte [ ] doAXFR ( Name name , Message query , TSIG tsig , TSIGRecord qtsig , Socket s ) { Zone zone = ( ( Zone ) ( znames . get ( name ) ) ) ; boolean first = true ; if ( zone == null ) return errorMessage ( query , REFUSED ) ; Iterator it = zone . AXFR ( ) ; try { DataOutputStream dataOut ; dataOut = new DataOutputStream ( s . getOutputStream ( ) ) ; int id = query . getHeader ( ) . getID ( ) ; while ( it . hasNext ( ) ) { RRset rrset = ( ( RRset ) ( it . next ( ) ) ) ; Message response = new Message ( id ) ; Header header = response . getHeader ( ) ; header . setFlag ( QR ) ; header . setFlag ( AA ) ; addRRset ( rrset . getName ( ) , response , rrset , ANSWER , jnamed . FLAG_DNSSECOK ) ; if ( tsig != null ) { <START_BUG> tsig . applyAXFR ( response , qtsig , first ) ; <END_BUG> qtsig = response . getTSIG ( ) ; } first = false ; byte [ ] out = response . toWire ( ) ; dataOut . writeShort ( out . length ) ; dataOut . write ( out ) ; } } catch ( IOException ex ) { System . out . println ( "AXFR<seq2seq4repair_space>failed" ) ; } try { s . close ( ) ; } catch ( IOException ex ) { } return null ; } byte [ ] generateReply ( Message query , byte [ ] in , int length , Socket s ) throws IOException { } byte [ ] buildErrorMessage ( Header header , short rcode , Record question ) { } public byte [ ] formerrMessage ( byte [ ] in ) { } public byte [ ] errorMessage ( Message query , short rcode ) { } public void serveTCP ( InetAddress addr , short port ) { } public void serveUDP ( InetAddress addr , short port ) { } public void addTCP ( final InetAddress addr , final short port ) { } public void addUDP ( final InetAddress addr , final short port ) { } public static void main ( String [ ] args ) { } }

Fix:
tsig . applyStream ( response , qtsig , first ) ;
Buggy code:
public class CacheMetricsHandler extends AbstractRuntimeOnlyHandler { @ Override protected void executeRuntimeStep ( OperationContext context , ModelNode operation ) { <START_BUG> PathAddress address = context . getCurrentAddress ( ) ; <END_BUG> String containerName = address . getElement ( ( ( address . size ( ) ) - 2 ) ) . getValue ( ) ; String cacheName = address . getElement ( ( ( address . size ( ) ) - 1 ) ) . getValue ( ) ; String name = Operations . getAttributeName ( operation ) ; CacheMetric metric = CacheMetric . 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 ( cache ) ) ; } } context . completeStep ( NOOP_RESULT_HANDLER ) ; } }

Fix:
PathAddress address = Operations . getPathAddress ( operation ) ;
Buggy code:
public class HelpMenuView { private static final String [ ] [ ] menuItems = new String [ ] [ ] { new String [ ] { "A" , "Actions<seq2seq4repair_space>you<seq2seq4repair_space>can<seq2seq4repair_space>do." } , new String [ ] { "B" , "How<seq2seq4repair_space>the<seq2seq4repair_space>Board<seq2seq4repair_space>Works." } , new String [ ] { "C" , "How<seq2seq4repair_space>Cells<seq2seq4repair_space>Work." } , new String [ ] { "G" , "Object<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>Game." } , new String [ ] { "P" , "The<seq2seq4repair_space>Players" } , new String [ ] { "Q" , "Quit<seq2seq4repair_space>Help" } } ; private HelpMenuControl helpMenuControl = new HelpMenuControl ( ) ; public HelpMenuView ( ) { } public void getInput ( ) { String command ; Scanner inFile = new Scanner ( System . in ) ; do { this . display ( ) ; command = inFile . nextLine ( ) ; command = command . trim ( ) . toUpperCase ( ) ; switch ( command ) { case "A" : this . helpMenuControl . displayActionHelp ( ) ; break ; case "B" : this . helpMenuControl . displayBoardHelp ( ) ; break ; case "C" : this . helpMenuControl . displayCellHelp ( ) ; break ; case "G" : this . helpMenuControl . displayGameHelp ( ) ; break ; case "P" : this . helpMenuControl . displayPlayerHelp ( ) ; break ; case "Q" : break ; default : <START_BUG> new MinesweeperError ( ) . displayError ( "Invalid<seq2seq4repair_space>command.<seq2seq4repair_space>Please<seq2seq4repair_space>enter<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>command." ) ; <END_BUG> continue ; } } while ( ! ( command . equals ( "Q" ) ) ) ; return ; } public final void display ( ) { } }

Fix:
new MinesweeperError ( ) . displayError ( ) ;
Buggy code:
public final class ActiveShellExpression extends Expression { public static final int SOURCES = ( ISources . ACTIVE_SHELL ) | ( ISources . ACTIVE_WORKBENCH_WINDOW ) ; private final Shell activeShell ; public ActiveShellExpression ( final Shell activeShell ) { } public final EvaluationResult evaluate ( final IEvaluationContext context ) { if ( ( activeShell ) != null ) { Object value = context . getVariable ( ACTIVE_SHELL_NAME ) ; if ( ! ( activeShell . equals ( value ) ) ) { <START_BUG> value = context . getVariable ( ACTIVE_WORKBENCH_WINDOW_NAME ) ; <END_BUG> if ( ! ( activeShell . equals ( value ) ) ) { return EvaluationResult . FALSE ; } } } return EvaluationResult . TRUE ; } public final void collectExpressionInfo ( final ExpressionInfo info ) { } public final String toString ( ) { } }

Fix:
value = context . getVariable ( ACTIVE_WORKBENCH_WINDOW_SHELL_NAME ) ;
Buggy code:
public class AssumptionTest { public static class HasFailingAssumption { @ Test public void assumptionsFail ( ) { } } @ Test public void failedAssumptionsMeanIgnored ( ) { Result result = JUnitCore . runClasses ( AssumptionTest . HasFailingAssumption . class ) ; Assert . assertThat ( result . getRunCount ( ) , is ( 0 ) ) ; <START_BUG> Assert . assertThat ( result . getFailedAssumptionCount ( ) , is ( 1 ) ) ; <END_BUG> Assert . assertThat ( result . getFailureCount ( ) , is ( 0 ) ) ; } @ Test public void failingAssumptionsPrint ( ) { } public static class HasPassingAssumption { @ Test public void assumptionsFail ( ) { } } @ Test public void passingAssumptionsScootThrough ( ) { } @ Test ( expected = AssumptionViolatedException . class ) public void assumeThatWorks ( ) { } @ Test public void assumeThatPasses ( ) { } @ Test public void assumeThatPassesOnStrings ( ) { } @ Test ( expected = AssumptionViolatedException . class ) public void assumeNotNullThrowsException ( ) { } @ Test public void assumeNotNullPasses ( ) { } @ Test public void assumeNotNullIncludesParameterList ( ) { } @ Test public void assumeNoExceptionThrows ( ) { } private void assertCompletesNormally ( ) { } @ Test ( expected = AssumptionViolatedException . class ) public void assumeTrueWorks ( ) { } public static class HasFailingAssumeInBefore { @ Before public void checkForSomethingThatIsntThere ( ) { } @ Test public void failing ( ) { } } @ Test public void failingAssumptionInBeforePreventsTestRun ( ) { } public static class HasFailingAssumeInBeforeClass { @ BeforeClass public static void checkForSomethingThatIsntThere ( ) { } @ Test public void failing ( ) { } } @ Test public void failingAssumptionInBeforeClassIgnoresClass ( ) { } public static class AssumptionFailureInConstructor { public AssumptionFailureInConstructor ( ) { } @ Test public void shouldFail ( ) { } } @ Test public void failingAssumptionInConstructorIgnoresClass ( ) { } }

Fix:
Assert . assertThat ( result . getInvalidAssumptionCount ( ) , is ( 1 ) ) ;
Buggy code:
public class CreateFilterOnToAction extends FrameAction implements SelectionListener { public CreateFilterOnToAction ( AbstractFrameController frameController ) { } public void actionPerformed ( ActionEvent evt ) { <START_BUG> FolderCommandReference [ ] r = ( ( org . columba . mail . gui . frame . AbstractMailFrameController ) ( getFrameController ( ) ) ) . getTableSelection ( ) ; <END_BUG> CreateFilterOnMessageCommand c = new CreateFilterOnMessageCommand ( r , CreateFilterOnMessageCommand . FILTER_ON_TO ) ; processor . addOp ( c ) ; } public void selectionChanged ( SelectionChangedEvent e ) { } }

Fix:
FolderCommandReference [ ] r = ( ( org . columba . mail . gui . frame . AbstractMailFrameController ) ( getFrameMediator ( ) ) ) . getTableSelection ( ) ;
Buggy code:
public abstract class ListBaseAdapter < T > extends BaseAdapter { protected LayoutInflater mInflater ; protected List < T > data = new ArrayList < T > ( ) ; protected ListView mListView ; protected Activity mContext ; public ListBaseAdapter ( ListView mListView ) { } public synchronized void setData ( List < T > data ) { } public synchronized void setItem ( int location , T item ) { } public synchronized void addItem ( T item ) { } public synchronized void addItem ( int location , T item ) { } public synchronized void addAll ( List < T > items ) { } public synchronized void addAll ( int location , List < T > items ) { } public synchronized void removeItem ( T item ) { } public synchronized void removeItem ( int location ) { } public synchronized void removeAll ( List < T > items ) { <START_BUG> this . data . remove ( items ) ; <END_BUG> ListBaseAdapter . notifyDataSetChanged ( ) ; } public void removeAll ( ) { } public synchronized void swap ( int index1 , int index2 ) { } public SparseArray < View > getItemSparseArray ( int position ) { } public View getItemView ( int position ) { } public View getItemViewById ( int position , int id ) { } @ Override public int getCount ( ) { } @ Override public T getItem ( int position ) { } @ Override public long getItemId ( int position ) { } }

Fix:
this . data . removeAll ( items ) ;
Buggy code:
public final class AllTests { private static transient Logger log = LoggingManager . getLoggerForClass ( ) ; private AllTests ( ) { } private static void logprop ( String prop , boolean show ) { } private static void logprop ( String prop ) { } public static void main ( String [ ] args ) { if ( ( args . length ) < 1 ) { System . out . println ( ( "You<seq2seq4repair_space>must<seq2seq4repair_space>specify<seq2seq4repair_space>a<seq2seq4repair_space>comma-delimited<seq2seq4repair_space>list<seq2seq4repair_space>of<seq2seq4repair_space>paths<seq2seq4repair_space>to<seq2seq4repair_space>search<seq2seq4repair_space>" + "for<seq2seq4repair_space>unit<seq2seq4repair_space>tests" ) ) ; System . exit ( 0 ) ; } AllTests . initializeLogging ( args ) ; AllTests . initializeManager ( args ) ; AllTests . logprop ( "java.version" , true ) ; AllTests . logprop ( "java.vendor" ) ; AllTests . logprop ( "java.home" , true ) ; AllTests . logprop ( "user.home" ) ; AllTests . logprop ( "user.dir" ) ; AllTests . logprop ( "os.name" ) ; AllTests . logprop ( "os.version" ) ; AllTests . logprop ( "os.arch" ) ; AllTests . logprop ( "java.class.version" ) ; String cp = System . getProperty ( "java.class.path" ) ; <START_BUG> String [ ] cpe = JOrphanUtils . split ( cp , ";" ) ; <END_BUG> StringBuffer sb = new StringBuffer ( 3000 ) ; sb . append ( "java.class.path=" ) ; for ( int i = 0 ; i < ( cpe . length ) ; i ++ ) { sb . append ( "\n" ) ; sb . append ( cpe [ i ] ) ; } AllTests . log . info ( sb . toString ( ) ) ; System . out . println ( "+++++++++++" ) ; AllTests . logprop ( "java.awt.headless" , true ) ; AllTests . logprop ( "java.awt.graphicsenv" , true ) ; System . out . println ( "------------" ) ; System . out . println ( "Creating<seq2seq4repair_space>test<seq2seq4repair_space>suite" ) ; TestSuite suite = AllTests . suite ( args [ 0 ] ) ; System . out . println ( "Starting<seq2seq4repair_space>test<seq2seq4repair_space>run" ) ; TestRunner . run ( suite ) ; System . out . println ( "+++++++++++" ) ; System . out . println ( "------------" ) ; System . exit ( 0 ) ; } protected static void initializeLogging ( String [ ] args ) { } protected static void initializeManager ( String [ ] args ) { } public static TestSuite suite ( ) { } private static TestSuite suite ( String searchPaths ) { } }

Fix:
String [ ] cpe = JOrphanUtils . split ( cp , File . pathSeparator ) ;
Buggy code:
public class FriendsActivity extends Activity { private List < ChatUser > userList = new ArrayList < ChatUser > ( ) ; private ArrayAdapter < ChatUser > adapter ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_friends ) ; adapter = new ArrayAdapter < ChatUser > ( this , layout . simple_list_item_2 , id . text1 , userList ) { @ Override public View getView ( int position , View convertView , ViewGroup parent ) { TextView text1 ; TextView text2 ; View view = super . getView ( position , convertView , parent ) ; text1 = ( ( TextView ) ( view . findViewById ( text1 ) ) ) ; text2 = ( ( TextView ) ( view . findViewById ( text2 ) ) ) ; ChatUser cu = userList . get ( position ) ; text1 . setText ( cu . getNickName ( ) ) ; text2 . setText ( cu . getKey ( ) . getId ( ) . toString ( ) ) ; return view ; } } ; ListView l = ( ( ListView ) ( findViewById ( listFriends ) ) ) ; l . setAdapter ( adapter ) ; l . setOnItemClickListener ( new OnItemClickListener ( ) { @ Override public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { Intent intent = new Intent ( getApplication ( ) , SendActivity . class ) ; String idString = userList . get ( position ) . getKey ( ) . getId ( ) . toString ( ) ; intent . putExtra ( "TO" , idString ) ; startActivity ( intent ) ; } } ) ; <START_BUG> new FriendsActivity . GetFriendsTask ( ) . execute ( null , null , null ) ; <END_BUG> } private class GetFriendsTask extends AsyncTask < Void , Void , String > { private ProgressDialog Dialog = new ProgressDialog ( FriendsActivity . this ) ; protected void onPreExecute ( ) { } @ Override protected String doInBackground ( Void ... params ) { } @ Override protected void onPostExecute ( String result ) { } } }

Fix:
new FriendsActivity . GetFriendsTask ( ) . execute ( ) ;
Buggy code:
public class UrlResourceStream extends AbstractResourceStream implements IFixedLocationResourceStream { private static final long serialVersionUID = 1L ; private static final Logger log = LoggerFactory . getLogger ( UrlResourceStream . class ) ; private transient UrlResourceStream . StreamData streamData ; private final URL url ; private File file ; private static class StreamData { private URLConnection connection ; private long contentLength ; private String contentType ; private long lastModified ; } public UrlResourceStream ( final URL url ) { } private UrlResourceStream . StreamData getData ( boolean initialize ) { } public void close ( ) throws IOException { UrlResourceStream . StreamData data = getData ( false ) ; if ( data != null ) { Connections . closeQuietly ( data . connection ) ; <START_BUG> data . connection = null ; <END_BUG> } } @ Override public String getContentType ( ) { } public InputStream getInputStream ( ) throws ResourceStreamNotFoundException { } public URL getURL ( ) { } @ Override public Time lastModifiedTime ( ) { } private void setContentLength ( ) throws IOException { } @ Override public String toString ( ) { } @ Override public Bytes length ( ) { } public String locationAsString ( ) { } }

Fix:
streamData = null ;
Buggy code:
public final class UnboundedQueueThreadPoolAdd extends AbstractExecutorAdd { private static final long serialVersionUID = 5597662601486525937L ; public UnboundedQueueThreadPoolAdd ( final String name , final ScaledCount maxThreads ) { } protected < P > void applyUpdate ( final UpdateContext updateContext , final UpdateResultHandler < ? super Void , P > handler , final P param ) { <START_BUG> final BatchBuilder builder = updateContext . getBatchBuilder ( ) ; <END_BUG> final ScaledCount maxThreadsCount = getMaxThreads ( ) ; final int maxThreads = maxThreadsCount . getScaledCount ( ) ; final String name = getName ( ) ; final ServiceName serviceName = ThreadsServices . executorName ( name ) ; final UnboundedQueueThreadPoolService service = new UnboundedQueueThreadPoolService ( maxThreads , getKeepaliveTime ( ) ) ; final ServiceBuilder < ExecutorService > serviceBuilder = builder . addService ( serviceName , service ) ; addThreadFactoryDependency ( serviceName , serviceBuilder , service . getThreadFactoryInjector ( ) , builder ) ; serviceBuilder . install ( ) ; } protected void applyUpdate ( final ThreadsSubsystemElement element ) throws UpdateFailedException { } }

Fix:
final BatchBuilder builder = updateContext . getServiceTarget ( ) ;
Buggy code:
public class DefaultWeavingContext implements IWeavingContext { protected ClassLoader loader ; private String shortName ; public DefaultWeavingContext ( ClassLoader loader ) { } public Enumeration getResources ( String name ) throws IOException { } public String getBundleIdFromURL ( URL url ) { } public String getClassLoaderName ( ) { } public String getFile ( URL url ) { } public String getId ( ) { if ( ( shortName ) == null ) { <START_BUG> shortName = getClassLoaderName ( ) ; <END_BUG> int index = shortName . lastIndexOf ( "." ) ; shortName = shortName . substring ( ( index + 1 ) ) ; } return shortName ; } public String getSuffix ( ) { } }

Fix:
shortName = getClassLoaderName ( ) . replace ( '$' , '.' ) ;
Buggy code:
public class Problem { private final String message ; private final Location location ; private final ParseState parseState ; private final Throwable rootCause ; public Problem ( String message , Location location ) { } public Problem ( String message , Location location , ParseState parseState ) { } public Problem ( String message , Location location , ParseState parseState , Throwable rootCause ) { } public String getMessage ( ) { } public Location getLocation ( ) { } public String getResourceDescription ( ) { } public ParseState getParseState ( ) { } public Throwable getRootCause ( ) { } @ Override public String toString ( ) { <START_BUG> StringBuffer sb = new StringBuffer ( ) ; <END_BUG> sb . append ( "Configuration<seq2seq4repair_space>problem:<seq2seq4repair_space>" ) ; sb . append ( getMessage ( ) ) ; sb . append ( "\nOffending<seq2seq4repair_space>resource:<seq2seq4repair_space>" ) . append ( getResourceDescription ( ) ) ; if ( ( getParseState ( ) ) != null ) { sb . append ( '\n' ) . append ( getParseState ( ) ) ; } return sb . toString ( ) ; } }

Fix:
StringBuilder sb = new StringBuilder ( ) ;
Buggy code:
public class Available extends Task { private String property ; private String classname ; private File file ; private String resource ; private String type ; private Path classpath ; private AntClassLoader loader ; private String value = "true" ; public void setClasspath ( Path classpath ) { } public Path createClasspath ( ) { } public void setClasspathRef ( Reference r ) { } public void setProperty ( String property ) { } public void setValue ( String value ) { } public void setClassname ( String classname ) { } public void setFile ( File file ) { } public void setResource ( String resource ) { } public void setType ( String type ) { } public void execute ( ) throws BuildException { if ( ( property ) == null ) { throw new BuildException ( "property<seq2seq4repair_space>attribute<seq2seq4repair_space>is<seq2seq4repair_space>required" , location ) ; } if ( ( ( ( classname ) == null ) && ( ( file ) == null ) ) && ( ( resource ) == null ) ) { throw new BuildException ( "At<seq2seq4repair_space>least<seq2seq4repair_space>one<seq2seq4repair_space>of<seq2seq4repair_space>(classname|file|resource)<seq2seq4repair_space>is<seq2seq4repair_space>required" , location ) ; } if ( ( type ) != null ) { if ( ( ! ( type . equalsIgnoreCase ( "file" ) ) ) && ( ! ( type . equalsIgnoreCase ( "dir" ) ) ) ) { throw new BuildException ( "Type<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>one<seq2seq4repair_space>of<seq2seq4repair_space>either<seq2seq4repair_space>dir<seq2seq4repair_space>or<seq2seq4repair_space>file" ) ; } } if ( ( classpath ) != null ) { <START_BUG> this . loader = new AntClassLoader ( project , classpath , false ) ; <END_BUG> } if ( ( ( classname ) != null ) && ( ! ( checkClass ( classname ) ) ) ) { log ( ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>load<seq2seq4repair_space>class<seq2seq4repair_space>" + ( classname ) ) + "<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>property<seq2seq4repair_space>" ) + ( property ) ) , MSG_VERBOSE ) ; return ; } if ( ( ( file ) != null ) && ( ! ( checkFile ( file ) ) ) ) { log ( ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>" + ( file ) ) + "<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>property<seq2seq4repair_space>" ) + ( property ) ) , MSG_VERBOSE ) ; return ; } if ( ( ( resource ) != null ) && ( ! ( checkResource ( resource ) ) ) ) { log ( ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>load<seq2seq4repair_space>resource<seq2seq4repair_space>" + ( resource ) ) + "<seq2seq4repair_space>to<seq2seq4repair_space>set<seq2seq4repair_space>property<seq2seq4repair_space>" ) + ( property ) ) , MSG_VERBOSE ) ; return ; } this . project . setProperty ( property , value ) ; } private boolean checkFile ( File file ) { } private boolean checkResource ( String resource ) { } private boolean checkClass ( String classname ) { } }

Fix:
this . loader = new AntClassLoader ( project , classpath ) ;
Buggy code:
public class PackageFragmentRoot extends Openable implements IPackageFragmentRoot { protected IResource fResource ; protected PackageFragmentRoot ( IResource resource , IJavaProject project ) { } protected PackageFragmentRoot ( IResource resource , IJavaProject project , String path ) { } public void attachSource ( IPath zipPath , IPath rootPath , IProgressMonitor monitor ) throws JavaModelException { } protected boolean computeChildren ( OpenableElementInfo info ) throws JavaModelException { } protected void computeFolderChildren ( IContainer folder , String prefix , Vector vChildren ) throws JavaModelException { } protected OpenableElementInfo createElementInfo ( ) { } public IPackageFragment createPackageFragment ( String name , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected int determineKind ( IResource underlyingResource ) throws JavaModelException { } public boolean equals ( Object o ) { } public boolean exists ( ) { } public boolean exists0 ( ) { } <START_BUG> protected boolean generateInfos ( OpenableElementInfo info , IProgressMonitor pm , Hashtable newElements , IResource underlyingResource ) throws JavaModelException { <END_BUG> ( ( PackageFragmentRootInfo ) ( info ) ) . setRootKind ( determineKind ( underlyingResource ) ) ; return computeChildren ( info ) ; } protected char getHandleMementoDelimiter ( ) { } public int getKind ( ) throws JavaModelException { } public Object [ ] getNonJavaResources ( ) throws JavaModelException { } public IPackageFragment getPackageFragment ( String packageName ) { } protected String getPackageName ( IFolder folder ) throws JavaModelException { } public IPath getPath ( ) { } public IPath getSourceAttachmentPath ( ) throws JavaModelException { } public IPath getSourceAttachmentRootPath ( ) throws JavaModelException { } public IResource getUnderlyingResource ( ) throws JavaModelException { } public int hashCode ( ) { } public boolean isArchive ( ) { } public boolean isExternal ( ) { } public void refreshChildren ( ) { } protected void toStringInfo ( int tab , StringBuffer buffer , Object info ) { } }

Fix:
protected boolean generateInfos ( OpenableElementInfo info , IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException {
Buggy code:
public class CheckVictim extends BukkitRunnable { Player v ; Player c ; CheckVictim ( Player victim , Player controller ) { } public void run ( ) { if ( ( ( v ) != null ) && ( ( c ) != null ) ) { if ( v . hasMetadata ( "iCU_P" ) ) { if ( c . hasMetadata ( "iCU_H" ) ) { if ( v . getWorld ( ) . getName ( ) . equalsIgnoreCase ( c . getWorld ( ) . getName ( ) ) ) { <START_BUG> if ( ( v . getLocation ( ) . distance ( c . getLocation ( ) ) ) > 25 ) { <END_BUG> v . teleport ( c ) ; TitleAPI . sendTitle ( v , 20 , 20 , 60 , "§4TOO<seq2seq4repair_space>FAR<seq2seq4repair_space>AWAY" , "" ) ; } } else { v . teleport ( c ) ; v . setGameMode ( SPECTATOR ) ; TitleAPI . sendTitle ( v , 20 , 20 , 60 , "§4SWITCHED<seq2seq4repair_space>WORLDS" , "" ) ; } } else { this . cancel ( ) ; } } else { this . cancel ( ) ; } } else { this . cancel ( ) ; } } }

Fix:
if ( ( v . getLocation ( ) . distance ( c . getLocation ( ) ) ) > 15 ) {
Buggy code:
public final class MathUtils { private static final byte NB = ( ( byte ) ( - 1 ) ) ; private static final short NS = ( ( short ) ( - 1 ) ) ; private static final byte PB = ( ( byte ) ( 1 ) ) ; private static final short PS = ( ( short ) ( 1 ) ) ; private static final byte ZB = ( ( byte ) ( 0 ) ) ; private static final short ZS = ( ( short ) ( 0 ) ) ; private MathUtils ( ) { } public static int addAndCheck ( int x , int y ) { } public static long binomialCoefficient ( final int n , final int k ) { } public static double binomialCoefficientDouble ( final int n , final int k ) { } public static double binomialCoefficientLog ( final int n , final int k ) { } public static double cosh ( double x ) { } public static boolean equals ( double x , double y ) { } public static long factorial ( final int n ) { } public static double factorialDouble ( final int n ) { } public static double factorialLog ( final int n ) { } public static int gcd ( int u , int v ) { } public static int hash ( double value ) { } public static byte indicator ( final byte x ) { } public static double indicator ( final double x ) { } public static float indicator ( final float x ) { } public static int indicator ( final int x ) { } public static long indicator ( final long x ) { } public static short indicator ( final short x ) { } public static int lcm ( int a , int b ) { } public static int mulAndCheck ( int x , int y ) { } public static double nextAfter ( double d , double direction ) { } public static double round ( double x , int scale ) { } public static double round ( double x , int scale , int roundingMethod ) { try { <START_BUG> return new BigDecimal ( new Double ( x ) . toString ( ) ) . setScale ( scale , roundingMethod ) . doubleValue ( ) ; <END_BUG> } catch ( NumberFormatException ex ) { if ( Double . isInfinite ( x ) ) { return x ; } else { return Double . NaN ; } } } public static float round ( float x , int scale ) { } public static float round ( float x , int scale , int roundingMethod ) { } private static double roundUnscaled ( double unscaled , double sign , int roundingMethod ) { } public static byte sign ( final byte x ) { } public static double sign ( final double x ) { } public static float sign ( final float x ) { } public static int sign ( final int x ) { } public static long sign ( final long x ) { } public static short sign ( final short x ) { } public static double sinh ( double x ) { } public static int subAndCheck ( int x , int y ) { } }

Fix:
return new BigDecimal ( Double . toString ( x ) ) . setScale ( scale , roundingMethod ) . doubleValue ( ) ;
Buggy code:
public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTestCase { protected static final String DEFAULT_COLLECTION = "collection1" ; private static final boolean DEBUG = false ; protected ZkTestServer zkServer ; private AtomicInteger homeCount = new AtomicInteger ( ) ; @ BeforeClass public static void beforeThisClass ( ) throws Exception { } @ Before @ Override public void setUp ( ) throws Exception { } protected String getCloudSolrConfig ( ) { } @ Override protected void createServers ( int numShards ) throws Exception { File controlHome = new File ( new File ( getSolrHome ( ) ) . getParentFile ( ) , ( "control" + ( homeCount . incrementAndGet ( ) ) ) ) ; FileUtils . copyDirectory ( new File ( getSolrHome ( ) ) , controlHome ) ; setupJettySolrHome ( controlHome ) ; System . setProperty ( "collection" , "control_collection" ) ; String numShardsS = System . getProperty ( NUM_SHARDS_PROP ) ; System . setProperty ( NUM_SHARDS_PROP , "1" ) ; controlJetty = createJetty ( controlHome , null ) ; System . clearProperty ( "collection" ) ; if ( numShardsS != null ) { System . setProperty ( NUM_SHARDS_PROP , numShardsS ) ; } else { System . clearProperty ( NUM_SHARDS_PROP ) ; } controlClient = createNewSolrServer ( controlJetty . getLocalPort ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 1 ; i <= numShards ; i ++ ) { if ( ( sb . length ( ) ) > 0 ) sb . append ( ',' ) ; File jettyHome = new File ( new File ( getSolrHome ( ) ) . getParentFile ( ) , ( "jetty" + ( homeCount . incrementAndGet ( ) ) ) ) ; setupJettySolrHome ( jettyHome ) ; JettySolrRunner j = createJetty ( jettyHome , null , ( "shard" + ( i + 2 ) ) ) ; jettys . add ( j ) ; clients . add ( createNewSolrServer ( j . getLocalPort ( ) ) ) ; <START_BUG> sb . append ( "127.0.0.1:" ) . append ( j . getLocalPort ( ) ) . append ( context ) ; <END_BUG> } shards = sb . toString ( ) ; for ( int i = 1 ; i <= numShards ; i ++ ) { ZkStateReader zkStateReader = ( ( org . apache . solr . servlet . SolrDispatchFilter ) ( jettys . get ( 0 ) . getDispatchFilter ( ) . getFilter ( ) ) ) . getCores ( ) . getZkController ( ) . getZkStateReader ( ) ; zkStateReader . getLeaderRetry ( "collection1" , ( "shard" + ( i + 2 ) ) , 15000 ) ; } } protected void waitForRecoveriesToFinish ( String collection , ZkStateReader zkStateReader , boolean verbose ) throws Exception { } protected void waitForRecoveriesToFinish ( String collection , ZkStateReader zkStateReader , boolean verbose , boolean failOnTimeout ) throws Exception { } protected void waitForRecoveriesToFinish ( String collection , ZkStateReader zkStateReader , boolean verbose , boolean failOnTimeout , int timeoutSeconds ) throws Exception { } protected void assertAllActive ( String collection , ZkStateReader zkStateReader ) throws InterruptedException , KeeperException { } @ Override @ After public void tearDown ( ) throws Exception { } protected void printLayout ( ) throws Exception { } }

Fix:
sb . append ( buildUrl ( j . getLocalPort ( ) ) ) ;
Buggy code:
@ SuppressWarnings ( "ALL" ) class LanguageParser extends BaseParser < Object > { Rule Computation ( ) { } Rule Sqrt ( ) { } Rule NumberExpression ( ) { } Rule NumberColumn ( ) { } Rule NumberOperator ( ) { } Rule TableFunction ( ) { } Rule TableFunctionName ( ) { } Rule Identifier ( ) { } Rule StringLiteral ( ) { } Rule Character ( ) { } Rule NormalCharacter ( ) { } Rule SafeCharacter ( ) { } Rule IntLiteral ( ) { } Rule FloatLiteral ( ) { } Rule PeriodLiteral ( ) { } Rule PeriodUnit ( ) { } Rule ChronoUnit ( ) { } Rule DateExpression ( ) { } Rule DateTerm ( ) { } Rule DateCalculation ( ) { } Rule DateFunction ( ) { } Rule DateFunctionName ( ) { } Rule DateOperators ( ) { } Rule IntLiteralOfN ( int n ) { } Rule DateLiteral ( ) { } Rule DateBody ( ) { } Rule DateComparison ( ) { } Rule TimeBody ( ) { } Rule DateTimeLiteral ( ) { } Rule DateColumn ( ) { } Rule Variable ( ) { } Rule Params ( ) { } Rule ParamDecl ( ) { } Rule ParamRest ( ) { } Rule WhiteSpace ( ) { } Rule WhiteSpaceChars ( ) { } Rule Process ( ) { } Rule Pipe ( ) { } Rule Digit ( ) { } Rule ColumnIdentifier ( ) { } Rule CompareOperator ( ) { } Rule Comparison ( ) { } Rule NumberComparison ( ) { } Rule Equality ( ) { } Rule AnyValue ( ) { } Rule BooleanColumn ( ) { } Rule BooleanExpression ( ) { } Rule BooleanLiteral ( ) { } Rule UnaryBooleanOperation ( ) { } Rule CodeCheck ( ) { } Rule StringColumn ( ) { } Rule StringExpression ( ) { } Rule NotOperation ( ) { } Rule BooleanOperation ( ) { } Rule BooleanTerm ( ) { } Rule BooleanOperator ( ) { } Rule Sugar ( ) { } Rule Macro ( ) { <START_BUG> return Sequence ( "def" , WhiteSpace ( ) , Identifier ( ) , WhiteSpace ( ) , ":" , WhiteSpace ( ) , MacroType ( ) , WhiteSpace ( ) , "=" , WhiteSpace ( ) , MacroBody ( ) , ";" , swap4 ( ) , push ( new MacroInfo ( ( ( Identifier ) ( pop ( ) ) ) , new MacroType ( ( ( String ) ( pop ( ) ) ) ) , ( ( String ) ( pop ( ) ) ) ) ) ) ; <END_BUG> } Rule MacroBody ( ) { } Rule MacroType ( ) { } }

Fix:
return Sequence ( "def" , WhiteSpace ( ) , Identifier ( ) , WhiteSpace ( ) , ":" , WhiteSpace ( ) , MacroType ( ) , WhiteSpace ( ) , "=" , WhiteSpace ( ) , MacroBody ( ) , ";" , swap3 ( ) , push ( new MacroInfo ( ( ( Identifier ) ( pop ( ) ) ) , new MacroType ( ( ( String ) ( pop ( ) ) ) ) , ( ( String ) ( pop ( ) ) ) ) ) ) ;
Buggy code:
public class BasicDRPCTopology { public static class ExclaimBolt extends BaseBasicBolt { @ Override public void execute ( Tuple tuple , BasicOutputCollector collector ) { } @ Override public void declareOutputFields ( OutputFieldsDeclarer declarer ) { } } public static void main ( String [ ] args ) throws Exception { LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder ( "exclamation" ) ; builder . addBolt ( new BasicDRPCTopology . ExclaimBolt ( ) , 3 ) ; Config conf = new Config ( ) ; if ( ( args == null ) || ( ( args . length ) == 0 ) ) { LocalDRPC drpc = new LocalDRPC ( ) ; LocalCluster cluster = new LocalCluster ( ) ; cluster . submitTopology ( "drpc-demo" , conf , builder . createLocalTopology ( drpc ) ) ; for ( String word : new String [ ] { "hello" , "goodbye" } ) { System . out . println ( ( ( ( "Result<seq2seq4repair_space>for<seq2seq4repair_space>\"" + word ) + "\":<seq2seq4repair_space>" ) + ( drpc . execute ( "exclamation" , word ) ) ) ) ; } cluster . shutdown ( ) ; drpc . shutdown ( ) ; } else { conf . setNumWorkers ( 3 ) ; <START_BUG> StormSubmitter . submitTopology ( args [ 0 ] , conf , builder . createRemoteTopology ( ) ) ; <END_BUG> } } }

Fix:
StormSubmitter . submitTopologyWithProgressBar ( args [ 0 ] , conf , builder . createRemoteTopology ( ) ) ;
Buggy code:
public class Controller { TasmaUserInterface userInterface ; TaskCollection collection = new TaskCollection ( ) ; Parser parser = new Parser ( ) ; public void initialize ( ) throws Exception { } public void setUserInterface ( TasmaUserInterface ui ) { } public void executeInput ( String input ) { } protected void doCommandAdd ( String details ) { } protected void doCommandSearch ( String query ) { } protected void doCommandList ( ) { } protected void doCommandMark ( String taskId ) { } protected void doCommandEdit ( String taskId , String details ) { } protected void doCommandArchive ( String taskId ) { } protected static CommandType normalizeCommand ( String command ) { } private static String [ ] splitArguments ( String input ) { } private static String [ ] splitArguments ( String input , int argumentCount ) { ArrayList < String > arguments = new ArrayList < String > ( ) ; for ( int i = 0 ; i < argumentCount ; ++ i ) { int intSpacePos = input . indexOf ( "<seq2seq4repair_space>" ) ; if ( intSpacePos == ( - 1 ) ) { arguments . add ( input ) ; break ; } else { arguments . add ( input . substring ( 0 , intSpacePos ) ) ; input = input . substring ( ( intSpacePos + 1 ) ) ; } } <START_BUG> return ( ( String [ ] ) ( arguments . toArray ( ) ) ) ; <END_BUG> } }

Fix:
return arguments . toArray ( new String [ arguments . size ( ) ] ) ;
Buggy code:
public class CovMerge extends Task { private File home = null ; private File tofile = null ; private ArrayList filesets = new ArrayList ( ) ; private boolean verbose ; public CovMerge ( ) { } public void setHome ( File value ) { } public void setTofile ( File value ) { } public void setVerbose ( boolean flag ) { } public void addFileset ( FileSet fs ) { } public void execute ( ) throws TaskException { } protected File [ ] getSnapshots ( ) throws TaskException { ArrayList v = new ArrayList ( ) ; final int size = filesets . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { FileSet fs = ( ( FileSet ) ( filesets . get ( i ) ) ) ; <START_BUG> DirectoryScanner ds = fs . getDirectoryScanner ( getProject ( ) ) ; <END_BUG> ds . scan ( ) ; String [ ] f = ds . getIncludedFiles ( ) ; for ( int j = 0 ; j < ( f . length ) ; j ++ ) { String pathname = f [ j ] ; File file = new File ( ds . getBasedir ( ) , pathname ) ; file = resolveFile ( file . getPath ( ) ) ; v . add ( file ) ; } } File [ ] files = new File [ v . size ( ) ] ; v . copyInto ( files ) ; return files ; } protected void checkOptions ( ) throws TaskException { } protected File createParamFile ( ) throws TaskException { } protected File createTmpFile ( ) { } }

Fix:
DirectoryScanner ds = fs . getDirectoryScanner ( ) ;
Buggy code:
public final class SignInSession extends WebSession { private String user ; protected SignInSession ( final WebApplication application , Request request ) { } public final boolean authenticate ( final String username , final String password ) { if ( ( user ) == null ) { <START_BUG> if ( ( "org.apache.wicket" . equalsIgnoreCase ( username ) ) && ( "org.apache.wicket" . equalsIgnoreCase ( password ) ) ) { <END_BUG> user = username ; } } return ( user ) != null ; } public boolean isSignedIn ( ) { } public String getUser ( ) { } public void setUser ( final String user ) { } }

Fix:
if ( ( "wicket" . equalsIgnoreCase ( username ) ) && ( "wicket" . equalsIgnoreCase ( password ) ) ) {
Buggy code:
@ WebServlet ( name = "CallEjbServlet" , urlPatterns = { "//CallEjbServlet" } ) public class CallEjbServlet extends HttpServlet { @ EJB MyEjb ejb ; protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , ServletException { Context ctx = null ; try { Properties env = new Properties ( ) ; String address = System . getProperty ( "node0" , "localhost" ) ; address = NetworkUtils . formatPossibleIpv6Address ( address ) ; <START_BUG> env . put ( Context . PROVIDER_URL , ( ( "remote:////" + address ) + ":4447" ) ) ; <END_BUG> env . put ( Context . INITIAL_CONTEXT_FACTORY , "org.jboss.naming.remote.client.InitialContextFactory" ) ; ctx = new InitialContext ( env ) ; MyObject obj = ( ( MyObject ) ( ctx . lookup ( "loc//stub" ) ) ) ; Writer writer = resp . getWriter ( ) ; writer . write ( ejb . doIt ( ) ) ; writer . write ( obj . doIt ( "Hello" ) ) ; writer . flush ( ) ; } catch ( NamingException e ) { throw new RuntimeException ( e ) ; } finally { if ( ctx != null ) { try { ctx . close ( ) ; } catch ( NamingException e ) { throw new RuntimeException ( e ) ; } } } } }

Fix:
env . put ( Context . PROVIDER_URL , ( ( "http-remoting:////" + address ) + ":8080" ) ) ;
Buggy code:
public class ModClusterGetProxyInfo implements OperationStepHandler , DescriptionProvider { static final ModClusterGetProxyInfo INSTANCE = new ModClusterGetProxyInfo ( ) ; @ Override public ModelNode getModelDescription ( Locale locale ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { <START_BUG> if ( ( context . getType ( ) ) == ( Type . SERVER ) ) { <END_BUG> context . addStep ( new OperationStepHandler ( ) { @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { ServiceController < ? > controller = context . getServiceRegistry ( false ) . getService ( NAME ) ; ModCluster modcluster = ( ( ModCluster ) ( controller . getValue ( ) ) ) ; Map < InetSocketAddress , String > map = modcluster . getProxyInfo ( ) ; ModClusterLogger . ROOT_LOGGER . debugf ( "Mod_cluster<seq2seq4repair_space>ProxyInfo<seq2seq4repair_space>%s" , map ) ; if ( ! ( map . isEmpty ( ) ) ) { final ModelNode result = new ModelNode ( ) ; Object [ ] addr = map . keySet ( ) . toArray ( ) ; for ( int i = 0 ; i < ( addr . length ) ; i ++ ) { InetSocketAddress address = ( ( InetSocketAddress ) ( addr [ i ] ) ) ; result . add ( ( ( ( address . getHostName ( ) ) + ":" ) + ( address . getPort ( ) ) ) ) ; result . add ( map . get ( addr [ i ] ) ) ; } context . getResult ( ) . set ( result ) ; } context . completeStep ( ) ; } } , RUNTIME ) ; } context . completeStep ( ) ; } }

Fix:
if ( context . getProcessType ( ) . isServer ( ) ) {
Buggy code:
public final class VectorWriterTest extends MahoutTestCase { @ Test public void testSFVW ( ) throws Exception { Path path = getTestTempFilePath ( "sfvw" ) ; <START_BUG> Configuration conf = new Configuration ( ) ; <END_BUG> FileSystem fs = FileSystem . get ( conf ) ; SequenceFile . Writer seqWriter = new SequenceFile . Writer ( fs , conf , path , LongWritable . class , VectorWritable . class ) ; SequenceFileVectorWriter writer = new SequenceFileVectorWriter ( seqWriter ) ; try { writer . write ( new RandomVectorIterable ( 50 ) ) ; } finally { Closeables . close ( writer , false ) ; } long count = HadoopUtil . countRecords ( path , conf ) ; assertEquals ( 50 , count ) ; } @ Test public void testTextOutputSize ( ) throws Exception { } }

Fix:
Configuration conf = getConfiguration ( ) ;
Buggy code:
public class TestRollback extends LuceneTestCase { public void testRollbackIntegrityWithBufferFlush ( ) throws Exception { Directory dir = newDirectory ( ) ; RandomIndexWriter rw = new RandomIndexWriter ( random ( ) , dir ) ; for ( int i = 0 ; i < 5 ; i ++ ) { Document doc = new Document ( ) ; doc . add ( newStringField ( "pk" , Integer . toString ( i ) , YES ) ) ; rw . addDocument ( doc ) ; } <START_BUG> rw . close ( ) ; <END_BUG> IndexWriter w = new IndexWriter ( dir , newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random ( ) ) ) . setMaxBufferedDocs ( 2 ) . setOpenMode ( APPEND ) ) ; for ( int i = 0 ; i < 3 ; i ++ ) { Document doc = new Document ( ) ; String value = Integer . toString ( i ) ; doc . add ( newStringField ( "pk" , value , YES ) ) ; doc . add ( newStringField ( "text" , "foo" , YES ) ) ; w . updateDocument ( new Term ( "pk" , value ) , doc ) ; } w . rollback ( ) ; IndexReader r = DirectoryReader . open ( dir ) ; assertEquals ( "index<seq2seq4repair_space>should<seq2seq4repair_space>contain<seq2seq4repair_space>same<seq2seq4repair_space>number<seq2seq4repair_space>of<seq2seq4repair_space>docs<seq2seq4repair_space>post<seq2seq4repair_space>rollback" , 5 , r . numDocs ( ) ) ; r . close ( ) ; dir . close ( ) ; } }

Fix:
rw . shutdown ( ) ;