nus-yam/ex-repair huggingface dataset:
Buggy code:
public class TestXMLCustomerOrder extends SingleEMFTestCase { private static final int ORDER_1_OID = 10 ; private static final double ORDER_1_AMOUNT = 850 ; private static final boolean ORDER_1_DELIVERED = false ; private static final int ORDER_2_OID = 20 ; private static final double ORDER_2_AMOUNT = 1000 ; private static final boolean ORDER_2_DELIVERED = false ; public void setUp ( ) { <START_BUG> setUp ( Customer . class , CustomerKey . class , Order . class , EAddress . class , CLEAR_TABLES ) ; <END_BUG> setTestsDisabled ( ( ! ( dictionarySupportsXMLColumn ( ) ) ) ) ; if ( isTestsDisabled ( ) ) { getLog ( ) . trace ( "TestXMLCustomerOrder()<seq2seq4repair_space>-<seq2seq4repair_space>Skipping<seq2seq4repair_space>all<seq2seq4repair_space>tests<seq2seq4repair_space>-<seq2seq4repair_space>No<seq2seq4repair_space>XML<seq2seq4repair_space>Column<seq2seq4repair_space>support" ) ; return ; } EntityManager em = emf . createEntityManager ( ) ; em . getTransaction ( ) . begin ( ) ; persistEntities ( em ) ; em . getTransaction ( ) . commit ( ) ; em . close ( ) ; } @ SuppressWarnings ( "unchecked" ) public void testXMLFieldProjection ( ) { } @ SuppressWarnings ( "unchecked" ) public void testXMLFieldInEntity ( ) { } @ SuppressWarnings ( "unchecked" ) public void testXMLStringToXMLStringComparison ( ) { } @ SuppressWarnings ( "unchecked" ) public void testXMLStringToEmbeddedStringComparison ( ) { } @ SuppressWarnings ( "unchecked" ) public void testXMLStringToConstantStringComparison ( ) { } @ SuppressWarnings ( "unchecked" ) public void testXMLStringToParameterStringComparison ( ) { } @ SuppressWarnings ( "unchecked" ) public void testParameterStringToXMLStringComparison ( ) { } public void testUpdate ( ) { } public void testNullify ( ) { } public void testXMLStringToConstantIntComparison ( ) { } public void testXMLListToConstantStringComparison ( ) { } public void testSubclassPropertyInXMLFieldComparison ( ) { } public static void main ( String [ ] args ) { } private void persistEntities ( EntityManager em ) { } private boolean dictionarySupportsXMLColumn ( ) { } private USAAddress createUSAAddress ( String name ) { } private CANAddress createCANAddress ( String name ) { } private void assertOrdersEqual ( Order o1 , Order o2 ) { } }

Fix:
setUp ( Customer . class , CustomerKey . class , Order . class , EAddress . class , DROP_TABLES ) ;
Buggy code:
public class SystemMenuSizeFastView extends ContributionItem { private FastViewPane fastViewPane ; public SystemMenuSizeFastView ( FastViewPane fastViewPane ) { } public void dispose ( ) { } public void fill ( Menu menu , int index ) { MenuItem item = new MenuItem ( menu , SWT . NONE , index ) ; <START_BUG> item . setText ( WorkbenchMessages . getString ( "PartPane.size" ) ) ; <END_BUG> item . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { fastViewPane . moveSash ( ) ; } } ) ; item . setEnabled ( ( ( fastViewPane . getCurrentPane ( ) ) != null ) ) ; } public boolean isDynamic ( ) { } }

Fix:
item . setText ( PartPane_size ) ;
Buggy code:
public class Slider extends Control { boolean dragging ; boolean tracking ; int increment = 1 ; int pageIncrement = 10 ; public Slider ( Composite parent , int style ) { } public void addSelectionListener ( SelectionListener listener ) { } static int checkStyle ( int style ) { } int actionProc ( int theControl , int partCode ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void drawBackground ( int control , int context ) { } public int getIncrement ( ) { } public int getMaximum ( ) { } public int getMinimum ( ) { } public int getPageIncrement ( ) { } public int getSelection ( ) { } public int getThumb ( ) { } int kEventControlTrack ( int nextHandler , int theEvent , int userData ) { } int kEventMouseDown ( int nextHandler , int theEvent , int userData ) { int status = super . kEventMouseDown ( nextHandler , theEvent , userData ) ; if ( status == ( OS . noErr ) ) return status ; display . grabControl = null ; display . runDeferredEvents ( ) ; dragging = tracking = false ; status = OS . CallNextEventHandler ( nextHandler , theEvent ) ; if ( dragging ) { Event event = new Event ( ) ; sendEvent ( Selection , event ) ; } dragging = false ; if ( tracking ) { org . eclipse . swt . internal . carbon . Point outPt = new org . eclipse . swt . internal . carbon . Point ( ) ; OS . GetGlobalMouse ( outPt ) ; Rect rect = new Rect ( ) ; int window = OS . GetControlOwner ( handle ) ; int x ; int y ; if ( OS . HIVIEW ) { CGPoint pt = new CGPoint ( ) ; pt . x = outPt . h ; pt . y = outPt . v ; OS . HIViewConvertPoint ( pt , 0 , handle ) ; x = ( ( int ) ( pt . x ) ) ; y = ( ( int ) ( pt . y ) ) ; OS . GetWindowBounds ( window , ( ( short ) ( kWindowStructureRgn ) ) , rect ) ; } else { OS . GetControlBounds ( handle , rect ) ; x = ( outPt . h ) - ( rect . left ) ; y = ( outPt . v ) - ( rect . top ) ; OS . GetWindowBounds ( window , ( ( short ) ( kWindowContentRgn ) ) , rect ) ; } x -= rect . left ; y -= rect . top ; short [ ] button = new short [ 1 ] ; OS . GetEventParameter ( theEvent , kEventParamMouseButton , typeMouseButton , null , 2 , null , button ) ; int chord = OS . GetCurrentEventButtonState ( ) ; int modifiers = OS . GetCurrentEventKeyModifiers ( ) ; <START_BUG> sendMouseEvent ( MouseUp , button [ 0 ] , true , chord , ( ( short ) ( x ) ) , ( ( short ) ( y ) ) , modifiers ) ; <END_BUG> } tracking = false ; return status ; } public void removeSelectionListener ( SelectionListener listener ) { } public void setIncrement ( int value ) { } public void setMaximum ( int value ) { } public void setMinimum ( int value ) { } public void setPageIncrement ( int value ) { } public void setSelection ( int value ) { } public void setThumb ( int value ) { } public void setValues ( int selection , int minimum , int maximum , int thumb , int increment , int pageIncrement ) { } }

Fix:
sendMouseEvent ( MouseUp , button [ 0 ] , clickCount , true , chord , ( ( short ) ( x ) ) , ( ( short ) ( y ) ) , modifiers ) ;
Buggy code:
public class Controller { protected static final int V_REGEX = 1 ; protected static final int V_LENGTH = 2 ; protected static final int V_INCLUEITION = 3 ; protected static final int V_EXCLUETION = 4 ; protected static final int V_EMAIL = 5 ; private static String WEB_ERRORS = "errors" ; private static String DEF_LAYOUT = "layout.ftl" ; private static String LAYOUT_CHILDREN = "children" ; private static Log log = LogFactory . getLog ( Controller . class ) ; private final boolean isAbsolutePath ( String resPath ) { } public void render ( String resName ) { } public void renderWithoutLayout ( String resName ) { } protected void render ( String layoutName , String resourceName ) { WebContext ctx = WebContext . get ( ) ; HttpServletRequest request = ctx . getRequest ( ) ; HttpServletResponse response = ctx . getResponse ( ) ; request . setAttribute ( Controller . WEB_ERRORS , ctx . getErrors ( ) ) ; String resPath = ( isAbsolutePath ( resourceName ) ) ? resourceName : ( ( ctx . getControllerName ( ) ) + "//" ) + resourceName ; File resFile = new File ( ctx . getApplication ( ) . getRealPath ( ( ( ctx . getViewBase ( ) ) + resPath ) ) ) ; if ( ! ( resFile . exists ( ) ) ) { Controller . log . error ( ( "Can't<seq2seq4repair_space>find<seq2seq4repair_space>resource<seq2seq4repair_space>" + resFile ) ) ; try { response . sendError ( 404 ) ; } catch ( IOException e1 ) { } return ; } <START_BUG> String targetRes = resPath ; <END_BUG> if ( null != layoutName ) { String layoutResPath = ctx . getApplication ( ) . getRealPath ( ( ( ctx . getViewBase ( ) ) + layoutName ) ) ; File layoutFile = new File ( layoutResPath ) ; if ( layoutFile . exists ( ) ) { targetRes = ( ctx . getViewBase ( ) ) + layoutName ; request . setAttribute ( Controller . LAYOUT_CHILDREN , resPath ) ; } } try { request . setCharacterEncoding ( "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { Controller . log . error ( e . toString ( ) , e ) ; } if ( Controller . log . isDebugEnabled ( ) ) Controller . log . debug ( ( ( ( "Render<seq2seq4repair_space>" + targetRes ) + ",<seq2seq4repair_space>resource<seq2seq4repair_space>" ) + resourceName ) ) ; RequestDispatcher rd = ctx . getApplication ( ) . getRequestDispatcher ( targetRes ) ; try { rd . include ( request , response ) ; } catch ( Exception e ) { Controller . log . error ( e . toString ( ) , e ) ; throw new ControllerException ( e ) ; } } protected void renderJSON ( Object object ) { } protected void renderText ( String text ) { } protected void redirect ( String resourcePath ) { } protected void validate ( int type , Object [ ] params , String key , String errMsg ) { } protected void addError ( String key , String msg ) { } protected boolean isValid ( ) { } protected int validateInt ( String strInt , int defaultValue ) { } protected long validateLong ( String strLong , long defaultValue ) { } No newline ; at end ; of file ; }

Fix:
String targetRes = ( ctx . getViewBase ( ) ) + resPath ;
Buggy code:
public class PropertyFilePrompt implements State { private ConsoleWrapper theConsole ; private StateValues stateValues ; public PropertyFilePrompt ( ConsoleWrapper theConsole , StateValues stateValues ) { } @ Override public State execute ( ) { theConsole . printf ( NEW_LINE ) ; theConsole . printf ( ROOT_LOGGER . filePrompt ( ) ) ; theConsole . printf ( NEW_LINE ) ; String temp = theConsole . readLine ( "(a):<seq2seq4repair_space>" ) ; if ( temp == null ) { theConsole . printf ( NEW_LINE ) ; return null ; } boolean setRealm = ( stateValues . getRealmMode ( ) ) != ( RealmMode . USER_SUPPLIED ) ; switch ( convertResponse ( temp ) ) { case MANAGEMENT : stateValues . setFileMode ( MANAGEMENT ) ; if ( setRealm ) { stateValues . setRealm ( AddUser . DEFAULT_MANAGEMENT_REALM ) ; } return new PropertyFileFinder ( theConsole , stateValues ) ; case APPLICATION : stateValues . setFileMode ( APPLICATION ) ; if ( setRealm ) { stateValues . setRealm ( AddUser . DEFAULT_APPLICATION_REALM ) ; } return new PropertyFileFinder ( theConsole , stateValues ) ; default : <START_BUG> return new ErrorState ( theConsole , ROOT_LOGGER . invalidChoiceResponse ( ) , this ) ; <END_BUG> } } private PropertyFilePrompt . Option convertResponse ( final String response ) { } private enum Option { MANAGEMENT , APPLICATION , INVALID ; } }

Fix:
return new ErrorState ( theConsole , ROOT_LOGGER . invalidChoiceResponse ( ) , this , stateValues ) ;
Buggy code:
class PluginListDownloadProgress extends JDialog { PluginListDownloadProgress ( PluginManager window ) { } PluginList getPluginList ( ) { } private PluginManager window ; private PluginList list ; private PluginListDownloadProgress . DownloadThread thread ; class DownloadThread extends Thread { public void run ( ) { try { list = new PluginList ( ) ; dispose ( ) ; } catch ( XmlException xe ) { dispose ( ) ; int line = xe . getLine ( ) ; <START_BUG> String path = jEdit . getProperty ( "plugin-manager.url" ) ; <END_BUG> String message = xe . getMessage ( ) ; Log . log ( Log . ERROR , this , ( ( ( ( path + ":" ) + line ) + ":<seq2seq4repair_space>" ) + message ) ) ; String [ ] pp = new String [ ] { path , String . valueOf ( line ) , message } ; GUIUtilities . error ( window , "plugin-list.xmlerror" , pp ) ; } catch ( Exception e ) { dispose ( ) ; Log . log ( Log . ERROR , this , e ) ; String [ ] pp = new String [ ] { e . toString ( ) } ; String ok = jEdit . getProperty ( "common.ok" ) ; String proxyButton = jEdit . getProperty ( "plugin-list.ioerror.proxy-servers" ) ; int retVal = JOptionPane . showOptionDialog ( window , jEdit . getProperty ( "plugin-list.ioerror.message" , pp ) , jEdit . getProperty ( "plugin-list.ioerror.title" ) , JOptionPane . YES_NO_OPTION , JOptionPane . ERROR_MESSAGE , null , new Object [ ] { proxyButton , ok } , ok ) ; if ( retVal == 0 ) new org . gjt . sp . jedit . options . GlobalOptions ( window , "firewall" ) ; } } } class ActionHandler implements ActionListener { public void actionPerformed ( ActionEvent evt ) { } } class WindowHandler extends WindowAdapter { boolean done ; public void windowOpened ( WindowEvent evt ) { } public void windowClosing ( WindowEvent evt ) { } } }

Fix:
String path = jEdit . getProperty ( "plugin-manager.export-url" ) ;
Buggy code:
public class Everywhere { public static void main ( String [ ] args ) { } public String solve ( Scanner in ) { int rounds = in . nextInt ( ) ; List < Integer > numberOfCities = new ArrayList < > ( ) ; for ( int i = 0 ; i < rounds ; i ++ ) { int lines = in . nextInt ( ) ; Set < String > cities = new HashSet < > ( ) ; for ( int j = 0 ; j < lines ; j ++ ) { <START_BUG> cities . add ( in . nextLine ( ) ) ; <END_BUG> } numberOfCities . add ( cities . size ( ) ) ; } return numberOfCities . stream ( ) . map ( String :: valueOf ) . collect ( Collectors . joining ( "\n" ) ) ; } }

Fix:
cities . add ( in . next ( ) ) ;
Buggy code:
public class Save implements Command { private static transient Logger log = Hierarchy . getDefaultHierarchy ( ) . getLoggerFor ( "jmeter.gui" ) ; private static final String SAVE_ALL = "save_all" ; private static final String SAVE = "save_as" ; private static final String SAVE_TO_PREVIOUS = "save" ; private String chosenFile ; private String testPlanFile ; private static Set commands = new HashSet ( ) ; public Save ( ) { } public Set getActionNames ( ) { } public void setTestPlanFile ( String f ) { } public void doAction ( ActionEvent e ) { } private void convertSubTree ( HashTree tree ) { } public static class Test extends TestCase { Save save ; public Test ( String name ) { } public void setUp ( ) { } public void testTreeConversion ( ) throws Exception { HashTree tree = new ListedHashTree ( ) ; <START_BUG> JMeterGUIComponent root = new HttpTestSampleGui ( ) ; <END_BUG> tree . add ( root , root ) ; tree . getTree ( root ) . add ( root , root ) ; save . convertSubTree ( tree ) ; assertEquals ( tree . getArray ( ) [ 0 ] . getClass ( ) . getName ( ) , root . createTestElement ( ) . getClass ( ) . getName ( ) ) ; tree = tree . getTree ( tree . getArray ( ) [ 0 ] ) ; assertEquals ( tree . getArray ( ) [ 0 ] . getClass ( ) . getName ( ) , root . createTestElement ( ) . getClass ( ) . getName ( ) ) ; assertEquals ( tree . getTree ( tree . getArray ( ) [ 0 ] ) . getArray ( ) [ 0 ] . getClass ( ) . getName ( ) , root . createTestElement ( ) . getClass ( ) . getName ( ) ) ; } } private void closeWriter ( OutputStream writer ) { } }

Fix:
JMeterGUIComponent root = new ArgumentsPanel ( ) ;
Buggy code:
public class SuperReference extends ThisReference { public SuperReference ( int sourceStart , int sourceEnd ) { } public static ExplicitConstructorCall implicitSuperConstructorCall ( ) { } public boolean isImplicitThis ( ) { } public boolean isSuper ( ) { } public boolean isThis ( ) { } public StringBuffer printExpression ( int indent , StringBuffer output ) { } public TypeBinding resolveType ( BlockScope scope ) { <START_BUG> constant = Constant . NotAConstant ; <END_BUG> if ( ! ( checkAccess ( scope . methodScope ( ) ) ) ) return null ; ReferenceBinding enclosingReceiverType = scope . enclosingReceiverType ( ) ; if ( ( enclosingReceiverType . id ) == ( TypeIds . T_JavaLangObject ) ) { scope . problemReporter ( ) . cannotUseSuperInJavaLangObject ( this ) ; return null ; } return this . resolvedType = enclosingReceiverType . superclass ( ) ; } public void traverse ( ASTVisitor visitor , BlockScope blockScope ) { } }

Fix:
this . constant = Constant . NotAConstant ;
Buggy code:
final class ViewIntroAdapterSite implements IIntroSite { private IntroDescriptor descriptor ; private IViewSite viewSite ; public ViewIntroAdapterSite ( IViewSite viewSite , IntroDescriptor descriptor ) { } public IActionBars getActionBars ( ) { } public Object getAdapter ( Class adapter ) { } public String getId ( ) { } public IKeyBindingService getKeyBindingService ( ) { } public IWorkbenchPage getPage ( ) { } public String getPluginId ( ) { } public String getRegisteredName ( ) { <START_BUG> return descriptor . getLabel ( ) ; <END_BUG> } public ISelectionProvider getSelectionProvider ( ) { } public Shell getShell ( ) { } public IWorkbenchWindow getWorkbenchWindow ( ) { } public void registerContextMenu ( MenuManager menuManager , ISelectionProvider selectionProvider ) { } public void registerContextMenu ( String menuId , MenuManager menuManager , ISelectionProvider selectionProvider ) { } public void setSelectionProvider ( ISelectionProvider provider ) { } public String toString ( ) { } }

Fix:
return viewSite . getRegisteredName ( ) ;
Buggy code:
public class CatServer { SimpleDateFormat time = new SimpleDateFormat ( "HH:mm:ss" ) ; PrintWriter cpw ; BufferedReader cbr ; PrintWriter spw ; BufferedReader sbr ; ServerSocket ses ; Socket cs ; Socket cts ; int port = 8082 ; TreeMap < String , String > clientInfo = new TreeMap < > ( ) ; String host ; String url ; String httpVersion ; String charset = StandardCharsets . UTF_8 . name ( ) ; String catPic = "http:////test.annarboranimalhospital.com//wp-content//uploads//2011//06//Obese-cat.jpg" ; String accLang = "<seq2seq4repair_space>en-US" ; public CatServer ( ) { } public void startServer ( ) throws IOException , InterruptedException { } private void cycle ( ) throws IOException , InterruptedException { } private boolean getInputURL ( String x ) { System . out . println ( x ) ; if ( ( x == "" ) || ( x == null ) ) return false ; url = "" ; host = null ; String [ ] get = x . split ( "<seq2seq4repair_space>" ) ; String tmp = get [ 1 ] ; httpVersion = get [ 2 ] ; boolean gotHost = false ; for ( String z : tmp . split ( "//" ) ) { if ( ( z . contains ( "." ) ) && ( ( host ) == null ) ) { if ( ! ( z . startsWith ( "www." ) ) ) { z = "www." + z ; } host = z ; gotHost = true ; continue ; } if ( gotHost == true ) { url = ( ( url ) + "//" ) + z ; System . out . println ( z ) ; } } <START_BUG> if ( ( url ) == null ) <END_BUG> url = "//" ; if ( ( host ) == null ) return false ; return true ; } private void sendGET ( ) throws IOException { } private void evaluateResponse ( ) throws IOException , InterruptedException { } private void logMessage ( String m ) { } private void stopServer ( ) throws IOException , InterruptedException { } }

Fix:
if ( ( url ) == "" )
Buggy code:
public class SourceTypeElementInfo extends MemberElementInfo implements ISourceType { protected static final ISourceImport [ ] NO_IMPORTS = new ISourceImport [ 0 ] ; protected static final InitializerElementInfo [ ] NO_INITIALIZERS = new InitializerElementInfo [ 0 ] ; protected static final ISourceField [ ] NO_FIELDS = new ISourceField [ 0 ] ; protected static final ISourceMethod [ ] NO_METHODS = new ISourceMethod [ 0 ] ; protected static final ISourceType [ ] NO_TYPES = new ISourceType [ 0 ] ; protected char [ ] superclassName ; protected char [ ] [ ] superInterfaceNames ; protected char [ ] sourceFileName ; protected char [ ] packageName ; private ISourceImport [ ] imports ; protected IType handle = null ; protected char [ ] [ ] typeParameterNames ; protected char [ ] [ ] [ ] typeParameterBounds ; protected char [ ] [ ] typeParameterSignatures ; public ISourceType getEnclosingType ( ) { } public ISourceField [ ] getFields ( ) { } public char [ ] getFileName ( ) { } public IType getHandle ( ) { } public ISourceImport [ ] getImports ( ) { } public InitializerElementInfo [ ] getInitializers ( ) { } public char [ ] [ ] getInterfaceNames ( ) { } public ISourceType [ ] getMemberTypes ( ) { } public ISourceMethod [ ] getMethods ( ) { } public char [ ] getPackageName ( ) { } public char [ ] getSuperclassName ( ) { } public char [ ] [ ] getTypeParameterNames ( ) { } public char [ ] [ ] [ ] getTypeParameterBounds ( ) { } public char [ ] [ ] getTypeParameterSignatures ( ) { if ( ( this . typeParameterSignatures ) == null ) { if ( ( this . typeParameterNames ) != null ) { int length = this . typeParameterNames . length ; this . typeParameterSignatures = new char [ length ] [ ] ; for ( int i = 0 ; i < length ; i ++ ) { char [ ] [ ] bounds = this . typeParameterBounds [ i ] ; if ( bounds == null ) { this . typeParameterSignatures [ i ] = Signature . createTypeParameterSignature ( this . typeParameterNames [ i ] , CharOperation . NO_CHAR_CHAR ) ; } else { int boundsLength = bounds . length ; char [ ] [ ] boundSignatures = new char [ boundsLength ] [ ] ; for ( int j = 0 ; j < boundsLength ; j ++ ) { <START_BUG> boundSignatures [ i ] = Signature . createCharArrayTypeSignature ( bounds [ j ] , false ) ; <END_BUG> } this . typeParameterSignatures [ i ] = Signature . createTypeParameterSignature ( this . typeParameterNames [ i ] , boundSignatures ) ; } } } } return this . typeParameterSignatures ; } public boolean isBinaryType ( ) { } public boolean isClass ( ) { } public boolean isInterface ( ) { } protected void setHandle ( IType handle ) { } protected void setPackageName ( char [ ] name ) { } protected void setSourceFileName ( char [ ] name ) { } protected void setSuperclassName ( char [ ] superclassName ) { } protected void setSuperInterfaceNames ( char [ ] [ ] superInterfaceNames ) { } protected void setTypeParameterNames ( char [ ] [ ] typeParameterNames ) { } protected void setTypeParameterBounds ( char [ ] [ ] [ ] typeParameterBounds ) { } public String toString ( ) { } }

Fix:
boundSignatures [ j ] = Signature . createCharArrayTypeSignature ( bounds [ j ] , false ) ;
Buggy code:
public class AntPathMatcher implements PathMatcher { public static final String DEFAULT_PATH_SEPARATOR = "//" ; private String pathSeparator = AntPathMatcher . DEFAULT_PATH_SEPARATOR ; public void setPathSeparator ( String pathSeparator ) { } public boolean isPattern ( String path ) { } public boolean match ( String pattern , String path ) { } public boolean matchStart ( String pattern , String path ) { } protected boolean doMatch ( String pattern , String path , boolean fullMatch , Map < String , String > uriTemplateVariables ) { } private boolean matchStrings ( String pattern , String str , Map < String , String > uriTemplateVariables ) { } public String extractPathWithinPattern ( String pattern , String path ) { } public Map < String , String > extractUriTemplateVariables ( String pattern , String path ) { } public String combine ( String pattern1 , String pattern2 ) { } public Comparator < String > getPatternComparator ( String path ) { } private static class AntPatternComparator implements Comparator < String > { private final String path ; private AntPatternComparator ( String path ) { } public int compare ( String pattern1 , String pattern2 ) { if ( ( pattern1 == null ) && ( pattern2 == null ) ) { return 0 ; } else if ( pattern1 == null ) { return 1 ; } else if ( pattern2 == null ) { return - 1 ; } boolean pattern1EqualsPath = pattern1 . equals ( path ) ; boolean pattern2EqualsPath = pattern2 . equals ( path ) ; if ( pattern1EqualsPath && pattern2EqualsPath ) { return 0 ; } else if ( pattern1EqualsPath ) { return - 1 ; } else if ( pattern2EqualsPath ) { return 1 ; } int wildCardCount1 = StringUtils . countOccurrencesOf ( pattern1 , "*" ) ; int wildCardCount2 = StringUtils . countOccurrencesOf ( pattern2 , "*" ) ; if ( wildCardCount1 < wildCardCount2 ) { return - 1 ; } else if ( wildCardCount2 < wildCardCount1 ) { return 1 ; } int bracketCount1 = StringUtils . countOccurrencesOf ( pattern1 , "{" ) ; int bracketCount2 = StringUtils . countOccurrencesOf ( pattern2 , "{" ) ; if ( bracketCount1 < bracketCount2 ) { return - 1 ; } else if ( bracketCount2 < bracketCount1 ) { return 1 ; } <START_BUG> return 0 ; <END_BUG> } } }

Fix:
return ( pattern2 . length ( ) ) - ( pattern1 . length ( ) ) ;
Buggy code:
public class OpenOrbReferenceContextWrapperFactory extends CNCtxFactory { public Context getInitialContext ( Hashtable env ) throws NamingException { env . put ( "java.naming.factory.initial" , "org.openorb.rmi.jndi.CtxFactory" ) ; <START_BUG> return new IIOPReferenceContextWrapper ( super . getInitialContext ( env ) ) ; <END_BUG> } }

Fix:
return IIOPReferenceContextWrapper . getSingleInstance ( super . getInitialContext ( env ) ) ;
Buggy code:
public class ProfilePanel extends BoardObject { private ProximityFont levelText ; private int levelXP ; private static int width = 200 ; private static int height = 200 ; private ShapeRenderer shapeRenderer = new ShapeRenderer ( ) ; public ProfilePanel ( ) { } public void updateExperience ( ) { Player player = GameData . getInstance ( ) . getPlayer ( ) ; int level = ( ( int ) ( player . getLevel ( ) ) ) ; <START_BUG> levelText . setText ( ( ( ( "" + ( player . getExperience ( ) ) ) + ",<seq2seq4repair_space>" ) + ( player . getLevel ( ) ) ) ) ; <END_BUG> } private ProximityFont createFont ( float x , float y , String s ) { } public void render ( SpriteBatch batch ) { } }

Fix:
levelText . setText ( ( ( ( "" + ( player . getExperience ( ) ) ) + ",<seq2seq4repair_space>" ) + level ) ) ;
Buggy code:
public class ClasspathEntry implements IClasspathEntry { public int entryKind ; public int contentKind ; public IPath path ; public IPath [ ] exclusionPatterns ; private char [ ] [ ] fullCharExclusionPatterns ; private static final char [ ] [ ] UNINIT_PATTERNS = new char [ ] [ ] { "Non-initialized<seq2seq4repair_space>yet" . toCharArray ( ) } ; private String rootID ; public static final IPath [ ] NO_EXCLUSION_PATTERNS = new IPath [ ] { } ; public IPath sourceAttachmentPath ; public IPath sourceAttachmentRootPath ; public IPath specificOutputLocation ; public static final int K_OUTPUT = 10 ; public boolean isExported ; public ClasspathEntry ( int contentKind , int entryKind , IPath path , IPath [ ] exclusionPatterns , IPath sourceAttachmentPath , IPath sourceAttachmentRootPath , IPath specificOutputLocation , boolean isExported ) { } public char [ ] [ ] fullExclusionPatternChars ( ) { if ( ( this . fullCharExclusionPatterns ) == ( ClasspathEntry . UNINIT_PATTERNS ) ) { int length = this . exclusionPatterns . length ; this . fullCharExclusionPatterns = new char [ length ] [ ] ; <START_BUG> IPath prefixPath = path . removeTrailingSeparator ( ) ; <END_BUG> for ( int i = 0 ; i < length ; i ++ ) { this . fullCharExclusionPatterns [ i ] = prefixPath . append ( this . exclusionPatterns [ i ] ) . toString ( ) . toCharArray ( ) ; } } return this . fullCharExclusionPatterns ; } public void elementEncode ( XMLWriter writer , IPath projectPath , boolean indent , boolean newLine ) { } public static IClasspathEntry elementDecode ( Element element , IJavaProject project ) { } public boolean equals ( Object object ) { } public int getContentKind ( ) { } public int getEntryKind ( ) { } public IPath [ ] getExclusionPatterns ( ) { } public IPath getOutputLocation ( ) { } public IPath getPath ( ) { } public IPath getSourceAttachmentPath ( ) { } public IPath getSourceAttachmentRootPath ( ) { } public int hashCode ( ) { } public boolean isExported ( ) { } static int kindFromString ( String kindStr ) { } static String kindToString ( int kind ) { } public String toString ( ) { } public String rootID ( ) { } public IClasspathEntry getResolvedEntry ( ) { } public static IJavaModelStatus validateClasspath ( IJavaProject javaProject , IClasspathEntry [ ] rawClasspath , IPath projectOutputLocation ) { } public static IJavaModelStatus validateClasspathEntry ( IJavaProject project , IClasspathEntry entry , boolean checkSourceAttachment , boolean recurseInContainers ) { } }

Fix:
IPath prefixPath = this . path . removeTrailingSeparator ( ) ;
Buggy code:
public class DataBaseService { public final String DEBUG_TAG = DataBaseService . class . getSimpleName ( ) ; private static final DataBaseService instance = new DataBaseService ( ) ; private MySQLConnection databaseConnection ; private SessionFactory sessionFactory ; public enum CreationMode { CREATE , CREATE_DROP , UPDATE , VALIDATE ; } public enum DataType { LOGIC , USER , MESSAGE , MODULE ; } public static DataBaseService getInstance ( ) { } private DataBaseService ( ) { } public void init ( ) { } private boolean dataBaseSetUp ( ) { } private boolean dataBaseAvailable ( ) { } private void createDatabase ( ) { } private void initSession ( DataBaseService . CreationMode mode ) { } private SessionFactory buildSessionFactory ( String creationMode ) { } public SessionFactory getSessionFactory ( ) { } public void insert ( Object object ) { } public List readAll ( DataBaseService . DataType type ) { String query = null ; switch ( type ) { case LOGIC : query = "from<seq2seq4repair_space>Logic" ; break ; case USER : query = "from<seq2seq4repair_space>User" ; break ; case MESSAGE : query = "from<seq2seq4repair_space>NotificationMessage" ; break ; case MODULE : <START_BUG> query = "Module" ; <END_BUG> break ; } Session session = sessionFactory . openSession ( ) ; List list = session . createQuery ( query ) . list ( ) ; session . close ( ) ; return list ; } public List readId ( DataBaseService . DataType type , int id ) { } public boolean moduleExists ( String serialAddress ) { } public String generateSerialAddress ( ) { } public void runTest ( ) { } public void writeTestLogic ( ) { } public void readLogic ( ) { } public void printLogic ( Logic l ) { } }

Fix:
query = "from<seq2seq4repair_space>Module" ;
Buggy code:
public class videoPlayback { public static void main ( String [ ] args ) { try { <START_BUG> if ( ( args . length ) < 1 ) { <END_BUG> System . err . println ( "usage:<seq2seq4repair_space>java<seq2seq4repair_space>videoPlayback<seq2seq4repair_space>video.rgb<seq2seq4repair_space>audio.wav" ) ; return ; } String vfilename = args [ 0 ] ; String afilename = args [ 1 ] ; int aDelay = 0 ; int vDelay = 0 ; FileInputStream inputStream = new FileInputStream ( afilename ) ; PlaySound playSound = new PlaySound ( inputStream , aDelay ) ; imageReader imageReader = new imageReader ( vfilename , playSound , vDelay ) ; Thread t1 = new Thread ( playSound ) ; Thread t2 = new Thread ( imageReader ) ; t1 . start ( ) ; t2 . start ( ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } } }

Fix:
if ( ( args . length ) < 2 ) {
Buggy code:
public class ScoreCheckerService extends Service { private final String TAG = "SERVICE" ; public static int pendingModulesCount = NearbyModules . getCount ( ) ; private Timer timer = new Timer ( "timer" ) ; private TimerTask scoresChangedTask = new ScoresChangedTask ( ) ; private TimerTask moduleDatesUpdateTask = new ModuleDatesUpdateTask ( ) ; public ScoreCheckerService ( ) { } @ Override public IBinder onBind ( Intent intent ) { } @ Override public void onCreate ( ) { } @ Override public int onStartCommand ( Intent intent , int flags , int startId ) { } @ Override public void onDestroy ( ) { } public void onEvent ( LoginEvent event ) { } public void onEvent ( InternetConnectionPresent event ) { } public void onEvent ( LogoutEvent event ) { } public void onEvent ( InternetConnectionAbsent event ) { } private void startServiceTimer ( ) { } private void scheduleModuleDatesUpdateTask ( ) { } private void scheduleScoresChangedTask ( ) { scoresChangedTask = new ScoresChangedTask ( ) ; ModuleDatesUpdateTask . updatePendingModulesCount ( ) ; if ( ( ScoreCheckerService . pendingModulesCount ) > 0 ) { Log . d ( TAG , ( ( "" + ( ScoreCheckerService . pendingModulesCount ) ) + "<seq2seq4repair_space>modules<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>near<seq2seq4repair_space>2<seq2seq4repair_space>days" ) ) ; <START_BUG> timer . schedule ( scoresChangedTask , 0 , TimeUnit . HOURS . toMillis ( 2 ) ) ; <END_BUG> } else { Log . d ( TAG , "No<seq2seq4repair_space>modules<seq2seq4repair_space>dates<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>near<seq2seq4repair_space>2<seq2seq4repair_space>days" ) ; } } private void stopServiceTimer ( ) { } }

Fix:
timer . schedule ( scoresChangedTask , 0 , TimeUnit . SECONDS . toMillis ( 10 ) ) ;
Buggy code:
@ Root public class Game { @ Element private Date startDate = new Date ( ) ; @ ElementList private List < HandResult > handResults = new ArrayList < HandResult > ( ) ; public Date getStartDate ( ) { } public int getNSScore ( ) { } public int getEWScore ( ) { } public PLAYER getCurrentDealer ( ) { } public int getHandNumber ( ) { } public List < HandResult > getHandResults ( ) { } public void clearHandResults ( ) { } public void addHandResult ( HandResult result ) { } public HandResult getHandResult ( int handNumber ) { } public void removeLastResult ( ) { if ( ( handResults . size ( ) ) > 0 ) { <START_BUG> handResults . remove ( ( ( handResults . size ( ) ) - 1 ) ) ; <END_BUG> } } public static VULNERABILITY getVulnerability ( int handNumber , PLAYER biddingPlayer ) { } public VULNERABILITY getVulnerability ( PLAYER biddingPlayer ) { } public Game ( ) { } }

Fix:
handResults . remove ( 0 ) ;
Buggy code:
public class ConstantTimer extends AbstractTestElement implements Serializable , LoopIterationListener , Timer { public static final String DELAY = "ConstantTimer.delay" ; private long delay = 0 ; public ConstantTimer ( ) { } public void setDelay ( String delay ) { } public void setRange ( double range ) { } public String getDelay ( ) { } public double getRange ( ) { <START_BUG> return ( ( double ) ( 0 ) ) ; <END_BUG> } public long delay ( ) { } public String toString ( ) { } public void iterationStart ( LoopIterationEvent event ) { } }

Fix:
return 0 ;
Buggy code:
public abstract class Objects implements NumericTypes { static HashMap primitiveDefaults = new HashMap ( ) ; public static BigDecimal bigDecValue ( Object value ) throws NumberFormatException { } public static BigInteger bigIntValue ( Object value ) throws NumberFormatException { } public static boolean booleanValue ( Object value ) { } public static Object clone ( final Object object ) { if ( object == null ) { return null ; } else { try { <START_BUG> final ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; <END_BUG> new ObjectOutputStream ( out ) . writeObject ( object ) ; return new ObjectInputStream ( new ByteArrayInputStream ( out . toByteArray ( ) ) ) . readObject ( ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( "Internal<seq2seq4repair_space>error<seq2seq4repair_space>cloning<seq2seq4repair_space>object" , e ) ; } catch ( IOException e ) { throw new RuntimeException ( "Internal<seq2seq4repair_space>error<seq2seq4repair_space>cloning<seq2seq4repair_space>object" , e ) ; } } } public static int compareWithConversion ( Object v1 , Object v2 ) { } public static Object convertValue ( Object value , Class toType ) { } public static double doubleValue ( Object value ) throws NumberFormatException { } public static boolean equal ( final Object a , final Object b ) { } public static int getNumericType ( int t1 , int t2 , boolean canBeNonNumeric ) { } public static int getNumericType ( Object value ) { } public static int getNumericType ( Object v1 , Object v2 ) { } public static int getNumericType ( Object v1 , Object v2 , boolean canBeNonNumeric ) { } public static boolean isEqual ( Object object1 , Object object2 ) { } public static long longValue ( Object value ) throws NumberFormatException { } public static Number newInteger ( int type , long value ) { } public static long sizeof ( final Object object ) { } public static String stringValue ( Object value ) { } public static String stringValue ( Object value , boolean trim ) { } private Objects ( ) { } }

Fix:
final ByteArrayOutputStream out = new ByteArrayOutputStream ( 256 ) ;
Buggy code:
public class ThreeOfkindSpecificationTest { @ Test public void testNoThreeOfKind ( ) { } @ Test public void testThreeOfKindWithOnCardHand ( ) { Board board = new Board ( ) ; Card card = Card . newBuilder ( ) . value ( EIGHT ) . suit ( CLUBS ) . build ( ) ; board . addCard ( card ) ; Card card1 = Card . newBuilder ( ) . value ( FIVE ) . suit ( CLUBS ) . build ( ) ; board . addCard ( card1 ) ; Card card2 = Card . newBuilder ( ) . value ( EIGHT ) . suit ( HEARTS ) . build ( ) ; board . addCard ( card2 ) ; Card card3 = Card . newBuilder ( ) . value ( NINE ) . suit ( HEARTS ) . build ( ) ; board . addCard ( card3 ) ; Card card4 = Card . newBuilder ( ) . value ( TWO ) . suit ( HEARTS ) . build ( ) ; board . addCard ( card4 ) ; <START_BUG> Hand hand = Hand . newBuilder ( ) . firstCard ( FIVE , SPADES ) . secondCard ( EIGHT , SPADES ) . build ( ) ; <END_BUG> ThreeOfKindSpecification specification = new ThreeOfKindSpecification ( board ) ; Assert . assertTrue ( specification . isSatisfiedBy ( hand ) ) ; } @ Test public void testThreeOfKindWithPocket ( ) { } @ Test public void testTheeOfKindOnBoard ( ) { } @ Test public void testFullHouse ( ) { } }

Fix:
Hand hand = Hand . newBuilder ( ) . firstCard ( ACE , SPADES ) . secondCard ( EIGHT , SPADES ) . build ( ) ;
Buggy code:
public class GraphMapperTest { @ Test public void testGetOrCreateList ( ) throws Exception { } @ Test public void testGenerateValuesSimple ( ) throws Exception { } @ Test public void testGenerateValuesSimpleMultiRecipe ( ) throws Exception { GraphMapper < String > graphMapper = new GraphMapper < String > ( ) ; graphMapper . setValue ( "a1" , 1 , FixAndInherit ) ; graphMapper . addConversion ( 1 , "c4" , Arrays . asList ( "a1" , "a1" , "a1" , "a1" ) ) ; graphMapper . addConversion ( 2 , "c4" , Arrays . asList ( "b2" , "b2" ) ) ; graphMapper . addConversion ( 1 , "b2" , Arrays . asList ( "a1" , "a1" ) ) ; Map < String , Double > values = graphMapper . generateValues ( ) ; assertEquals ( 1 , GraphMapperTest . getValue ( values , "a1" ) ) ; assertEquals ( 2 , GraphMapperTest . getValue ( values , "b2" ) ) ; <START_BUG> assertEquals ( 4 , GraphMapperTest . getValue ( values , "c4" ) ) ; <END_BUG> } @ Test public void testGenerateValuesSimpleFixedAfterInherit ( ) throws Exception { } @ Test public void testGenerateValuesSimpleFixedDoNotInherit ( ) throws Exception { } @ Test public void testGenerateValuesSimpleSelectMinValue ( ) throws Exception { } @ Test public void testGenerateValuesSimpleSelectMinValueWithDependency ( ) throws Exception { } @ Test public void testGenerateValuesSimpleWoodToWorkBench ( ) throws Exception { } private static < T , V extends Number > int getValue ( Map < T , V > map , T key ) { } No newline ; at end ; of file ; }

Fix:
assertEquals ( 2 , GraphMapperTest . getValue ( values , "c4" ) ) ;
Buggy code:
public class StreamInSession { private static final Logger logger = LoggerFactory . getLogger ( StreamInSession . class ) ; private static ConcurrentMap < Pair < InetAddress , Long > , StreamInSession > sessions = new org . cliffc . high_scale_lib . NonBlockingHashMap < Pair < InetAddress , Long > , StreamInSession > ( ) ; private final List < PendingFile > files = new ArrayList < PendingFile > ( ) ; private final Pair < InetAddress , Long > context ; private final Runnable callback ; private String table ; private final List < Future < SSTableReader > > buildFutures = new ArrayList < Future < SSTableReader > > ( ) ; private ColumnFamilyStore cfs ; private PendingFile current ; private StreamInSession ( Pair < InetAddress , Long > context , Runnable callback ) { } public static StreamInSession create ( InetAddress host , Runnable callback ) { } public static StreamInSession get ( InetAddress host , long sessionId ) { } public void setCurrentFile ( PendingFile file ) { } public void setTable ( String table ) { } public void addFiles ( Collection < PendingFile > files ) { } public void finished ( PendingFile remoteFile , PendingFile localFile ) throws IOException { if ( StreamInSession . logger . isDebugEnabled ( ) ) StreamInSession . logger . debug ( "Finished<seq2seq4repair_space>{}.<seq2seq4repair_space>Sending<seq2seq4repair_space>ack<seq2seq4repair_space>to<seq2seq4repair_space>{}" , remoteFile , this ) ; <START_BUG> Future future = instance . submitSSTableBuild ( localFile . desc ) ; <END_BUG> buildFutures . add ( future ) ; files . remove ( remoteFile ) ; if ( remoteFile . equals ( current ) ) current = null ; StreamReply reply = new StreamReply ( remoteFile . getFilename ( ) , getSessionId ( ) , Status . FILE_FINISHED ) ; MessagingService . instance . sendOneWay ( reply . createMessage ( ) , getHost ( ) ) ; } public void retry ( PendingFile remoteFile ) throws IOException { } public void closeIfFinished ( ) throws IOException { } public long getSessionId ( ) { } public InetAddress getHost ( ) { } public static Set < InetAddress > getSources ( ) { } public static Set < PendingFile > getIncomingFiles ( InetAddress host ) { } }

Fix:
Future future = instance . submitSSTableBuild ( localFile . desc , remoteFile . type ) ;
Buggy code:
public class MultiLineLabel extends WebComponent { private static final long serialVersionUID = 1L ; public MultiLineLabel ( final String id ) { } public MultiLineLabel ( final String id , String label ) { } public MultiLineLabel ( final String id , IModel model ) { } protected void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { <START_BUG> final String body = Strings . toMultilineMarkup ( getModelObjectAsString ( ) ) ; <END_BUG> replaceComponentTagBody ( markupStream , openTag , body ) ; } }

Fix:
final CharSequence body = Strings . toMultilineMarkup ( getModelObjectAsString ( ) ) ;
Buggy code:
public class LDAPStoreResourceDefinition extends AbstractIdentityStoreResourceDefinition { public static final SensitiveTargetAccessConstraintDefinition BASE_DN_SUFFIX_CONSTRAINT = new SensitiveTargetAccessConstraintDefinition ( new org . jboss . as . controller . access . constraint . SensitivityClassification ( IDMExtension . SUBSYSTEM_NAME , "base-dn-suffix" , false , true , true ) ) ; public static final SimpleAttributeDefinition URL = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( ModelElement . LDAP_STORE_URL . getName ( ) , org . jboss . dmr . ModelType . STRING , false ) . setAllowExpression ( true ) . build ( ) ; public static final SimpleAttributeDefinition BIND_DN = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( ModelElement . LDAP_STORE_BIND_DN . getName ( ) , org . jboss . dmr . ModelType . STRING , false ) . setAccessConstraints ( SensitiveTargetAccessConstraintDefinition . CREDENTIAL ) . setAllowExpression ( true ) . build ( ) ; public static final SimpleAttributeDefinition BIND_CREDENTIAL = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( ModelElement . LDAP_STORE_BIND_CREDENTIAL . getName ( ) , org . jboss . dmr . ModelType . STRING , false ) . setAccessConstraints ( SensitiveTargetAccessConstraintDefinition . CREDENTIAL ) . setAllowExpression ( true ) . build ( ) ; public static final SimpleAttributeDefinition BASE_DN_SUFFIX = new org . jboss . as . controller . SimpleAttributeDefinitionBuilder ( ModelElement . LDAP_STORE_BASE_DN_SUFFIX . getName ( ) , org . jboss . dmr . ModelType . STRING , false ) . setAccessConstraints ( LDAPStoreResourceDefinition . BASE_DN_SUFFIX_CONSTRAINT ) . setAllowExpression ( true ) . build ( ) ; public static final LDAPStoreResourceDefinition INSTANCE = new LDAPStoreResourceDefinition ( LDAPStoreResourceDefinition . URL , LDAPStoreResourceDefinition . BIND_DN , LDAPStoreResourceDefinition . BIND_CREDENTIAL , LDAPStoreResourceDefinition . BASE_DN_SUFFIX , SUPPORT_ATTRIBUTE , SUPPORT_CREDENTIAL ) ; private LDAPStoreResourceDefinition ( SimpleAttributeDefinition ... attributes ) { } @ Override public void registerChildren ( ManagementResourceRegistration resourceRegistration ) { } private static ModelValidationStepHandler [ ] getModelValidators ( ) { <START_BUG> return new ModelValidationStepHandler [ ] { new NotEmptyResourceValidationStepHandler ( ) , new org . wildfly . extension . picketlink . common . model . validator . RequiredChildValidationStepHandler ( ModelElement . SUPPORTED_TYPES ) } ; <END_BUG> } }

Fix:
return new ModelValidationStepHandler [ ] { NotEmptyResourceValidationStepHandler . INSTANCE , new org . wildfly . extension . picketlink . common . model . validator . RequiredChildValidationStepHandler ( ModelElement . SUPPORTED_TYPES ) } ;
Buggy code:
public class ServerRegisteryFactory { private ServerFactory serverFactory ; public ServerRegisteryFactory ( ServerFactory serverFactory ) { } public ServerRegistery create ( ) { <START_BUG> Server thisServer = serverFactory . createThisServer ( 0 ) ; <END_BUG> Multicaster multicaster = new Multicaster ( thisServer ) ; Repository repository = new Repository ( thisServer ) ; MulticastServerRegistery multicastServerRegistery = new MulticastServerRegistery ( multicaster , repository , serverFactory ) ; return multicastServerRegistery ; } }

Fix:
Server thisServer = serverFactory . createThisServer ( ) ;
Buggy code:
public class DiffMain { public static void main ( String [ ] args ) throws Exception { CommandLine cli = DIFF . parse ( args ) ; File orig = new File ( cli . getOptionValue ( DiffArguments . BEFORE ) ) ; File target = new File ( cli . getOptionValue ( DiffArguments . AFTER ) ) ; BadiffFileDiff output = new BadiffFileDiff ( cli . getOptionValue ( DiffArguments . OUTPUT ) ) ; String pipeline = cli . getOptionValue ( DiffArguments . PIPELINE ) ; int chunk = Integer . parseInt ( cli . getOptionValue ( DiffArguments . CHUNK ) ) ; ListenableRandomInput oin = new ListenableRandomInput ( new FileRandomInput ( orig ) ) ; ListenableRandomInput tin = new ListenableRandomInput ( new FileRandomInput ( target ) ) ; if ( cli . hasOption ( DiffArguments . VERBOSE ) ) new org . badiff . cli . io . ProgressInputListener ( oin , tin ) ; byte [ ] preHash = Digests . digest ( orig , Digests . defaultDigest ( ) ) ; byte [ ] postHash = Digests . digest ( target , Digests . defaultDigest ( ) ) ; FileDiff tmp = new FileDiff ( output . getParentFile ( ) , ( ( output . getName ( ) ) + ".tmp" ) ) ; OpQueue q ; q = new org . badiff . q . RandomChunkingOpQueue ( oin , tin , chunk ) ; q = new org . badiff . q . ParallelGraphOpQueue ( q , Runtime . getRuntime ( ) . availableProcessors ( ) , chunk , GraphFactory . INERTIAL_GRAPH ) ; q = new org . badiff . p . Pipeline ( q ) . into ( pipeline ) . outlet ( ) ; tmp . store ( q ) ; Header h = new Header ( ) ; <START_BUG> Header . Optional opt = h . new Optional ( ) ; <END_BUG> h . setOptional ( opt ) ; opt . setHashAlgorithm ( Digests . defaultDigest ( ) . getAlgorithm ( ) ) ; opt . setPreHash ( preHash ) ; opt . setPostHash ( postHash ) ; DataOutputStream self = new DataOutputStream ( new FileOutputStream ( output ) ) ; BadiffFileDiff . store ( self , DefaultSerialization . newInstance ( ) , h , tmp . queue ( ) ) ; self . close ( ) ; tmp . delete ( ) ; } }

Fix:
Header . Optional opt = new Header . Optional ( ) ;
Buggy code:
public class TestMaxTermFrequency extends LuceneTestCase { Directory dir ; IndexReader reader ; ArrayList < Integer > expected = new ArrayList < Integer > ( ) ; @ Override public void setUp ( ) throws Exception { super . setUp ( ) ; dir = newDirectory ( ) ; IndexWriterConfig config = newIndexWriterConfig ( TEST_VERSION_CURRENT , new org . apache . lucene . analysis . MockAnalyzer ( random , MockTokenizer . SIMPLE , true ) ) . setMergePolicy ( newLogMergePolicy ( ) ) ; config . setSimilarity ( new TestMaxTermFrequency . TestSimilarity ( ) ) ; RandomIndexWriter writer = new RandomIndexWriter ( random , dir , config ) ; Document doc = new Document ( ) ; Field foo = newField ( "foo" , "" , TYPE_UNSTORED ) ; doc . add ( foo ) ; for ( int i = 0 ; i < 100 ; i ++ ) { <START_BUG> foo . setValue ( addValue ( ) ) ; <END_BUG> writer . addDocument ( doc ) ; } reader = writer . getReader ( ) ; writer . close ( ) ; } @ Override public void tearDown ( ) throws Exception { } public void test ( ) throws Exception { } private String addValue ( ) { } class TestSimilarity extends DefaultSimilarity { @ Override public byte encodeNormValue ( float f ) { } @ Override public float decodeNormValue ( byte b ) { } @ Override public void computeNorm ( FieldInvertState state , Norm norm ) { } } }

Fix:
foo . setStringValue ( addValue ( ) ) ;