nus-yam/ex-repair huggingface dataset:
Buggy code:
public class CSVFormatBuilderTest { private CSVFormatBuilder builder ; @ Before public void setUp ( ) throws Exception { <START_BUG> builder = new CSVFormatBuilder ( '+' , '!' , null , '#' , '!' , true , true , Constants . CRLF , null ) ; <END_BUG> } @ Test public void testDelimiter ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testNewFormatLFThrowsException ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testNewFormatCRThrowsException ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithDelimiterLFThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testDelimiterSameAsEscapeThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testDelimiterSameAsCommentStartThrowsException ( ) { } @ Test public void testQuoteChar ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuoteCharSameAsCommentStartThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuoteCharSameAsCommentStartThrowsExceptionForWrapperType ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuoteCharSameAsDelimiterThrowsException ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithQuoteLFThrowsException ( ) { } @ Test public void testQuotePolicy ( ) { } @ Test ( expected = IllegalStateException . class ) public void testQuotePolicyNoneWithoutEscapeThrowsException ( ) { } @ Test public void testCommentStart ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithCommentStartCRThrowsException ( ) { } @ Test public void testRecoardSeparator ( ) { } @ Test public void testEscape ( ) { } @ Test ( expected = IllegalArgumentException . class ) public void testWithEscapeCRThrowsExceptions ( ) { } @ Test ( expected = IllegalStateException . class ) public void testEscapeSameAsCommentStartThrowsException ( ) { } @ Test ( expected = IllegalStateException . class ) public void testEscapeSameAsCommentStartThrowsExceptionForWrapperType ( ) { } @ Test public void testIgnoreSurroundingSpaces ( ) { } @ Test public void testIgnoreEmptyLines ( ) { } @ Test public void testCopiedFormatIsEqualToOriginal ( ) { } @ Test public void testCopiedFormatWithChanges ( ) { } @ Test public void testHeaderReferenceCannotEscape ( ) { } }

Fix:
builder = new CSVFormatBuilder ( '+' , Character . valueOf ( '!' ) , null , Character . valueOf ( '#' ) , Character . valueOf ( '!' ) , true , true , Constants . CRLF , null ) ;
Buggy code:
public class ContactDB { public static Map < Long , Contact > contacts = new HashMap < > ( ) ; public static long i = 1 ; public static void addContact ( ContactFormData form ) { long idVal ; if ( ( form . id ) == 0 ) { idVal = ( ContactDB . i ) ++ ; } else { idVal = form . id ; } <START_BUG> Contact contact = new Contact ( idVal , form . firstName , form . lastName , form . telephone ) ; <END_BUG> ContactDB . contacts . put ( idVal , contact ) ; } public static List getContacts ( ) { } public static Contact getContact ( long id ) { } public static void deleteContact ( long id ) { } }

Fix:
Contact contact = new Contact ( idVal , form . firstName , form . lastName , form . telephone , form . telephoneType ) ;
Buggy code:
public class Main { public static void main ( String [ ] args ) throws SQLException { BusinessRuleDAOImpl dao = new BusinessRuleDAOImpl ( ) ; ArrayList < BusinessRule > emptybusinessrules = dao . getEmptyUngeneratedBusinessRules ( ) ; ArrayList < BusinessRule > businessrules = dao . getFilledBusinessRules ( emptybusinessrules ) ; for ( BusinessRule b : businessrules ) { <START_BUG> b . getGeneratedRule ( ) ; <END_BUG> } } }

Fix:
System . out . println ( b . getGeneratedRule ( ) ) ;
Buggy code:
public class NullIdeUIAdapter implements IdeUIAdapter { public void displayStatusInformation ( String message ) { <START_BUG> System . out . println ( ( "><seq2seq4repair_space>NullIdeUIAdapter<seq2seq4repair_space>status<seq2seq4repair_space>:<seq2seq4repair_space>" + message ) ) ; <END_BUG> } public void resetGUI ( ) { } }

Fix:
System . out . println ( ( "NullIde><seq2seq4repair_space>" + message ) ) ;
Buggy code:
public abstract class Repository extends DataType { public void validate ( ) { } public final Repository resolve ( ) { if ( ( getRefid ( ) ) == null ) { return this ; } else { <START_BUG> Repository repository = ( ( Repository ) ( getCheckedRef ( this . getClass ( ) , "Repository" ) ) ) ; <END_BUG> return repository ; } } public void connect ( GetLibraries owner ) { } public void disconnect ( ) { } public abstract boolean checkRepositoryReachable ( ) throws IOException { } public abstract boolean fetch ( Library library ) throws IOException { } }

Fix:
Repository repository = ( ( Repository ) ( getCheckedRef ( Repository . class , "Repository" ) ) ) ;
Buggy code:
public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { private boolean isThis ; private boolean alreadyWarnedAboutDEoW = false ; private ExactAnnotationTypePattern annotationTypePattern ; private ShadowMunger munger ; private static final Set thisKindSet = new HashSet ( Shadow . ALL_SHADOW_KINDS ) ; private static final Set targetKindSet = new HashSet ( Shadow . ALL_SHADOW_KINDS ) ; public ThisOrTargetAnnotationPointcut ( boolean isThis , ExactAnnotationTypePattern type ) { } public ThisOrTargetAnnotationPointcut ( boolean isThis , ExactAnnotationTypePattern type , ShadowMunger munger ) { } public Set couldMatchKinds ( ) { } public FuzzyBoolean fastMatch ( FastMatchInfo info ) { } protected FuzzyBoolean matchInternal ( Shadow shadow ) { if ( ! ( couldMatch ( shadow ) ) ) return FuzzyBoolean . NO ; ResolvedTypeX toMatchAgainst = ( isThis ? shadow . getThisType ( ) : shadow . getTargetType ( ) ) . resolve ( shadow . getIWorld ( ) ) ; annotationTypePattern . resolve ( shadow . getIWorld ( ) ) ; <START_BUG> if ( annotationTypePattern . matches ( toMatchAgainst ) . alwaysTrue ( ) ) { <END_BUG> return FuzzyBoolean . YES ; } else { return FuzzyBoolean . MAYBE ; } } public boolean isThis ( ) { } protected void resolveBindings ( IScope scope , Bindings bindings ) { } protected void resolveBindingsFromRTTI ( ) { } protected Pointcut concretize1 ( ResolvedTypeX inAspect , IntMap bindings ) { } protected Test findResidueInternal ( Shadow shadow , ExposedState state ) { } private boolean couldMatch ( Shadow shadow ) { } public List getBindingAnnotationTypePatterns ( ) { } public List getBindingTypePatterns ( ) { } public void write ( DataOutputStream s ) throws IOException { } public static Pointcut read ( VersionedDataInputStream s , ISourceContext context ) throws IOException { } public boolean equals ( Object obj ) { } public int hashCode ( ) { } public String toString ( ) { } }

Fix:
if ( annotationTypePattern . matchesRuntimeType ( toMatchAgainst ) . alwaysTrue ( ) ) {
Buggy code:
public class StateDelay implements AutonomousState { CommandDelay delay ; String [ ] parameters ; public void init ( String [ ] params , CommandController theMcp ) { } int count ; int targetValue ; public void process ( ) { } public boolean done ( ) { } @ Override public void init ( ) { } @ Override public void prepare ( ) { } @ Override public void reset ( ) { } @ Override public void showParams ( ) { <START_BUG> SmartDashboard . putString ( "Param<seq2seq4repair_space>1" , parameters [ 0 ] ) ; <END_BUG> } @ Override public void updateParams ( ) { } }

Fix:
SmartDashboard . putString ( "Param<seq2seq4repair_space>1<seq2seq4repair_space>-<seq2seq4repair_space>targetValue" , parameters [ 0 ] ) ;
Buggy code:
public final class Base64 { private static final int BASELENGTH = 255 ; private static final int LOOKUPLENGTH = 64 ; private static final int TWENTYFOURBITGROUP = 24 ; private static final int EIGHTBIT = 8 ; private static final int SIXTEENBIT = 16 ; private static final int SIXBIT = 6 ; private static final int FOURBYTE = 4 ; private static final int SIGN = - 128 ; private static final char PAD = '=' ; private static final boolean fDebug = false ; private static final byte [ ] base64Alphabet = new byte [ Base64 . BASELENGTH ] ; private static final char [ ] lookUpBase64Alphabet = new char [ Base64 . LOOKUPLENGTH ] ; protected static boolean isWhiteSpace ( char octect ) { } protected static boolean isPad ( char octect ) { } protected static boolean isData ( char octect ) { <START_BUG> return ( Base64 . base64Alphabet [ octect ] ) != ( - 1 ) ; <END_BUG> } protected static boolean isBase64 ( char octect ) { } public static String encode ( byte [ ] binaryData ) { } public static byte [ ] decode ( String encoded ) { } protected static int removeWhiteSpace ( char [ ] data ) { } }

Fix:
return ( octect < ( Base64 . BASELENGTH ) ) && ( ( Base64 . base64Alphabet [ octect ] ) != ( - 1 ) ) ;
Buggy code:
public class ShowOrderActivity extends Activity implements AdapterView . OnItemClickListener { private ArrayList < Order > collectedItems ; private MyOrdersListAdapter myListViewAdapter ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_show_order ) ; loadCollectedItems ( ) ; ListView myListView = ( ( ListView ) ( findViewById ( show_OrderView ) ) ) ; int table_number = getIntent ( ) . getIntExtra ( "table_number" , ( - 1 ) ) ; Button closeBill = ( ( Button ) ( findViewById ( button_close_bill ) ) ) ; <START_BUG> Button newOrder = ( ( Button ) ( findViewById ( new_bill_table_number ) ) ) ; <END_BUG> EditText newOrderTable = ( ( EditText ) ( findViewById ( show_order_table_number ) ) ) ; if ( table_number == ( - 1 ) ) { closeBill . setVisibility ( INVISIBLE ) ; } else { newOrder . setVisibility ( INVISIBLE ) ; newOrderTable . setVisibility ( INVISIBLE ) ; } myListViewAdapter = new MyOrdersListAdapter ( this , collectedItems ) ; myListView . setAdapter ( myListViewAdapter ) ; myListView . setOnItemClickListener ( this ) ; updateDrawableOrder ( ) ; } private void loadCollectedItems ( ) { } @ Override public void onResume ( ) { } @ Override public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { } public void newOrder ( View v ) { } public void change_order ( View view ) { } private void updateDrawableOrder ( ) { } public void closeBill ( View v ) { } }

Fix:
Button newOrder = ( ( Button ) ( findViewById ( new_order_button ) ) ) ;
Buggy code:
public class UserRequestHandler extends Action { public UserRequestHandler ( UriInfo uriInfo , Request request , String id ) { } private String buildAuthToken ( String email , String password , String time ) throws UnsupportedEncodingException , NoSuchAlgorithmException { MessageDigest md = MessageDigest . getInstance ( "SHA-256" ) ; md . update ( password . getBytes ( "UTF-8" ) ) ; <START_BUG> String hash = new String ( md . digest ( ) ) ; <END_BUG> return ( ( ( email + "$" ) + hash ) + "$" ) + time ; } @ POST @ Consumes ( MediaType . APPLICATION_XML ) @ Produces ( MediaType . APPLICATION_XML ) public GenricServerResponse createNewUserFromXML ( JAXBElement < User > user ) { } @ GET @ Path ( "//{email}//{password}" ) @ Produces ( MediaType . APPLICATION_XML ) public User loginUserFromXML ( @ PathParam ( "email" ) String email , @ PathParam ( "password" ) String password ) { } @ GET @ Path ( "//{id}" ) @ Produces ( MediaType . APPLICATION_XML ) public User getUserAsXML ( @ PathParam ( "id" ) String id ) { } @ DELETE @ Produces ( MediaType . APPLICATION_XML ) public GenricServerResponse deleteUserAsXML ( ) { } }

Fix:
String hash = new String ( md . digest ( ) , "UTF-8" ) ;
Buggy code:
public class JettyTestCaseDecorator extends TestSetup { private Server server ; public JettyTestCaseDecorator ( Test test ) { } protected void setUp ( ) throws Exception { server = new Server ( ) ; SelectChannelConnector connector = new SelectChannelConnector ( ) ; connector . setPort ( 8098 ) ; server . setConnectors ( new Connector [ ] { connector } ) ; WebAppContext web = new WebAppContext ( ) ; <START_BUG> web . setContextPath ( "//org.apache.wicket-examples" ) ; <END_BUG> String basedir = System . getProperty ( "basedir" ) ; String path = "" ; if ( basedir != null ) path = basedir + "//" ; path += "src//main//webapp" ; web . setWar ( path ) ; server . addHandler ( web ) ; server . start ( ) ; super . setUp ( ) ; } protected void tearDown ( ) throws Exception { } }

Fix:
web . setContextPath ( "//wicket-examples" ) ;
Buggy code:
public class EJB3RemoteServiceRemove extends AbstractRemoveStepHandler { public static final EJB3RemoteServiceRemove INSTANCE = new EJB3RemoteServiceRemove ( ) ; @ Override protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model ) throws OperationFailedException { } @ Override protected void recoverServices ( OperationContext context , ModelNode operation , ModelNode model ) throws OperationFailedException { if ( context . isResourceServiceRestartAllowed ( ) ) { <START_BUG> EJB3RemoteServiceAdd . INSTANCE . installRuntimeServices ( context , model ) ; <END_BUG> } else { context . revertReloadRequired ( ) ; } } void removeRuntimeService ( OperationContext context , ModelNode operation ) { } }

Fix:
EJB3RemoteServiceAdd . INSTANCE . installRuntimeServices ( context , model , null ) ;
Buggy code:
public class RecycleViewAdapter extends RecyclerView . Adapter < RecycleViewAdapter . ViewHolder > { List < Person > dataset ; Context c ; RecycleViewAdapter . OnClickMode mode ; public enum OnClickMode { ADD_TEAM_MEMBER , REMOVE_TEAM_MEMBER ; } public static class ViewHolder extends RecyclerView . ViewHolder implements View . OnClickListener , View . OnLongClickListener { public ImageView mImageView ; public TextView nameTextView ; public TextView emailTextView ; public TextView skillsTextView ; private RecycleViewAdapter . OnClickMode doubleTapMode ; private Context vhContext ; private boolean doubleClick = false ; private Person currentPerson ; public ViewHolder ( View v , RecycleViewAdapter . OnClickMode clickMode , Context context ) { } @ Override public boolean onLongClick ( View v ) { } @ Override public void onClick ( View v ) { } } public RecycleViewAdapter ( List < Person > attendees , RecycleViewAdapter . OnClickMode mode , Context context ) { } @ Override public RecycleViewAdapter . ViewHolder onCreateViewHolder ( ViewGroup viewGroup , int i ) { } @ Override public void onBindViewHolder ( RecycleViewAdapter . ViewHolder viewHolder , int i ) { viewHolder . mImageView . setImageDrawable ( null ) ; viewHolder . currentPerson = dataset . get ( i ) ; viewHolder . nameTextView . setText ( dataset . get ( i ) . getName ( ) ) ; viewHolder . emailTextView . setText ( dataset . get ( i ) . getEmail ( ) ) ; String skillString = "" ; List < Skill > skills = dataset . get ( i ) . getSkills ( ) ; for ( int j = 0 ; j < ( skills . size ( ) ) ; j ++ ) { Skill s = skills . get ( j ) ; String sString = ( ( s . getSname ( ) ) + ":<seq2seq4repair_space>" ) + ( s . getRating ( ) ) ; skillString += sString ; if ( j != ( ( skills . size ( ) ) - 1 ) ) { skillString += ",<seq2seq4repair_space>" ; } } viewHolder . skillsTextView . setText ( skillString ) ; <START_BUG> new AsyncImageDownloader ( viewHolder . mImageView , i , dataset . get ( i ) ) . execute ( ) ; <END_BUG> } @ Override public int getItemCount ( ) { } }

Fix:
new AsyncImageDownloader ( viewHolder . mImageView , i , dataset . get ( i ) , mode ) . execute ( ) ;
Buggy code:
public class TreeColumn extends Item { Tree parent ; boolean resizable ; boolean moveable ; public TreeColumn ( Tree parent , int style ) { } public TreeColumn ( Tree parent , int style , int index ) { } public void addControlListener ( ControlListener listener ) { } public void addSelectionListener ( SelectionListener listener ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } void destroyWidget ( ) { } public int getAlignment ( ) { } public boolean getMoveable ( ) { } String getNameText ( ) { } public Tree getParent ( ) { } public boolean getResizable ( ) { } public int getWidth ( ) { } public void pack ( ) { } void releaseHandle ( ) { } void releaseParent ( ) { } public void removeControlListener ( ControlListener listener ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void setAlignment ( int alignment ) { } public void setImage ( Image image ) { } void setImage ( Image image , boolean sort , boolean right ) { } public void setMoveable ( boolean moveable ) { } public void setResizable ( boolean resizable ) { } void setSortDirection ( int direction ) { if ( ( OS . COMCTL32_MAJOR ) >= 6 ) { int hwndHeader = parent . hwndHeader ; if ( hwndHeader != 0 ) { int index = parent . indexOf ( this ) ; if ( index == ( - 1 ) ) return ; HDITEM hdItem = new HDITEM ( ) ; hdItem . mask = ( OS . HDI_FORMAT ) | ( OS . HDI_IMAGE ) ; OS . SendMessage ( hwndHeader , HDM_GETITEM , index , hdItem ) ; switch ( direction ) { case SWT . UP : hdItem . fmt &= ~ ( ( OS . HDF_IMAGE ) | ( OS . HDF_SORTDOWN ) ) ; hdItem . fmt |= OS . HDF_SORTUP ; break ; case SWT . DOWN : hdItem . fmt &= ~ ( ( OS . HDF_IMAGE ) | ( OS . HDF_SORTUP ) ) ; hdItem . fmt |= OS . HDF_SORTDOWN ; break ; case SWT . NONE : hdItem . fmt &= ~ ( ( OS . HDF_SORTUP ) | ( OS . HDF_SORTDOWN ) ) ; if ( ( image ) != null ) { hdItem . fmt |= OS . HDF_IMAGE ; <START_BUG> hdItem . iImage = parent . imageIndex ( image , index ) ; <END_BUG> } else { hdItem . fmt &= ~ ( OS . HDF_IMAGE ) ; } break ; } OS . SendMessage ( hwndHeader , HDM_SETITEM , index , hdItem ) ; } } else { switch ( direction ) { case SWT . UP : case SWT . DOWN : setImage ( display . getSortImage ( direction ) , true , true ) ; break ; case SWT . NONE : setImage ( image , false , false ) ; break ; } } } public void setText ( String string ) { } public void setWidth ( int width ) { } }

Fix:
hdItem . iImage = parent . imageIndexHeader ( image ) ;
Buggy code:
public class PlusJumpListener implements ActionListener { private User user ; private JProgressBar maxJumpBar ; private JFrame epix ; private JLabel menuCardCoinLabel ; private JPanel card ; public PlusJumpListener ( User user , JProgressBar maxJumpBar , JFrame epix , JLabel menuCardCoinLabel , JPanel card ) { } public void actionPerformed ( ActionEvent e ) { if ( ( user . getCoin ( ) ) >= 5 ) { user . setCoin ( ( ( user . getCoin ( ) ) - 5 ) ) ; user . setMaxJump ( ( ( user . getMaxJump ( ) ) - 0.2 ) ) ; <START_BUG> EpixController . getInstance ( ) . coinsUpdate ( user , ( ( user . getCoin ( ) ) - 5 ) ) ; <END_BUG> menuCardCoinLabel . setText ( ( "" + ( user . getCoin ( ) ) ) ) ; maxJumpBar . setValue ( ( ( int ) ( ( ( ( - ( user . getMaxJump ( ) ) ) * 10 ) - 65 ) * 2.5 ) ) ) ; CardLayout cardLayout = ( ( CardLayout ) ( getCard ( ) . getLayout ( ) ) ) ; cardLayout . show ( getCard ( ) , "upgradeCard" ) ; } } public User getUser ( ) { } public void setUser ( User user ) { } public JProgressBar getMaxJumpBar ( ) { } public void setMaxJumpBar ( JProgressBar maxJumpBar ) { } public JFrame getEpix ( ) { } public void setEpix ( JFrame epix ) { } public JLabel getMenuCardCoinLabel ( ) { } public void setMenuCardCoinLabel ( JLabel menuCardCoinLabel ) { } public JPanel getCard ( ) { } public void setCard ( JPanel card ) { } }

Fix:
EpixController . getInstance ( ) . coinsUpdate ( user , user . getCoin ( ) ) ;
Buggy code:
public class ObjectsTest extends WicketTestCase { public ObjectsTest ( String name ) { } public void testEqual ( ) { } public void testCloneNull ( ) { } public void testCloneString ( ) { } public void testCloneObject ( ) { } public void testComponentClone ( ) { PropertyModel pm = new PropertyModel ( new wicket . markup . html . form . TextField < String > ( new EmptyPage ( ) , "test" , new wicket . model . Model < String > ( "test" ) ) , "modelObject" ) ; PropertyModel pm2 = ( ( PropertyModel ) ( Objects . cloneModel ( pm ) ) ) ; <START_BUG> assertTrue ( ( ( pm . getObject ( null ) ) == ( pm2 . getObject ( null ) ) ) ) ; <END_BUG> } public void testCloneCloneObject ( ) { } private static final class CloneObject implements Serializable { private static final long serialVersionUID = 1L ; private int nr ; @ Override public boolean equals ( Object o ) { } } }

Fix:
assertTrue ( ( ( pm . getObject ( ) ) == ( pm2 . getObject ( ) ) ) ) ;
Buggy code:
public class StringToURLConverter extends AbstractConverter { private static final Resources REZ = ResourceManager . getPackageResources ( StringToURLConverter . class ) ; public StringToURLConverter ( ) { } <START_BUG> public Object convert ( final Object object , final Context context ) throws ConverterException { <END_BUG> try { return new URL ( ( ( String ) ( object ) ) ) ; } catch ( final MalformedURLException mue ) { final String message = StringToURLConverter . REZ . getString ( "convert.bad-url.error" , object ) ; throw new ConverterException ( message , mue ) ; } } }

Fix:
public Object convert ( final Object object , final Object context ) throws ConverterException {
Buggy code:
public class SystemBolt implements IBolt { private static Logger LOG = LoggerFactory . getLogger ( SystemBolt . class ) ; private static boolean _prepareWasCalled = false ; private static class MemoryUsageMetric implements IMetric { IFn _getUsage ; public MemoryUsageMetric ( IFn getUsage ) { } @ Override public Object getValueAndReset ( ) { MemoryUsage memUsage = ( ( MemoryUsage ) ( _getUsage . invoke ( ) ) ) ; HashMap m = new HashMap ( ) ; m . put ( "maxBytes" , memUsage . getMax ( ) ) ; m . put ( "committedBytes" , memUsage . getCommitted ( ) ) ; m . put ( "initBytes" , memUsage . getInit ( ) ) ; m . put ( "usedBytes" , memUsage . getUsed ( ) ) ; m . put ( "virtualFreeBytes" , ( ( memUsage . getMax ( ) ) - ( memUsage . getUsed ( ) ) ) ) ; m . put ( "unusedBytes" , ( ( memUsage . getCommitted ( ) ) - ( memUsage . getUsed ( ) ) ) ) ; return m ; } } private static class GarbageCollectorMetric implements IMetric { GarbageCollectorMXBean _gcBean ; Long _collectionCount ; Long _collectionTime ; public GarbageCollectorMetric ( GarbageCollectorMXBean gcBean ) { } @ Override public Object getValueAndReset ( ) { Long collectionCountP = _gcBean . getCollectionCount ( ) ; <START_BUG> Long collectionTimeP = _gcBean . getCollectionTime ( ) ; <END_BUG> Map ret = null ; if ( ( ( _collectionCount ) != null ) && ( ( _collectionTime ) != null ) ) { ret = new HashMap ( ) ; ret . put ( "count" , ( collectionCountP - ( _collectionCount ) ) ) ; ret . put ( "timeMs" , ( collectionTimeP - ( _collectionTime ) ) ) ; } _collectionCount = collectionCountP ; _collectionTime = collectionTimeP ; return ret ; } } @ Override public void prepare ( final Map stormConf , TopologyContext context , OutputCollector collector ) { } @ Override public void execute ( Tuple input ) { } @ Override public void cleanup ( ) { } }

Fix:
Long collectionTimeP = _gcBean . getCollectionCount ( ) ;
Buggy code:
public class ComponentLazyBindingSourceHandler implements LazyBindingSourceDescription . LazyBingingSourceDescriptionHandler { static ComponentLazyBindingSourceHandler INSTANCE = new ComponentLazyBindingSourceHandler ( ) ; private ComponentLazyBindingSourceHandler ( ) { } <START_BUG> public boolean getResourceValue ( final AbstractComponentDescription componentDescription , final BindingDescription referenceDescription , final ServiceBuilder < ? > serviceBuilder , final DeploymentPhaseContext phaseContext , final Injector < ManagedReferenceFactory > injector ) { <END_BUG> final String bindingType = referenceDescription . getBindingType ( ) ; final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final EEApplicationDescription applicationComponentDescription = deploymentUnit . getAttachment ( EE_APPLICATION_DESCRIPTION ) ; if ( applicationComponentDescription != null ) { final Set < AbstractComponentDescription > componentDescriptions = applicationComponentDescription . getComponentsForViewName ( bindingType ) ; if ( ( componentDescriptions != null ) && ( ! ( componentDescriptions . isEmpty ( ) ) ) ) { if ( ( componentDescriptions . size ( ) ) > 1 ) { throw new IllegalArgumentException ( ( ( "BindingDescription<seq2seq4repair_space>source<seq2seq4repair_space>can<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>resolved.<seq2seq4repair_space>Ambiguous<seq2seq4repair_space>required<seq2seq4repair_space>view<seq2seq4repair_space>[" + bindingType ) + "]" ) ) ; } final AbstractComponentDescription targetComponentDescription = componentDescriptions . iterator ( ) . next ( ) ; final ServiceName beanServiceName = deploymentUnit . getServiceName ( ) . append ( "component" ) . append ( targetComponentDescription . getComponentName ( ) ) . append ( "VIEW" ) . append ( bindingType ) ; serviceBuilder . addDependency ( beanServiceName , ManagedReferenceFactory . class , injector ) ; return true ; } } return false ; } }

Fix:
public boolean getResourceValue ( final BindingDescription referenceDescription , final ServiceBuilder < ? > serviceBuilder , final DeploymentPhaseContext phaseContext , final Injector < ManagedReferenceFactory > injector ) {
Buggy code:
public class Dijkstra { ArrayList < Vertex > vertices ; ArrayList < DijkstraData > dijkstras = new ArrayList < DijkstraData > ( ) ; public void computePaths ( Vertex source ) { } public Dijkstra ( Map map ) { } private void convertToVertices ( Map map ) { } private void addEdges ( Map map , Station s1 ) { } private Vertex findVertex ( Station s ) { } public double findMinDistance ( Station s1 , Station s2 ) { for ( DijkstraData d : dijkstras ) { <START_BUG> if ( ( d . getSource ( ) . getName ( ) . equals ( s1 . getName ( ) ) ) || ( d . getTarget ( ) . getName ( ) . equals ( s2 . getName ( ) ) ) ) { <END_BUG> return d . getDistance ( ) ; } } return - 1 ; } }

Fix:
if ( ( d . getSource ( ) . getName ( ) . equals ( s1 . getName ( ) ) ) && ( d . getTarget ( ) . getName ( ) . equals ( s2 . getName ( ) ) ) ) {
Buggy code:
public class ActionPluginHandler extends AbstractPluginHandler { Map map ; public ActionPluginHandler ( ) { } public boolean isSingleton ( String name ) { } public AbstractColumbaAction getAction ( String name , FrameMediator controller ) { } public IMenu getIMenu ( String name , FrameMediator controller ) throws Exception { } public void addAction ( String actionId , AbstractColumbaAction action ) { XmlElement element = new XmlElement ( "action" ) ; element . addAttribute ( "name" , actionId ) ; <START_BUG> String clazzString = action . getClass ( ) . getCanonicalName ( ) ; <END_BUG> element . addAttribute ( "class" , clazzString ) ; parentNode . addElement ( element ) ; } public void addActionList ( String actionXml ) { } }

Fix:
String clazzString = action . getClass ( ) . getName ( ) ;
Buggy code:
public class UriComponentsBuilderTests { @ Test public void plain ( ) throws URISyntaxException { } @ Test public void fromPath ( ) throws URISyntaxException { } @ Test public void fromUri ( ) throws URISyntaxException { } @ Test public void fromUriString ( ) { } @ Test public void path ( ) throws URISyntaxException { } @ Test public void pathSegments ( ) throws URISyntaxException { } @ Test public void pathThenPath ( ) { } @ Test public void pathThenPathSegments ( ) { } @ Test public void pathSegmentsThenPathSegments ( ) { } @ Test public void pathSegmentsThenPath ( ) { } @ Test public void replacePath ( ) { } @ Test public void replaceQuery ( ) { } @ Test public void queryParams ( ) throws URISyntaxException { } @ Test public void emptyQueryParam ( ) throws URISyntaxException { } @ Test public void replaceQueryParam ( ) { UriComponentsBuilder builder = UriComponentsBuilder . newInstance ( ) . queryParam ( "baz" , "qux" , 42 ) ; builder . replaceQueryParam ( "baz" , "xuq" , 24 ) ; UriComponents result = builder . build ( ) ; assertEquals ( "baz=xuq&baz=24" , result . getQuery ( ) ) ; builder = UriComponentsBuilder . newInstance ( ) . queryParam ( "baz" , "qux" , 42 ) ; builder . replaceQueryParam ( "baz" ) ; result = builder . build ( ) ; <START_BUG> assertEquals ( "baz" , result . getQuery ( ) ) ; <END_BUG> } }

Fix:
assertNull ( "Query<seq2seq4repair_space>param<seq2seq4repair_space>should<seq2seq4repair_space>have<seq2seq4repair_space>been<seq2seq4repair_space>deleted" , result . getQuery ( ) ) ;
Buggy code:
public class ManifestFile extends Task { private static final String newLine = System . getProperty ( "line.separator" ) ; private static final String keyValueSeparator = ":" ; private static final String UPDATE_ = "update" ; private static final String REPLACEALL_ = "replaceAll" ; private ManifestFile . EntryContainer container ; private String currentMethod ; private Vector entries ; private File manifestFile ; public ManifestFile ( ) { } public void setFile ( File f ) { } public void setMethod ( String method ) { } public ManifestFile . Entry createEntry ( ) { } public void execute ( ) throws BuildException { } private StringTokenizer getLineTokens ( StringBuffer buffer ) { } private boolean isReplaceAll ( String method ) { } private boolean isUpdate ( String method ) { } private void addLine ( String line ) { } private StringBuffer buildBuffer ( ) { } private boolean checkParam ( String param ) { } private boolean checkParam ( File param ) { } private void checkParameters ( ) throws BuildException { if ( ! ( checkParam ( manifestFile ) ) ) { <START_BUG> throw new BuildException ( "file<seq2seq4repair_space>token<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>null." , location ) ; <END_BUG> } } private void executeOperation ( ) throws BuildException { } private void readFile ( ) throws BuildException { } private void writeFile ( ) throws BuildException { } public class Entry implements Comparator { private String value = null ; private String val = null ; private String key = null ; public Entry ( ) { } public void setValue ( String value ) { } public String getKey ( ) { } public String getValue ( ) { } public int compare ( Object o1 , Object o2 ) { } public boolean equals ( Object obj ) { } protected void addTo ( ManifestFile . EntryContainer container ) throws BuildException { } private void checkFormat ( ) throws BuildException { } private void split ( ) { } } public class EntryContainer { private ArrayList list = null ; public EntryContainer ( ) { } public void set ( ManifestFile . Entry entry ) { } public ListIterator elements ( ) { } } }

Fix:
throw new BuildException ( "file<seq2seq4repair_space>token<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>null." ) ;
Buggy code:
SchemaDVFactoryImpl . fBuiltInTypes . put ( STRING , stringDV ) ; <START_BUG> SchemaDVFactoryImpl . fBuiltInTypes . put ( BOOLEAN , new XSSimpleTypeDecl ( anySimpleType , STRING , XSSimpleTypeDecl . DV_BOOLEAN , XSSimpleType . ORDERED_FALSE , false , true , false ) ) ; <END_BUG>

Fix:
SchemaDVFactoryImpl . fBuiltInTypes . put ( BOOLEAN , new XSSimpleTypeDecl ( anySimpleType , BOOLEAN , XSSimpleTypeDecl . DV_BOOLEAN , XSSimpleType . ORDERED_FALSE , false , true , false ) ) ;
Buggy code:
public class LabeledStatement extends Statement { public Statement statement ; public char [ ] label ; public Label targetLabel ; int mergedInitStateIndex = - 1 ; public LabeledStatement ( char [ ] l , Statement st , int s , int e ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public AstNode concreteStatement ( ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { int pc = codeStream . position ; if ( ( targetLabel ) != null ) { targetLabel . codeStream = codeStream ; if ( ( statement ) != null ) { statement . generateCode ( currentScope , codeStream ) ; } targetLabel . place ( ) ; } if ( ( mergedInitStateIndex ) != ( - 1 ) ) { codeStream . removeNotDefinitelyAssignedVariables ( currentScope , mergedInitStateIndex ) ; } <START_BUG> codeStream . recordPositionsFrom ( pc , this ) ; <END_BUG> } public void resolve ( BlockScope scope ) { } public String toString ( int tab ) { } public void traverse ( IAbstractSyntaxTreeVisitor visitor , BlockScope blockScope ) { } public void resetStateForCodeGeneration ( ) { } }

Fix:
codeStream . recordPositionsFrom ( pc , this . sourceStart ) ;
Buggy code:
public class Coverage extends Task { protected Commandline cmdl = new Commandline ( ) ; protected CommandlineJava cmdlJava = new CommandlineJava ( ) ; private String m_exitPrompt = "never" ; private Filters m_filters = new Filters ( ) ; private String m_finalSnapshot = "coverage" ; private String m_recordFromStart = "coverage" ; private boolean m_trackNatives ; private int m_warnLevel = 0 ; private ArrayList m_filesets = new ArrayList ( ) ; private File m_home ; private File m_inputFile ; private File m_javaExe ; private String m_seedName ; private File m_snapshotDir ; private Socket m_socket ; private Triggers m_triggers ; private String m_vm ; private File m_workingDir ; public void setClassname ( String value ) { } public void setExitprompt ( String value ) { } public void setFinalsnapshot ( String value ) { } public void setHome ( File value ) { } public void setInputfile ( File value ) { } public void setJavaexe ( File value ) { } public void setRecordfromstart ( Recordfromstart value ) { } public void setSeedname ( String value ) { } public void setSnapshotdir ( File value ) { } public void setTracknatives ( boolean value ) { } public void setVm ( Javavm value ) { } public void setWarnlevel ( Integer value ) { } public void setWorkingdir ( File value ) { } public void addFileset ( FileSet fs ) { } public void addArg ( final Argument argument ) { } public Path createClasspath ( ) { } public Filters createFilters ( ) { } public void addJvmarg ( final Argument argument ) { } public Socket createSocket ( ) { } public Triggers createTriggers ( ) { } public void execute ( ) throws TaskException { File paramfile = null ; if ( ( m_inputFile ) == null ) { checkOptions ( ) ; paramfile = createParamFile ( ) ; } else { paramfile = m_inputFile ; } try { cmdl . setExecutable ( new File ( m_home , "jplauncher" ) . getAbsolutePath ( ) ) ; cmdl . addArgument ( ( "-jp_input=" + ( paramfile . getAbsolutePath ( ) ) ) ) ; final Execute2 exe = new Execute2 ( ) ; setupLogger ( exe ) ; getLogger ( ) . debug ( cmdl . toString ( ) ) ; <START_BUG> exe . setCommandline ( cmdl . getCommandline ( ) ) ; <END_BUG> int exitValue = exe . execute ( ) ; if ( exitValue != 0 ) { throw new TaskException ( ( ( "JProbe<seq2seq4repair_space>Coverage<seq2seq4repair_space>failed<seq2seq4repair_space>(" + exitValue ) + ")" ) ) ; } } catch ( IOException e ) { throw new TaskException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>execute<seq2seq4repair_space>JProbe<seq2seq4repair_space>Coverage." , e ) ; } finally { if ( ( ( m_inputFile ) == null ) && ( paramfile != null ) ) { paramfile . delete ( ) ; } } } protected String [ ] getParameters ( ) throws TaskException { } protected void checkOptions ( ) throws TaskException { } protected File createParamFile ( ) throws TaskException { } }

Fix:
exe . setCommandline ( cmdl ) ;
Buggy code:
public class MethodDeclaration extends AbstractMethodDeclaration { public TypeReference returnType ; public MethodDeclaration ( CompilationResult compilationResult ) { } public void parseStatements ( Parser parser , CompilationUnitDeclaration unit ) { } public void resolveStatements ( ClassScope upperScope ) { if ( ( ( this . returnType ) != null ) && ( ( this . binding ) != null ) ) { <START_BUG> this . returnType . binding = this . binding . returnType ; <END_BUG> } if ( ( ( binding ) != null ) && ( isTypeUseDeprecated ( binding . returnType , scope ) ) ) scope . problemReporter ( ) . deprecatedType ( binding . returnType , returnType ) ; if ( CharOperation . equals ( scope . enclosingSourceType ( ) . sourceName , selector ) ) scope . problemReporter ( ) . methodWithConstructorName ( this ) ; if ( ! ( scope . enclosingSourceType ( ) . isInterface ( ) ) ) { if ( ( ( modifiers ) & ( AccSemicolonBody ) ) != 0 ) { if ( ( ( modifiers ) & ( AccNative ) ) == 0 ) if ( ( ( modifiers ) & ( AccAbstract ) ) == 0 ) scope . problemReporter ( ) . methodNeedingAbstractModifier ( this ) ; } else { if ( ( ( ( modifiers ) & ( AccNative ) ) != 0 ) || ( ( ( modifiers ) & ( AccAbstract ) ) != 0 ) ) scope . problemReporter ( ) . methodNeedingNoBody ( this ) ; } } super . resolveStatements ( upperScope ) ; } public String returnTypeToString ( int tab ) { } public void traverse ( IAbstractSyntaxTreeVisitor visitor , ClassScope classScope ) { } }

Fix:
this . returnType . resolvedType = this . binding . returnType ;
Buggy code:
@ RunWith ( PowerMockRunner . class ) @ PrepareForTest ( { UserLocker . class , UserManager . class } ) public class ClientTest { private static SSLSocket sslSocket = mock ( SSLSocket . class ) ; private static Client client = mock ( Client . class ) ; private static DataInputStream dataInputStream = null ; private static ClientFileConnector clientFileConnector ; @ BeforeClass public static void beforeClass ( ) throws IOException { } @ Before public void before ( ) { } private void beforeRun ( String action ) throws IOException { <START_BUG> Whitebox . setInternalState ( CLIENT , "userFile" , ( ( UserFile ) ( null ) ) ) ; <END_BUG> JsonObject actionRequest = new JsonObject ( ) ; actionRequest . addProperty ( ACTION , action ) ; JsonObject disconnectRequest = new JsonObject ( ) ; disconnectRequest . addProperty ( ACTION , DISCONNECT ) ; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( ) ; DataOutputStream dataOutputStream = new DataOutputStream ( byteArrayOutputStream ) ; dataOutputStream . writeUTF ( new Gson ( ) . toJson ( actionRequest ) ) ; dataOutputStream . writeUTF ( new Gson ( ) . toJson ( disconnectRequest ) ) ; ClientTest . dataInputStream = new DataInputStream ( new ByteArrayInputStream ( byteArrayOutputStream . toByteArray ( ) ) ) ; when ( ClientTest . sslSocket . getInputStream ( ) ) . thenReturn ( ClientTest . dataInputStream ) ; } @ Test public void runTestCreateUser ( ) throws Exception { } @ Test public void runTestLogin ( ) throws Exception { } private void beforeHandleAction ( String action ) throws IOException { } @ Test public void handleGetKeyFileAction ( ) throws Exception { } @ Test public void handleDownloadFileAction ( ) throws Exception { } @ Test public void handleUpdateKeyFileAction ( ) throws Exception { } @ Test public void handleUpdateFileAction ( ) throws Exception { } @ Test public void handleUploadFileAction ( ) throws Exception { } @ Test public void handleRemoveFileAction ( ) throws Exception { } }

Fix:
Whitebox . setInternalState ( ClientTest . client , "userFile" , ( ( UserFile ) ( null ) ) ) ;
Buggy code:
public class CacheProvider { private JedisStringOps stringOps = new JedisStringOps ( ) ; public void setUserSession ( String key , UserSession session ) { } public UserSession getUserSession ( String key ) { } public void removeSession ( String key ) { } public void setStudy ( Study study ) { } public Study getStudy ( String identifier ) { try { String redisKey = STUDY . getRedisKey ( identifier ) ; String ser = stringOps . get ( redisKey ) . execute ( ) ; if ( ser != null ) { stringOps . expire ( redisKey , BRIDGE_SESSION_EXPIRE_IN_SECONDS ) ; <START_BUG> return DynamoStudy . fromJson ( BridgeObjectMapper . get ( ) . readTree ( ser ) ) ; <END_BUG> } } catch ( Throwable e ) { promptToStartRedisIfLocalEnv ( e ) ; throw new BridgeServiceException ( e ) ; } return null ; } public void removeStudy ( String identifier ) { } private void promptToStartRedisIfLocalEnv ( Throwable e ) { } }

Fix:
return DynamoStudy . fromCacheJson ( BridgeObjectMapper . get ( ) . readTree ( ser ) ) ;
Buggy code:
public class ClassicProjectListener extends AbstractProjectListener { private final PrintWriter m_printWriter ; public ClassicProjectListener ( ) { } public void targetStarted ( final TargetEvent event ) { } public void targetFinished ( TargetEvent event ) { } public void log ( final LogEvent event ) { } protected PrintWriter getWriter ( ) { } protected void writeTargetHeader ( final TargetEvent event ) { } protected void writeMessage ( final LogEvent event ) { } private void writeThrowable ( final LogEvent event ) { final Throwable throwable = event . getThrowable ( ) ; if ( throwable != null ) { <START_BUG> getWriter ( ) . println ( ExceptionUtil . printStackTrace ( throwable , 5 , true ) ) ; <END_BUG> } } }

Fix:
getWriter ( ) . println ( ExceptionUtil . printStackTrace ( throwable , 8 , true ) ) ;
Buggy code:
public class WebMethodCheckForWebServiceRule extends AbstractAnnotationProcessor { @ Override public void process ( ) { AnnotationTypeDeclaration annotationDeclaration = ( ( AnnotationTypeDeclaration ) ( environment . getTypeDeclaration ( WebMethod . class . getName ( ) ) ) ) ; Collection < Declaration > annotatedTypes = environment . getDeclarationsAnnotatedWith ( annotationDeclaration ) ; for ( Declaration declaration : annotatedTypes ) { Collection < AnnotationMirror > annotationMirrors = declaration . getAnnotationMirrors ( ) ; for ( AnnotationMirror mirror : annotationMirrors ) { if ( ( mirror . getAnnotationType ( ) . getDeclaration ( ) . equals ( annotationDeclaration ) ) && ( ! ( checkForWebServiceAnnotation ( ( ( com . sun . mirror . declaration . MethodDeclaration ) ( declaration ) ) . getDeclaringType ( ) ) ) ) ) { <START_BUG> printError ( mirror . getPosition ( ) , WEBMETHOD_ONLY_SUPPORTED_ON_CLASSES_WITH_WEBSERVICE ) ; <END_BUG> } } } } private boolean checkForWebServiceAnnotation ( TypeDeclaration typeDeclaration ) { } }

Fix:
printFixableError ( mirror . getPosition ( ) , WEBMETHOD_ONLY_SUPPORTED_ON_CLASSES_WITH_WEBSERVICE ) ;
Buggy code:
public class EasySplitRequest { private final String serviceUrl = "http:////54.191.15.241//EasySplitService//EasySplitService.svc//" ; protected Context mContext ; private BaseRequest baseRequest ; public EasySplitRequest ( Context context ) { } private String getUrl ( String serviceName ) { } public String getHostEvent ( int hostID ) throws IOException , TimeoutException , HttpException { } public String getParticipantEvent ( int hostID ) throws IOException , TimeoutException , HttpException { } public String addEvent ( String name , double budget , int hostID ) throws IOException , TimeoutException , HttpException { } public String addEventParticipants ( String eventId , String firstName , String lastName , String email ) throws IOException , TimeoutException , HttpException { } public String getEventExpenses ( int eventId ) throws IOException , TimeoutException { } public String getEventParticipants ( int eventId ) throws IOException , TimeoutException { } public String login ( String email , String passcode ) throws IOException , TimeoutException { String url = "" ; ArrayList < NameValuePair > strParams = new ArrayList < NameValuePair > ( ) ; if ( ( ! ( TextUtils . isEmpty ( email ) ) ) && ( ! ( TextUtils . isEmpty ( passcode ) ) ) ) { url = ( ( ( ( getUrl ( "login" ) ) + "//" ) + email ) + "//" ) + passcode ; url = url . replace ( "<seq2seq4repair_space>" , "%20" ) ; } else { return null ; } <START_BUG> Log . v ( "" , "" ) ; <END_BUG> return baseRequest . postRequestByHttpClient ( strParams , url ) ; } }

Fix:
Log . v ( "Type<seq2seq4repair_space>1" , ( "post<seq2seq4repair_space>login<seq2seq4repair_space>url:" + url ) ) ;
Buggy code:
public class SevenZFileTest extends AbstractTestCase { private static String TEST2_CONTENT = "<?xml<seq2seq4repair_space>version<seq2seq4repair_space>=<seq2seq4repair_space>\'1.0\'?>\r\n<!DOCTYPE" + "<seq2seq4repair_space>connections>\r\n<meinxml>\r\n\t<leer<seq2seq4repair_space>//>\r\n<//meinxml>\n" ; public void testAllEmptyFilesArchive ( ) throws Exception { } public void testHelloWorldHeaderCompressionOffCopy ( ) throws Exception { } public void testHelloWorldHeaderCompressionOffLZMA2 ( ) throws Exception { } public void test7zUnarchive ( ) throws Exception { } public void test7zDeflateUnarchive ( ) throws Exception { } public void test7zDecryptUnarchive ( ) throws Exception { } private void test7zUnarchive ( File f ) throws Exception { } public void testEncryptedArchiveRequiresPassword ( ) throws Exception { try { <START_BUG> SevenZFile sevenZFile = new SevenZFile ( getFile ( "bla.encrypted.7z" ) ) ; <END_BUG> fail ( "shouldn't<seq2seq4repair_space>decrypt<seq2seq4repair_space>without<seq2seq4repair_space>a<seq2seq4repair_space>password" ) ; } catch ( IOException ex ) { assertEquals ( "Cannot<seq2seq4repair_space>read<seq2seq4repair_space>encrypted<seq2seq4repair_space>files<seq2seq4repair_space>without<seq2seq4repair_space>a<seq2seq4repair_space>password" , ex . getMessage ( ) ) ; } } private void test7zUnarchive ( File f , byte [ ] password ) throws Exception { } private void checkHelloWorld ( final String filename ) throws Exception { } private static boolean isStrongCryptoAvailable ( ) throws NoSuchAlgorithmException { } }

Fix:
new SevenZFile ( getFile ( "bla.encrypted.7z" ) ) ;
Buggy code:
public class SaveableHelper { public static final int USER_RESPONSE = - 1 ; private static int AutomatedResponse = SaveableHelper . USER_RESPONSE ; public static void testSetAutomatedResponse ( int response ) { } public static int testGetAutomatedResponse ( ) { } static boolean savePart ( final ISaveablePart saveable , IWorkbenchPart part , IWorkbenchWindow window , boolean confirm ) { } private static boolean saveModels ( ISaveablesSource modelSource , final IWorkbenchWindow window , final boolean confirm ) { Saveable [ ] selectedModels = modelSource . getActiveSaveables ( ) ; final ArrayList dirtyModels = new ArrayList ( ) ; for ( int i = 0 ; i < ( selectedModels . length ) ; i ++ ) { Saveable model = selectedModels [ i ] ; if ( model . isDirty ( ) ) { dirtyModels . add ( model ) ; } } if ( dirtyModels . isEmpty ( ) ) { return true ; } IRunnableWithProgress progressOp = new IRunnableWithProgress ( ) { public void run ( IProgressMonitor monitor ) { IProgressMonitor monitorWrap = new EventLoopProgressMonitor ( monitor ) ; <START_BUG> monitorWrap . beginTask ( "" , dirtyModels . size ( ) ) ; <END_BUG> for ( Iterator i = dirtyModels . iterator ( ) ; i . hasNext ( ) ; ) { Saveable model = ( ( Saveable ) ( i . next ( ) ) ) ; if ( ! ( model . isDirty ( ) ) ) { monitor . worked ( 1 ) ; continue ; } SaveableHelper . doSaveModel ( model , new SubProgressMonitor ( monitorWrap , 1 ) , window , confirm ) ; if ( monitor . isCanceled ( ) ) { break ; } } monitorWrap . done ( ) ; } } ; return SaveableHelper . runProgressMonitorOperation ( Save , progressOp , window ) ; } static int savePart ( final ISaveablePart2 saveable , IWorkbenchWindow window , boolean confirm ) { } static boolean runProgressMonitorOperation ( String opName , IRunnableWithProgress progressOp , IWorkbenchWindow window ) { } static boolean runProgressMonitorOperation ( String opName , final IRunnableWithProgress progressOp , final IRunnableContext runnableContext , final IShellProvider shellProvider ) { } public static boolean needsSave ( ISaveablesSource modelSource ) { } public static void doSaveModel ( final Saveable model , IProgressMonitor progressMonitor , final IShellProvider shellProvider , boolean blockUntilSaved ) { } private static void notifySaveAction ( final IWorkbenchPart [ ] parts ) { } private static boolean waitForBackgroundSaveJob ( final Saveable model ) { } public static boolean waitForBackgroundSaveJobs ( final List modelsToSave ) { } private static class DynamicFamily extends HashSet { private static final long serialVersionUID = 1L ; public DynamicFamily ( Collection collection ) { } } }

Fix:
monitorWrap . beginTask ( Save , dirtyModels . size ( ) ) ;