nus-yam/ex-repair huggingface dataset:
Buggy code:
class FilePicker { XPCOMObject supports ; XPCOMObject filePicker ; int refCount = 0 ; int mode ; int parentHandle ; String [ ] files ; String [ ] masks ; String defaultFilename ; String directory ; String title ; static final String SEPARATOR = System . getProperty ( "file.separator" ) ; public FilePicker ( ) { } int AddRef ( ) { } void createCOMInterfaces ( ) { } void disposeCOMInterfaces ( ) { } int getAddress ( ) { } int QueryInterface ( int riid , int ppvObject ) { if ( ( riid == 0 ) || ( ppvObject == 0 ) ) return XPCOM . NS_ERROR_NO_INTERFACE ; nsID guid = new nsID ( ) ; XPCOM . memmove ( guid , riid , sizeof ) ; if ( guid . Equals ( NS_ISUPPORTS_IID ) ) { XPCOM . memmove ( ppvObject , new int [ ] { supports . getAddress ( ) } , PTR_SIZEOF ) ; AddRef ( ) ; return XPCOM . NS_OK ; } if ( guid . Equals ( NS_IFILEPICKER_IID ) ) { XPCOM . memmove ( ppvObject , new int [ ] { filePicker . getAddress ( ) } , PTR_SIZEOF ) ; AddRef ( ) ; return XPCOM . NS_OK ; } <START_BUG> if ( guid . Equals ( NS_IFILEPICKER_1_8_IID ) ) { <END_BUG> XPCOM . memmove ( ppvObject , new int [ ] { filePicker . getAddress ( ) } , PTR_SIZEOF ) ; AddRef ( ) ; return XPCOM . NS_OK ; } XPCOM . memmove ( ppvObject , new int [ ] { 0 } , PTR_SIZEOF ) ; return XPCOM . NS_ERROR_NO_INTERFACE ; } int Release ( ) { } String parseAString ( int string ) { } int Init ( int parent , int title , int mode ) { } int Show ( int _retval ) { } int showDirectoryPicker ( ) { } int GetFiles ( int aFiles ) { } int GetFileURL ( int aFileURL ) { } int GetFile ( int aFile ) { } int SetDisplayDirectory ( int aDisplayDirectory ) { } int GetDisplayDirectory ( int aDisplayDirectory ) { } int SetFilterIndex ( int aFilterIndex ) { } int GetFilterIndex ( int aFilterIndex ) { } int SetDefaultExtension ( int aDefaultExtension ) { } int GetDefaultExtension ( int aDefaultExtension ) { } int SetDefaultString ( int aDefaultString ) { } int GetDefaultString ( int aDefaultString ) { } int AppendFilter ( int title , int filter ) { } int AppendFilters ( int filterMask ) { } }

Fix:
if ( guid . Equals ( nsIFilePicker_1_8 . NS_IFILEPICKER_IID ) ) {
Buggy code:
public class TargetMonitor extends AntEditor { private JLabel _text = null ; private String _defText = null ; public TargetMonitor ( AppContext context ) { } private void setText ( String text ) { } private class Handler implements BusMember { private final TargetMonitor . Filter _filter = new TargetMonitor . Filter ( ) ; public BusFilter getBusFilter ( ) { } public boolean eventPosted ( EventObject event ) { ElementSelectionEvent e = ( ( ElementSelectionEvent ) ( event ) ) ; String text = _defText ; <START_BUG> ProjectProxy p = getAppContext ( ) . getProject ( ) ; <END_BUG> if ( p != null ) { ElementSelectionModel selections = p . getTreeSelectionModel ( ) ; ACSTargetElement [ ] targets = selections . getSelectedTargets ( ) ; if ( ( targets != null ) && ( ( targets . length ) > 0 ) ) { StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < ( targets . length ) ; i ++ ) { buf . append ( targets [ i ] . getName ( ) ) ; if ( i < ( ( targets . length ) - 1 ) ) { buf . append ( ",<seq2seq4repair_space>" ) ; } } text = buf . toString ( ) ; } } setText ( text ) ; return true ; } } private static class Filter implements BusFilter { public boolean accept ( EventObject event ) { } } }

Fix:
ProjectProxy p = getContext ( ) . getProject ( ) ;
Buggy code:
public class IntSum extends AbstractFunction implements Serializable { private static final long serialVersionUID = 232L ; private static final List desc = new LinkedList ( ) ; private static final String KEY = "__intSum" ; private Object [ ] values ; public IntSum ( ) { } public Object clone ( ) throws CloneNotSupportedException { } public synchronized String execute ( SampleResult previousResult , Sampler currentSampler ) throws InvalidVariableException { JMeterVariables vars = getVariables ( ) ; int sum = 0 ; String varName = ( ( org . apache . jmeter . engine . util . CompoundVariable ) ( values [ ( ( values . length ) - 1 ) ] ) ) . execute ( ) ; for ( int i = 0 ; i < ( ( values . length ) - 1 ) ; i ++ ) { sum += Integer . parseInt ( ( ( org . apache . jmeter . engine . util . CompoundVariable ) ( values [ i ] ) ) . execute ( ) ) ; } try { sum += Integer . parseInt ( varName ) ; varName = null ; } catch ( NumberFormatException ignored ) { } String totalString = Integer . toString ( sum ) ; if ( ( vars != null ) && ( varName != null ) ) { <START_BUG> vars . put ( varName , totalString ) ; <END_BUG> } return totalString ; } public synchronized void setParameters ( Collection parameters ) throws InvalidVariableException { } public String getReferenceKey ( ) { } public List getArgumentDesc ( ) { } }

Fix:
vars . put ( varName . trim ( ) , totalString ) ;
Buggy code:
public class ToolBar extends Composite { int itemCount ; ToolItem [ ] items ; public ToolBar ( Composite parent , int style ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void createItem ( ToolItem item , int index ) { } void createWidget ( ) { } int defaultThemeFont ( ) { } void destroyItem ( ToolItem item ) { } void drawBackground ( int control , int context ) { <START_BUG> drawBackground ( control , context , background ) ; <END_BUG> } void enableWidget ( boolean enabled ) { } public ToolItem getItem ( int index ) { } public ToolItem getItem ( Point pt ) { } public int getItemCount ( ) { } public ToolItem [ ] getItems ( ) { } public int getRowCount ( ) { } public int indexOf ( ToolItem item ) { } void invalidateChildrenVisibleRegion ( int control ) { } int [ ] layoutHorizontal ( int width , int height , boolean resize ) { } int [ ] layoutVertical ( int width , int height , boolean resize ) { } int [ ] layout ( int nWidth , int nHeight , boolean resize ) { } void relayout ( ) { } void releaseChildren ( boolean destroy ) { } void removeControl ( Control control ) { } void setBackground ( float [ ] color ) { } int setBounds ( int x , int y , int width , int height , boolean move , boolean resize , boolean events ) { } void setFontStyle ( Font font ) { } void setForeground ( float [ ] color ) { } public void setRedraw ( boolean redraw ) { } }

Fix:
fillBackground ( control , context , null ) ;
Buggy code:
public class ExampleRunner { public static void main ( String [ ] args ) throws Exception { ModelControllerClient client = null ; try { System . out . println ( "Connecting" ) ; client = Factory . create ( InetAddress . getByName ( "localhost" ) , 9999 ) ; System . out . println ( "Connected" ) ; System . out . println ( "Dumping<seq2seq4repair_space>config<seq2seq4repair_space>as<seq2seq4repair_space>xml\n" ) ; ModelNode request = new ModelNode ( ) ; request . get ( "operation" ) . set ( "read-config-as-xml" ) ; request . get ( "address" ) . setEmptyList ( ) ; ModelNode r = client . execute ( request ) ; <START_BUG> System . out . println ( r . asString ( ) ) ; <END_BUG> } finally { StreamUtils . safeClose ( client ) ; System . out . println ( "Closed" ) ; } } }

Fix:
System . out . println ( r . get ( "result" ) . asString ( ) ) ;
Buggy code:
public class FDistributionTest extends ContinuousDistributionAbstractTest { public FDistributionTest ( String name ) { } public ContinuousDistribution makeDistribution ( ) { <START_BUG> return DistributionFactory . newInstance ( ) . createFDistribution ( 5.0 , 6.0 ) ; <END_BUG> } public double [ ] makeCumulativeTestPoints ( ) { } public double [ ] makeCumulativeTestValues ( ) { } protected void setup ( ) throws Exception { } public void testCumulativeProbabilityExtremes ( ) throws Exception { } public void testInverseCumulativeProbabilityExtremes ( ) throws Exception { } public void testDfAccessors ( ) { } public void testLargeDegreesOfFreedom ( ) throws Exception { } }

Fix:
return new FDistributionImpl ( 5.0 , 6.0 ) ;
Buggy code:
public class ModClusterStopContext implements OperationStepHandler { static final ModClusterStopContext INSTANCE = new ModClusterStopContext ( ) ; static OperationDefinition getDefinition ( ResourceDescriptionResolver descriptionResolver ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { if ( ( context . isNormalServer ( ) ) && ( ( context . getServiceRegistry ( false ) . getService ( SERVICE_NAME ) ) != null ) ) { context . addStep ( new OperationStepHandler ( ) { @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { ServiceController < ? > controller = context . getServiceRegistry ( false ) . getService ( SERVICE_NAME ) ; final ModClusterServiceMBean service = ( ( ModClusterServiceMBean ) ( controller . getValue ( ) ) ) ; ModClusterLogger . ROOT_LOGGER . debugf ( "stop-context:<seq2seq4repair_space>%s" , operation ) ; final String webHost = ModClusterSubsystemResourceDefinition . VIRTUAL_HOST . resolveModelAttribute ( context , operation ) . asString ( ) ; final String webContext = ModClusterSubsystemResourceDefinition . CONTEXT . resolveModelAttribute ( context , operation ) . asString ( ) ; final int waitTime = ModClusterSubsystemResourceDefinition . WAIT_TIME . resolveModelAttribute ( context , operation ) . asInt ( ) ; try { service . stopContext ( webHost , webContext , waitTime , TimeUnit . SECONDS ) ; } catch ( IllegalArgumentException e ) { <START_BUG> throw new OperationFailedException ( new ModelNode ( ) . set ( ROOT_LOGGER . contextOrHostNotFound ( webHost , webContext ) ) ) ; <END_BUG> } context . completeStep ( new OperationContext . RollbackHandler ( ) { @ Override public void handleRollback ( OperationContext context , ModelNode operation ) { service . enableContext ( webHost , webContext ) ; } } ) ; } } , RUNTIME ) ; } context . stepCompleted ( ) ; } }

Fix:
throw new OperationFailedException ( new ModelNode ( ) . set ( ROOT_LOGGER . ContextOrHostNotFound ( webHost , webContext ) ) ) ;
Buggy code:
public class TestLazyBug extends LuceneTestCase { public static int NUM_DOCS = 500 ; public static int NUM_FIELDS = 100 ; private static String [ ] data = new String [ ] { "now" , "is<seq2seq4repair_space>the<seq2seq4repair_space>time" , "for<seq2seq4repair_space>all<seq2seq4repair_space>good<seq2seq4repair_space>men" , "to<seq2seq4repair_space>come<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>aid" , "of<seq2seq4repair_space>their<seq2seq4repair_space>country!" , "this<seq2seq4repair_space>string<seq2seq4repair_space>contains<seq2seq4repair_space>big<seq2seq4repair_space>chars:{đ<seq2seq4repair_space>Ȣ<seq2seq4repair_space>̳<seq2seq4repair_space>ᄑ<seq2seq4repair_space>∢<seq2seq4repair_space>㌳}" , "this<seq2seq4repair_space>string<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>bigger<seq2seq4repair_space>string,<seq2seq4repair_space>mary<seq2seq4repair_space>had<seq2seq4repair_space>a<seq2seq4repair_space>little<seq2seq4repair_space>lamb,<seq2seq4repair_space>little<seq2seq4repair_space>lamb,<seq2seq4repair_space>little<seq2seq4repair_space>lamb!" } ; private static Set dataset = new HashSet ( Arrays . asList ( TestLazyBug . data ) ) ; private static String MAGIC_FIELD = "f" + ( ( TestLazyBug . NUM_FIELDS ) // 3 ) ; private static FieldSelector SELECTOR = new FieldSelector ( ) { public FieldSelectorResult accept ( String f ) { } } ; private Directory makeIndex ( ) throws RuntimeException { } public void doTest ( int [ ] docs ) throws Exception { Directory dir = makeIndex ( ) ; <START_BUG> IndexReader reader = IndexReader . open ( dir ) ; <END_BUG> for ( int i = 0 ; i < ( docs . length ) ; i ++ ) { Document d = reader . document ( docs [ i ] , TestLazyBug . SELECTOR ) ; d . get ( TestLazyBug . MAGIC_FIELD ) ; List fields = d . getFields ( ) ; for ( Iterator fi = fields . iterator ( ) ; fi . hasNext ( ) ; ) { Fieldable f = null ; try { f = ( ( Fieldable ) ( fi . next ( ) ) ) ; String fname = f . name ( ) ; String fval = f . stringValue ( ) ; assertNotNull ( ( ( ( docs [ i ] ) + "<seq2seq4repair_space>FIELD:<seq2seq4repair_space>" ) + fname ) , fval ) ; String [ ] vals = fval . split ( "#" ) ; if ( ( ! ( TestLazyBug . dataset . contains ( vals [ 0 ] ) ) ) || ( ! ( TestLazyBug . dataset . contains ( vals [ 1 ] ) ) ) ) { fail ( ( ( ( "FIELD:" + fname ) + ",VAL:" ) + fval ) ) ; } } catch ( Exception e ) { throw new Exception ( ( ( ( docs [ i ] ) + "<seq2seq4repair_space>WTF:<seq2seq4repair_space>" ) + ( f . name ( ) ) ) , e ) ; } } } reader . close ( ) ; } public void testLazyWorks ( ) throws Exception { } public void testLazyAlsoWorks ( ) throws Exception { } public void testLazyBroken ( ) throws Exception { } }

Fix:
IndexReader reader = IndexReader . open ( dir , true ) ;
Buggy code:
public class XaDataSourceService extends AbstractDataSourceService { private final InjectedValue < XaDataSource > dataSourceConfig = new InjectedValue < XaDataSource > ( ) ; public XaDataSourceService ( final String jndiName ) { } public AS7DataSourceDeployer getDeployer ( ) { <START_BUG> return new AS7DataSourceDeployer ( log , dataSourceConfig . getValue ( ) ) ; <END_BUG> } public Injector < XaDataSource > getDataSourceConfigInjector ( ) { } }

Fix:
return new AS7DataSourceDeployer ( dataSourceConfig . getValue ( ) ) ;
Buggy code:
public class Property extends AbstractTask { private Path m_classpath ; private String m_name ; private String m_resource ; private String m_value ; public void addClasspath ( Path classpath ) throws TaskException { if ( ( m_classpath ) == null ) { m_classpath = classpath ; } else { <START_BUG> m_classpath . addPath ( classpath ) ; <END_BUG> } } public void setLocation ( File location ) { } public void setName ( String name ) { } public void setResource ( String resource ) { } public void setValue ( String value ) { } public void execute ( ) throws TaskException { } private void validate ( ) throws TaskException { } public String toString ( ) { } protected void addProperties ( Properties props ) throws TaskException { } protected void loadResource ( String name ) throws TaskException { } }

Fix:
m_classpath . add ( classpath ) ;
Buggy code:
public class ExampleRunner { public static void main ( String [ ] args ) throws Exception { } protected void run ( ModelControllerClient client ) throws Exception { } void runSysProperties ( final ModelControllerClient client ) throws Exception { } void runPaths ( final ModelControllerClient client ) throws Exception { } void runInterface ( final ModelControllerClient client ) throws IOException { } void runOperationAndRollback ( final ModelNode operation , final ModelNode reversing , final ModelControllerClient client ) throws IOException { } void checkSuccess ( final ModelNode result ) { if ( ( result . hasDefined ( OUTCOME ) ) && ( SUCCESS . equals ( result . get ( OUTCOME ) . asString ( ) ) ) ) { return ; } System . out . println ( ( "Outcome<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>successful:\n" + result ) ) ; if ( result . hasDefined ( "failure-description" ) ) { throw new RuntimeException ( result . get ( "failure-description" ) . toString ( ) ) ; } else if ( result . hasDefined ( "domain-failure-description" ) ) { throw new RuntimeException ( result . get ( "domain-failure-description" ) . toString ( ) ) ; } else if ( result . hasDefined ( "host-failure-descriptions" ) ) { throw new RuntimeException ( result . get ( "host-failure-descriptions" ) . toString ( ) ) ; } else if ( result . isDefined ( ) ) { System . out . println ( result ) ; throw new RuntimeException ( ( "Operation<seq2seq4repair_space>outcome<seq2seq4repair_space>is<seq2seq4repair_space>" + ( result . get ( "outcome" ) . asString ( ) ) ) ) ; } else { <START_BUG> throw new IllegalStateException ( "Result<seq2seq4repair_space>is<seq2seq4repair_space>undefined" ) ; <END_BUG> } } }

Fix:
throw new IllegalStateException ( "ParsedResult<seq2seq4repair_space>is<seq2seq4repair_space>undefined" ) ;
Buggy code:
public class DatacenterShardStategy extends AbstractReplicationStrategy { private static Map < String , List < Token > > dcMap = new HashMap < String , List < Token > > ( ) ; private static Map < String , Integer > dcReplicationFactor = new HashMap < String , Integer > ( ) ; private static Map < String , Integer > quorumRepFactor = new HashMap < String , Integer > ( ) ; private static int locQFactor = 0 ; private static DatacenterEndPointSnitch endPointSnitch ; ArrayList < Token > tokens ; private List < InetAddress > localEndPoints = new ArrayList < InetAddress > ( ) ; private List < InetAddress > getLocalEndPoints ( ) { } private Map < String , Integer > getQuorumRepFactor ( ) { } private synchronized void loadEndPoints ( TokenMetadata metadata ) throws IOException { <START_BUG> DatacenterShardStategy . endPointSnitch = ( ( DatacenterEndPointSnitch ) ( StorageService . instance ( ) . getEndPointSnitch ( ) ) ) ; <END_BUG> this . tokens = new ArrayList < Token > ( tokens ) ; String localDC = DatacenterShardStategy . endPointSnitch . getLocation ( InetAddress . getLocalHost ( ) ) ; DatacenterShardStategy . dcMap = new HashMap < String , List < Token > > ( ) ; for ( Token token : this . tokens ) { InetAddress endPoint = metadata . getEndPoint ( token ) ; String dataCenter = DatacenterShardStategy . endPointSnitch . getLocation ( endPoint ) ; if ( dataCenter . equals ( localDC ) ) { localEndPoints . add ( endPoint ) ; } List < Token > lst = DatacenterShardStategy . dcMap . get ( dataCenter ) ; if ( lst == null ) { lst = new ArrayList < Token > ( ) ; } lst . add ( token ) ; DatacenterShardStategy . dcMap . put ( dataCenter , lst ) ; } for ( Map . Entry < String , List < Token > > entry : DatacenterShardStategy . dcMap . entrySet ( ) ) { List < Token > valueList = entry . getValue ( ) ; Collections . sort ( valueList ) ; DatacenterShardStategy . dcMap . put ( entry . getKey ( ) , valueList ) ; } DatacenterShardStategy . dcReplicationFactor = DatacenterShardStategy . endPointSnitch . getMapReplicationFactor ( ) ; for ( Map . Entry < String , Integer > entry : DatacenterShardStategy . dcReplicationFactor . entrySet ( ) ) { String datacenter = entry . getKey ( ) ; int qFactor = ( ( entry . getValue ( ) ) // 2 ) + 1 ; DatacenterShardStategy . quorumRepFactor . put ( datacenter , qFactor ) ; if ( datacenter . equals ( localDC ) ) { DatacenterShardStategy . locQFactor = qFactor ; } } } public DatacenterShardStategy ( TokenMetadata tokenMetadata , int replicas ) throws UnknownHostException { } public ArrayList < InetAddress > getNaturalEndpoints ( Token token , TokenMetadata metadata ) { } private ArrayList < InetAddress > getNaturalEndpointsInternal ( Token searchToken , TokenMetadata metadata ) throws IOException { } @ Override public WriteResponseHandler getWriteResponseHandler ( int blockFor , ConsistencyLevel consistency_level ) { } }

Fix:
DatacenterShardStategy . endPointSnitch = ( ( DatacenterEndPointSnitch ) ( instance . getEndPointSnitch ( ) ) ) ;
Buggy code:
public class HelpSearchPanel extends JPanel { public HelpSearchPanel ( HelpViewerInterface helpViewer ) { } private HelpViewerInterface helpViewer ; private HistoryTextField searchField ; private JList results ; private HelpIndex index ; private HelpIndex getHelpIndex ( ) { } static class ResultIcon implements Icon { private static RenderingHints renderingHints ; private int rank ; ResultIcon ( int rank ) { } public int getIconWidth ( ) { } public int getIconHeight ( ) { } public void paintIcon ( Component c , Graphics g , int x , int y ) { } } class ResultRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent ( JList list , Object value , int index , boolean isSelected , boolean cellHasFocus ) { } } static class Result { String file ; String title ; int rank ; Result ( HelpIndex . HelpFile file , int count ) { } } static class ResultCompare implements Comparator { public int compare ( Object o1 , Object o2 ) { } } class ActionHandler implements ActionListener { public void actionPerformed ( ActionEvent evt ) { } } public class MouseHandler extends MouseAdapter { public void mouseReleased ( MouseEvent evt ) { int row = results . locationToIndex ( evt . getPoint ( ) ) ; if ( row != ( - 1 ) ) { HelpSearchPanel . Result result = ( ( HelpSearchPanel . Result ) ( results . getModel ( ) . getElementAt ( row ) ) ) ; <START_BUG> helpViewer . gotoURL ( result . file , true ) ; <END_BUG> } } } }

Fix:
helpViewer . gotoURL ( result . file , true , 0 ) ;
Buggy code:
public class Physics2D { private static final String TAG = "Physics2D" ; private int idCtr ; private Plane2D universe ; private List < Body > bodies ; private List < Landmark > landmarks ; private List < Phenomenon > phenomena ; private ArrayList < Entity > entitiesLookupTable ; private int gravConstant ; public Physics2D ( int width , int height ) { } public Physics2D ( JSONObject selfAsJson , int width , int height ) { } private void readBodies ( JSONArray persistent ) { } private void readLandmarks ( JSONArray persistent ) { } private void readPhenomena ( JSONArray persistent ) { } private void writeBodies ( ) { } private void writeLandmarks ( ) { } private void writePhenomena ( ) { } private boolean isPointContained ( Point p , Point center , int xDiff , int yDiff ) { } private void constructEntitiesLookupTable ( ) { } private void constructUniverse ( ) { } private void placeEntities ( ) { } public void createBody ( int id , Point position , int dx0 , int dy0 , int lifespan , List < List < Point > > shapes ) { } public void createLandmark ( int id , Point position , int dTheta , int dx0 , int dy0 , int lifespan , List < List < Point > > shapes ) { } public void createPhenomenon ( int id , Point position , int dx0 , int dy0 , int lifespan , List < List < Point > > shapes ) { } public JSONObject toJSON ( ) { } public void update ( float deltaT ) { } public boolean applyAcceleratingForceToBody ( int entityID , float delta_d2x , float delta_d2y ) { } public Entity getEntity ( int entityID ) { } public List < Entity > observe ( Point center , int xDiff , int yDiff ) { } public List < Landmark > getLandmarks ( ) { } public void setGravConstant ( int gravConstant ) { } public Point getUniverseDimensions ( ) { <START_BUG> return new Point ( this . universe . getPlaneHeight ( ) , this . universe . getPlaneWidth ( ) ) ; <END_BUG> } public List < Entity > getEntities ( ) { } }

Fix:
return new Point ( this . universe . getPlaneWidth ( ) , this . universe . getPlaneHeight ( ) ) ;
Buggy code:
public class ASBuilder implements DOMErrorHandler { protected static final String NAMESPACES_FEATURE_ID = "http:////xml.org//sax//features//namespaces" ; protected static final String VALIDATION_FEATURE_ID = "http:////xml.org//sax//features//validation" ; protected static final String SCHEMA_VALIDATION_FEATURE_ID = "http:////apache.org//xml//features//validation//schema" ; protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http:////apache.org//xml//features//validation//schema-full-checking" ; protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false ; public static void main ( String [ ] argv ) { <START_BUG> if ( ( argv . length ) < 4 ) { <END_BUG> ASBuilder . printUsage ( ) ; System . exit ( 1 ) ; } DOMImplementationAS domImpl = ( ( DOMImplementationAS ) ( DOMImplementationImpl . getDOMImplementation ( ) ) ) ; DOMASBuilder parser = domImpl . createDOMASBuilder ( ) ; parser . setErrorHandler ( new ASBuilder ( ) ) ; boolean schemaFullChecking = ASBuilder . DEFAULT_SCHEMA_FULL_CHECKING ; String arg = null ; int i = 0 ; arg = argv [ i ] ; if ( arg . equals ( "-f" ) ) { schemaFullChecking = true ; arg = argv [ ( ++ i ) ] ; } else if ( arg . equals ( "-F" ) ) { schemaFullChecking = false ; arg = argv [ ( ++ i ) ] ; } parser . setFeature ( ASBuilder . NAMESPACES_FEATURE_ID , true ) ; parser . setFeature ( ASBuilder . VALIDATION_FEATURE_ID , true ) ; parser . setFeature ( ASBuilder . SCHEMA_VALIDATION_FEATURE_ID , true ) ; parser . setFeature ( ASBuilder . SCHEMA_FULL_CHECKING_FEATURE_ID , schemaFullChecking ) ; if ( ! ( arg . equals ( "-a" ) ) ) { ASBuilder . printUsage ( ) ; System . exit ( 1 ) ; } i ++ ; Vector asfiles = new Vector ( ) ; while ( ( i < ( argv . length ) ) && ( ! ( ( arg = argv [ i ] ) . startsWith ( "-" ) ) ) ) { asfiles . addElement ( arg ) ; i ++ ; } if ( ( asfiles . size ( ) ) == 0 ) { ASBuilder . printUsage ( ) ; System . exit ( 1 ) ; } Vector ifiles = null ; if ( i < ( argv . length ) ) { if ( ! ( arg . equals ( "-i" ) ) ) { ASBuilder . printUsage ( ) ; System . exit ( 1 ) ; } i ++ ; ifiles = new Vector ( ) ; while ( ( i < ( argv . length ) ) && ( ! ( ( arg = argv [ i ] ) . startsWith ( "-" ) ) ) ) { ifiles . addElement ( arg ) ; i ++ ; } if ( ( ( ifiles . size ( ) ) == 0 ) || ( i != ( argv . length ) ) ) { ASBuilder . printUsage ( ) ; System . exit ( 1 ) ; } } try { ASModel asmodel = null ; for ( i = 0 ; i < ( asfiles . size ( ) ) ; i ++ ) { asmodel = parser . parseASURI ( ( ( String ) ( asfiles . elementAt ( i ) ) ) ) ; parser . setAbstractSchema ( asmodel ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } if ( ifiles != null ) { try { for ( i = 0 ; i < ( ifiles . size ( ) ) ; i ++ ) { parser . parseURI ( ( ( String ) ( ifiles . elementAt ( i ) ) ) ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; System . exit ( 1 ) ; } } } private static void printUsage ( ) { } public boolean handleError ( DOMError error ) { } }

Fix:
if ( ( argv . length ) < 2 ) {
Buggy code:
@ SuppressWarnings ( "serial" ) public class StandardMapDialog extends JDialog { private GUIController superController ; private TweetsAndRetweets uneditedData ; private MyUnfoldingMap map ; private HashMap < String , MyDataEntry > calculatedData ; public StandardMapDialog ( GUIController superController ) { } public void update ( UpdateType type , LocalDate start , LocalDate end ) { switch ( type ) { case CLOSE : if ( ( map ) != null ) { map . exit ( ) ; } break ; case TWEET_BY_DATE : if ( start == null ) { start = LocalDate . MIN ; } if ( end == null ) { end = LocalDate . MAX ; } uneditedData = superController . getDataByLocationAndDate ( ) ; HashMap < String , Integer > forCalc = new HashMap < String , Integer > ( ) ; for ( Retweets r : uneditedData . getRetweets ( ) ) { LocalDate test = buildLocalDate ( r . getDate ( ) ) ; if ( inRange ( start , end , test ) ) { if ( forCalc . containsKey ( r . getLocationCode ( ) ) ) { int count = forCalc . get ( r . getLocationCode ( ) ) ; count += r . getCounter ( ) ; forCalc . put ( r . getLocationCode ( ) , count ) ; } else { int counter = r . getCounter ( ) ; String id = r . getLocationCode ( ) ; forCalc . put ( id , counter ) ; } } } Set < String > keySet = forCalc . keySet ( ) ; <START_BUG> calculatedData = superController . getDisplayValuePerCountry ( forCalc , 1.0E8 ) ; <END_BUG> keySet = calculatedData . keySet ( ) ; map . update ( calculatedData ) ; map . redraw ( ) ; break ; case GUI_STARTED : map . update ( new HashMap < String , MyDataEntry > ( ) ) ; map . redraw ( ) ; setVisible ( true ) ; break ; default : } } private int [ ] convertLocalDateToInt ( LocalDate date ) { } private int [ ] converDateToInt ( Date date ) { } private boolean inRange ( LocalDate rangeStart , LocalDate rangeEnd , LocalDate date ) { } private LocalDate buildLocalDate ( Date date ) { } }

Fix:
calculatedData = superController . getDisplayValuePerCountry ( forCalc , 1 ) ;
Buggy code:
public class LiftActivity extends Activity implements ActionBar . TabListener { private ViewPager viewPager ; private TabsAdapter tabsAdapter ; private ActionBar actionBar ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( lift_navigation ) ; viewPager = ( ( ViewPager ) ( findViewById ( pager ) ) ) ; actionBar = getActionBar ( ) ; tabsAdapter = new TabsAdapter ( getFragmentManager ( ) ) ; viewPager . setAdapter ( tabsAdapter ) ; actionBar . setHomeButtonEnabled ( false ) ; actionBar . setNavigationMode ( NAVIGATION_MODE_TABS ) ; for ( String tabName : tabsAdapter . getTabNames ( ) ) { ActionBar . Tab aTab = actionBar . newTab ( ) . setText ( tabName ) . setTabListener ( this ) ; actionBar . addTab ( aTab ) ; } viewPager . setOnPageChangeListener ( new ViewPager . OnPageChangeListener ( ) { @ Override public void onPageSelected ( int position ) { getActionBar ( ) . setSelectedNavigationItem ( position ) ; } @ Override public void onPageScrolled ( int i , float v , int i2 ) { } @ Override public void onPageScrollStateChanged ( int i ) { } } ) ; getActionBar ( ) . setDisplayHomeAsUpEnabled ( true ) ; <START_BUG> viewPager . setCurrentItem ( 2 ) ; <END_BUG> } @ Override public void onTabSelected ( ActionBar . Tab tab , FragmentTransaction ft ) { } @ Override public void onTabUnselected ( ActionBar . Tab tab , FragmentTransaction ft ) { } @ Override public void onTabReselected ( ActionBar . Tab tab , FragmentTransaction ft ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
viewPager . setCurrentItem ( 1 ) ;
Buggy code:
public final class StandardSessionInterceptor extends BaseInterceptor { int manager_note ; int checkInterval = 60 ; int maxActiveSessions = - 1 ; String randomClass = null ; public StandardSessionInterceptor ( ) { } public void setCheckInterval ( int secs ) { } public void setMaxActiveSessions ( int count ) { } public final void setRandomClass ( String randomClass ) { } public void engineInit ( ContextManager cm ) throws TomcatException { } public int requestMap ( Request request ) { } public void reload ( Request req , Context ctx ) { ClassLoader newLoader = ctx . getClassLoader ( ) ; ServerSessionManager sM = getManager ( ctx ) ; Enumeration sessionEnum = sM . getSessions ( ) . keys ( ) ; while ( sessionEnum . hasMoreElements ( ) ) { ServerSession session = ( ( ServerSession ) ( sessionEnum . nextElement ( ) ) ) ; Enumeration e = session . getAttributeNames ( ) ; while ( e . hasMoreElements ( ) ) { String key = ( ( String ) ( e . nextElement ( ) ) ) ; Object value = session . getAttribute ( key ) ; if ( ! ( value instanceof Serializable ) ) { session . removeAttribute ( key ) ; } } } Hashtable orig = sM . getSessions ( ) ; <START_BUG> Object newS = SessionSerializer . doSerialization ( newLoader , orig ) ; <END_BUG> sM . setSessions ( ( ( Hashtable ) ( newS ) ) ) ; String reqId = req . getRequestedSessionId ( ) ; ServerSession sS = sM . findSession ( reqId ) ; if ( sS != null ) { req . setSession ( sS ) ; req . setSessionId ( reqId ) ; } } public int newSessionRequest ( Request request , Response response ) { } public void contextInit ( Context ctx ) throws TomcatException { } public void contextShutdown ( Context ctx ) throws TomcatException { } private ServerSessionManager getManager ( Context ctx ) { } }

Fix:
Object newS = ObjectSerializer . doSerialization ( newLoader , orig ) ;
Buggy code:
public class IsSigned extends DataType implements Condition { private static final String SIG_START = "META-INF//" ; private static final String SIG_END = ".SF" ; private static final int SHORT_SIG_LIMIT = 8 ; private String name ; private File file ; public void setFile ( File file ) { } public void setName ( String name ) { } public static boolean isSigned ( File zipFile , String name ) throws IOException { } public boolean eval ( ) { if ( ( file ) == null ) { throw new BuildException ( "The<seq2seq4repair_space>file<seq2seq4repair_space>attribute<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>set." ) ; } <START_BUG> if ( ( ( file ) != null ) && ( ! ( file . exists ( ) ) ) ) { <END_BUG> log ( ( ( "The<seq2seq4repair_space>file<seq2seq4repair_space>\"" + ( file . getAbsolutePath ( ) ) ) + "\"<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist." ) , MSG_VERBOSE ) ; return false ; } boolean r = false ; try { r = IsSigned . isSigned ( file , name ) ; } catch ( IOException e ) { log ( ( ( ( "Got<seq2seq4repair_space>IOException<seq2seq4repair_space>reading<seq2seq4repair_space>file<seq2seq4repair_space>\"" + ( file . getAbsolutePath ( ) ) ) + "\"" ) + e ) , MSG_WARN ) ; } if ( r ) { log ( ( ( "File<seq2seq4repair_space>\"" + ( file . getAbsolutePath ( ) ) ) + "\"<seq2seq4repair_space>is<seq2seq4repair_space>signed." ) , MSG_VERBOSE ) ; } return r ; } }

Fix:
if ( ! ( file . exists ( ) ) ) {
Buggy code:
public class SourceTrackers { private static final Localizer _loc = Localizer . forPackage ( SourceTrackers . class ) ; private static final String SEP = System . getProperty ( "line.separator" ) ; public static String getSourceLocationMessage ( SourceTracker [ ] trackers ) { StringBuffer buf = new StringBuffer ( ( 20 * ( ( trackers . length ) + 1 ) ) ) ; buf . append ( SourceTrackers . _loc . get ( "source-trackers-location-header" ) ) . append ( SourceTrackers . SEP ) ; String sourceFilePath ; for ( int i = 0 ; i < ( trackers . length ) ; i ++ ) { <START_BUG> sourceFilePath = ( ( trackers [ i ] . getSourceFile ( ) ) == null ) ? SourceTrackers . _loc . get ( "source-tracker-file-unknown" ) : trackers [ i ] . getSourceFile ( ) . getAbsolutePath ( ) ; <END_BUG> buf . append ( "<seq2seq4repair_space>" ) . append ( SourceTrackers . _loc . get ( "source-trackers-location-line-item" , trackers [ i ] . getResourceName ( ) , sourceFilePath ) ) ; if ( i < ( ( trackers . length ) - 1 ) ) buf . append ( SourceTrackers . SEP ) ; } return buf . toString ( ) ; } }

Fix:
sourceFilePath = ( ( trackers [ i ] . getSourceFile ( ) ) == null ) ? SourceTrackers . _loc . get ( "source-tracker-file-unknown" ) . getMessage ( ) : trackers [ i ] . getSourceFile ( ) . getAbsolutePath ( ) ;
Buggy code:
public class ExampleRunner { public static void main ( String [ ] args ) throws Exception { QueueConnection conn = null ; QueueSession session = null ; DeploymentUtils utils = null ; try { utils = new DeploymentUtils ( "jmsclient-mbean.sar" , FakeJndi . class . getPackage ( ) ) ; utils . deploy ( ) ; <START_BUG> QueueConnectionFactory qcf = ExampleRunner . lookup ( utils , "ConnectionFactory" , QueueConnectionFactory . class ) ; <END_BUG> Queue queue = ExampleRunner . lookup ( utils , "queue//test" , Queue . class ) ; System . out . println ( ( "Got<seq2seq4repair_space>qcf<seq2seq4repair_space>" + qcf ) ) ; System . out . println ( ( "Got<seq2seq4repair_space>q<seq2seq4repair_space>" + queue ) ) ; conn = qcf . createQueueConnection ( ) ; conn . start ( ) ; session = conn . createQueueSession ( false , AUTO_ACKNOWLEDGE ) ; QueueReceiver recv = session . createReceiver ( queue ) ; recv . setMessageListener ( new MessageListener ( ) { @ Override public void onMessage ( Message message ) { TextMessage msg = ( ( TextMessage ) ( message ) ) ; try { System . out . println ( ( "---->Received:<seq2seq4repair_space>" + ( msg . getText ( ) ) ) ) ; } catch ( JMSException e ) { e . printStackTrace ( ) ; } } } ) ; QueueSender sender = session . createSender ( queue ) ; for ( int i = 0 ; i < 10 ; i ++ ) { String s = "Test" + i ; System . out . println ( ( "----><seq2seq4repair_space>Sending:<seq2seq4repair_space>" + s ) ) ; TextMessage msg = session . createTextMessage ( s ) ; sender . send ( msg ) ; } Thread . sleep ( 1000 ) ; } finally { try { conn . stop ( ) ; } catch ( Exception ignore ) { } try { session . close ( ) ; } catch ( Exception ignore ) { } try { conn . close ( ) ; } catch ( Exception ignore ) { } utils . undeploy ( ) ; safeClose ( utils ) ; } } private static < T > T lookup ( DeploymentUtils utils , String name , Class < T > expected ) throws Exception { } }

Fix:
QueueConnectionFactory qcf = ExampleRunner . lookup ( utils , "RemoteConnectionFactory" , QueueConnectionFactory . class ) ;
Buggy code:
public class JSONUtil { private static Logger logger = LogManager . getLogger ( JSONUtil . class ) ; public static String getValue ( String line , String token ) { JSONUtil . logger . debug ( ( "Line<seq2seq4repair_space>to<seq2seq4repair_space>process:<seq2seq4repair_space>" + line ) ) ; if ( ( line . indexOf ( token ) ) != ( - 1 ) ) { int totalUsageIndex = line . indexOf ( token ) ; int start = ( totalUsageIndex + ( token . length ( ) ) ) + ( Constants . JSON_OFFSET ) ; <START_BUG> int end = line . indexOf ( "," , start ) ; <END_BUG> return line . substring ( start , end ) ; } else return "" ; } }

Fix:
int end = ( line . indexOf ( "," , start ) ) - 1 ;
Buggy code:
public class SecurityRealmMapGroupsAttributeWriteHandler extends ReloadRequiredWriteAttributeHandler { public static final SecurityRealmMapGroupsAttributeWriteHandler INSTANCE = new SecurityRealmMapGroupsAttributeWriteHandler ( ) ; private SecurityRealmMapGroupsAttributeWriteHandler ( ) { } @ Override protected void finishModelStage ( OperationContext context , ModelNode operation , String attributeName , ModelNode newValue , ModelNode oldValue , Resource model ) throws OperationFailedException { if ( ( ( ( oldValue . equals ( newValue ) ) == false ) && ( newValue . isDefined ( ) ) ) && ( ( ( newValue . getType ( ) ) == ( ModelType . EXPRESSION ) ) || ( ( newValue . asBoolean ( ) ) == false ) ) ) { <START_BUG> RbacSanityCheckOperation . registerOperation ( context ) ; <END_BUG> } super . finishModelStage ( context , operation , attributeName , newValue , oldValue , model ) ; } }

Fix:
RbacSanityCheckOperation . addOperation ( context ) ;
Buggy code:
public class RestartResponseAtInterceptPageException extends ResetResponseException { private static final long serialVersionUID = 1L ; public RestartResponseAtInterceptPageException ( Page interceptPage ) { } public RestartResponseAtInterceptPageException ( Class < ? extends Page > interceptPageClass ) { } public static class InterceptData implements Serializable { private static final long serialVersionUID = 1L ; private Url originalUrl ; private Map < String , List < StringValue > > postParameters ; private boolean continueOk ; public Url getOriginalUrl ( ) { } public Map < String , List < StringValue > > getPostParameters ( ) { } public static void set ( ) { } public static RestartResponseAtInterceptPageException . InterceptData get ( ) { } public static void clear ( ) { } private static MetaDataKey < RestartResponseAtInterceptPageException . InterceptData > key = new MetaDataKey < RestartResponseAtInterceptPageException . InterceptData > ( ) { private static final long serialVersionUID = 1L ; } ; } static boolean continueToOriginalDestination ( ) { RestartResponseAtInterceptPageException . InterceptData data = RestartResponseAtInterceptPageException . InterceptData . get ( ) ; if ( data != null ) { data . continueOk = true ; String url = RequestCycle . get ( ) . getUrlRenderer ( ) . renderUrl ( data . originalUrl ) ; <START_BUG> RequestCycle . get ( ) . scheduleRequestHandlerAfterCurrent ( new RedirectRequestHandler ( url ) ) ; <END_BUG> return true ; } return false ; } public static IRequestMapper MAPPER = new IRequestMapper ( ) { public int getCompatibilityScore ( Request request ) { } public Url mapHandler ( IRequestHandler requestHandler ) { } public IRequestHandler mapRequest ( Request request ) { } } ; }

Fix:
RequestCycle . get ( ) . replaceCurrentRequestHandler ( new RedirectRequestHandler ( url ) ) ;
Buggy code:
@ RunWith ( PowerMockRunner . class ) @ PrepareForTest ( { DocumentBuilderFactory . class , DocumentBuilder . class } ) public class GutoMaiaSteamCommunityTest { public Document loadXml ( String file ) throws Exception { } DocumentBuilder parser = mock ( DocumentBuilder . class ) ; DocumentBuilderFactory factory = mock ( DocumentBuilderFactory . class ) ; @ Before public void init ( ) throws Exception { } @ Test public void getProfile ( ) throws Exception { } @ Test public void getGames ( ) throws Exception { } @ Test public void getFriends ( ) throws Exception { } @ Test public void getTF2Stats ( ) throws Exception { when ( parser . parse ( "http:////steamcommunity.com//id//gutomaia?xml=1" ) ) . thenReturn ( loadXml ( "gutomaia.xml" ) ) ; <START_BUG> when ( parser . parse ( "http:////steamcommunity.com//id//gutomaia//games?xml=1" ) ) . thenReturn ( loadXml ( "gutomaia-friends.xml" ) ) ; <END_BUG> when ( parser . parse ( "http:////steamcommunity.com//id//gutomaia//stats//tf2?xml=all" ) ) . thenReturn ( loadXml ( "gutomaia-tf2.xml" ) ) ; SteamId steamId = SteamId . create ( "gutomaia" , true , false ) ; HashMap < Integer , SteamGame > games = steamId . getGames ( ) ; TF2Stats tf2Stats = ( ( TF2Stats ) ( steamId . getGameStats ( "tf2" ) ) ) ; assertEquals ( "Team<seq2seq4repair_space>Fortress<seq2seq4repair_space>2" , tf2Stats . getGameName ( ) ) ; assertEquals ( "TF2" , tf2Stats . getGameFriendlyName ( ) ) ; assertEquals ( 440 , tf2Stats . getAppId ( ) ) ; } }

Fix:
when ( parser . parse ( "http:////steamcommunity.com//id//gutomaia//games?xml=1" ) ) . thenReturn ( loadXml ( "gutomaia-games.xml" ) ) ;
Buggy code:
public class ThreadMXBeanThreadInfoHandler implements OperationStepHandler , DescriptionProvider { public static final ThreadMXBeanThreadInfoHandler INSTANCE = new ThreadMXBeanThreadInfoHandler ( ) ; private final ParametersValidator validator = new ParametersValidator ( ) ; private ThreadMXBeanThreadInfoHandler ( ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { validator . validate ( operation ) ; ThreadMXBean mbean = ManagementFactory . getThreadMXBean ( ) ; try { long id = operation . require ( ID ) . asLong ( ) ; ThreadInfo info ; if ( operation . hasDefined ( MAX_DEPTH ) ) { info = mbean . getThreadInfo ( id , operation . require ( MAX_DEPTH ) . asInt ( ) ) ; } else { info = mbean . getThreadInfo ( id ) ; } final ModelNode result = context . getResult ( ) ; if ( info != null ) { result . set ( PlatformMBeanUtil . getDetypedThreadInfo ( info , mbean . isThreadCpuTimeSupported ( ) ) ) ; } } catch ( SecurityException e ) { throw new OperationFailedException ( new ModelNode ( ) . set ( e . toString ( ) ) ) ; } <START_BUG> context . completeStep ( ) ; <END_BUG> } @ Override public ModelNode getModelDescription ( Locale locale ) { } }

Fix:
context . stepCompleted ( ) ;
Buggy code:
public class YvmAsm extends Yvm { private int messCounter = 0 ; public YvmAsm ( ) { } private void addInstruction ( String method ) { } private void addInstructionTab ( String arg ) { } @ Override public void entete ( ) { } @ Override public void ouvrePrinc ( int arg ) { } @ Override public void queue ( ) { } @ Override public void iadd ( ) { } @ Override public void isub ( ) { } @ Override public void imul ( ) { } @ Override public void idiv ( ) { } @ Override public void ineg ( ) { } @ Override public void ior ( ) { } @ Override public void iand ( ) { } @ Override public void inot ( ) { } private void comparaison ( String instr ) { } @ Override public void iinf ( ) { } @ Override public void isup ( ) { } @ Override public void iinfegal ( ) { } @ Override public void isupegal ( ) { } @ Override public void iegal ( ) { } @ Override public void idiff ( ) { } @ Override public void iload ( int arg ) { } @ Override public void istore ( int arg ) { } @ Override public void iconst ( int arg ) { } @ Override public void ecrireType ( TypeList t ) { } @ Override public void ecrireChaine ( String s ) { } @ Override public void aLaLigne ( ) { } @ Override public void lireEnt ( int arg ) { } @ Override public int goToFsiCond ( ) { } @ Override public int sinonCond ( ) { } @ Override public int fsiCond ( ) { } @ Override public int ouvreFaire ( ) { } @ Override public int fermeFaire ( ) { } @ Override public int goToFaire ( ) { } @ Override public int iffauxFaire ( ) { } @ Override public void principal ( ) { } @ Override public void ecrireFonc ( String nom ) { } public void ouvreBloc ( int n ) { } public void fermeBloc ( int n ) { } public void reserveRetour ( ) { } public void callFonc ( ) { super . callFonc ( ) ; <START_BUG> addInstructionTab ( ( "call<seq2seq4repair_space>" + ( retraitFonc ( ) ) ) ) ; <END_BUG> } public void retourne ( int n ) { } }

Fix:
addInstructionTab ( ( "call<seq2seq4repair_space>" + ( lastFonc ) ) ) ;
Buggy code:
public class MockWebApplication extends WebApplication { @ SuppressWarnings ( "unused" ) private static final Log log = LogFactory . getLog ( MockWebApplication . class ) ; private Page lastRenderedPage ; private Page previousRenderedPage ; private MockHttpServletRequest servletRequest ; private MockHttpServletResponse servletResponse ; private MockHttpSession servletSession ; private WebRequest wicketRequest ; private Map < String , Object > parametersForNextRequest = new HashMap < String , Object > ( ) ; private WebResponse wicketResponse ; private WebSession wicketSession ; private Class < ? extends Page > homePage ; public MockWebApplication ( final String path ) { } @ Override protected void init ( ) { } public Page getLastRenderedPage ( ) { } public Page getPreviousRenderedPage ( ) { } public MockHttpServletRequest getServletRequest ( ) { } public MockHttpServletResponse getServletResponse ( ) { } public MockHttpSession getServletSession ( ) { } public WebRequest getWicketRequest ( ) { } public WebResponse getWicketResponse ( ) { } public WebSession getWicketSession ( ) { } public void processRequestCycle ( final Component component ) { } public void processRequestCycle ( ) { } public void processRequestCycle ( WebRequestCycle cycle ) { } private void postProcessRequestCycle ( WebRequestCycle cycle ) { } private Page generateLastRenderedPage ( WebRequestCycle cycle ) { } public WebRequestCycle createRequestCycle ( ) { } public void setupRequestAndResponse ( ) { servletRequest . initialize ( ) ; servletResponse . initialize ( ) ; servletRequest . setParameters ( parametersForNextRequest ) ; parametersForNextRequest . clear ( ) ; wicketRequest = new wicket . protocol . http . servlet . ServletWebRequest ( servletRequest ) ; wicketSession = getSession ( wicketRequest ) ; getSessionStore ( ) . bind ( wicketRequest , wicketSession ) ; wicketResponse = new WebResponse ( servletResponse ) ; <START_BUG> wicketResponse . setWebRequest ( wicketRequest ) ; <END_BUG> } public Map < String , Object > getParametersForNextRequest ( ) { } public void setParametersForNextRequest ( Map < String , Object > parametersForNextRequest ) { } @ Override public Class < ? extends Page > getHomePage ( ) { } public void setHomePage ( Class < ? extends Page > clazz ) { } @ Override protected ISessionStore newSessionStore ( ) { } }

Fix:
wicketResponse . setAjax ( wicketRequest . isAjax ( ) ) ;
Buggy code:
public class ConnectionManager implements Watcher { protected static final Logger log = LoggerFactory . getLogger ( ConnectionManager . class ) ; private final String name ; private final CountDownLatch clientConnected = new CountDownLatch ( 1 ) ; private boolean connected = false ; private final ZkClientConnectionStrategy connectionStrategy ; private final String zkServerAddress ; private final SolrZkClient client ; private final OnReconnect onReconnect ; private final BeforeReconnect beforeReconnect ; private volatile KeeperState state = KeeperState . Disconnected ; private volatile boolean isClosed = false ; private volatile boolean likelyExpired = true ; private volatile Timer disconnectedTimer ; public ConnectionManager ( String name , SolrZkClient client , String zkServerAddress , ZkClientConnectionStrategy strat , OnReconnect onConnect , BeforeReconnect beforeReconnect ) { } private synchronized void connected ( ) { } private synchronized void disconnected ( ) { if ( ( disconnectedTimer ) != null ) { disconnectedTimer . cancel ( ) ; disconnectedTimer = null ; } if ( ! ( isClosed ) ) { <START_BUG> disconnectedTimer = new Timer ( ) ; <END_BUG> disconnectedTimer . schedule ( new TimerTask ( ) { @ Override public void run ( ) { likelyExpired = true ; } } , ( ( long ) ( ( client . getZkClientTimeout ( ) ) * 0.9 ) ) ) ; } connected = false ; notifyAll ( ) ; } @ Override public void process ( WatchedEvent event ) { } public synchronized boolean isConnected ( ) { } public void close ( ) { } public boolean isLikelyExpired ( ) { } public synchronized void waitForConnected ( long waitForConnection ) throws TimeoutException { } public synchronized void waitForDisconnected ( long timeout ) throws InterruptedException , TimeoutException { } private void closeKeeper ( SolrZooKeeper keeper ) { } }

Fix:
disconnectedTimer = new Timer ( true ) ;