nus-yam/ex-repair huggingface dataset:
Buggy code:
public class PlayerCardsTouchProcessorListener implements CardsTouchProcessor . CardsTouchProcessorListener { public static final float DRAG_CARDS_HIDING_THRESHOLD = 0.75F ; public static final int DRAGGED_CARD_SORTING_LAYER = 1000 ; @ Override public void onSelectedCardTap ( CardNode cardNode ) { } @ Override public void onDraggedCardReleased ( CardNode cardNode ) { } private void handleAttackDragRelease ( CardNode cardNode ) { } private void handleRetaliationDragRelease ( CardNode cardNode ) { } private void returnCardToPlayerHand ( CardNode cardNode ) { } private CardNode findUnderlyingCard ( CardNode cardNode ) { PileManagerService pileManager = ServiceLocator . locateService ( PileManagerService . class ) ; CardNodesManagerService cardNodesManagerService = ServiceLocator . locateService ( CardNodesManagerService . class ) ; for ( PileModel pileModel : pileManager . getFieldPiles ( ) ) { <START_BUG> if ( ( pileModel . getCardsInPile ( ) . size ( ) ) > 1 ) <END_BUG> continue ; CardNode collisionTestCardNode = cardNodesManagerService . getCardNodeForCard ( pileModel . getCardsInPile ( ) . iterator ( ) . next ( ) ) ; if ( YANCollisionDetector . areTwoNodesCollide ( cardNode , collisionTestCardNode ) ) return collisionTestCardNode ; } return null ; } @ Override public void onCardDragProgress ( CardNode cardNode ) { } public static float clamp ( float val , float min , float max ) { } }

Fix:
if ( ( pileModel . getCardsInPile ( ) . isEmpty ( ) ) || ( ( pileModel . getCardsInPile ( ) . size ( ) ) > 1 ) )
Buggy code:
public class JavaScript extends AbstractFunction { private static final List < String > desc = new LinkedList < String > ( ) ; private static final String KEY = "__javaScript" ; private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private Object [ ] values ; public JavaScript ( ) { } @ Override public synchronized String execute ( SampleResult previousResult , Sampler currentSampler ) throws InvalidVariableException { JMeterContext jmctx = JMeterContextService . getContext ( ) ; JMeterVariables vars = jmctx . getVariables ( ) ; String script = ( ( CompoundVariable ) ( values [ 0 ] ) ) . execute ( ) ; String varName = ( ( values . length ) < 2 ) ? null : ( ( CompoundVariable ) ( values [ 1 ] ) ) . execute ( ) . trim ( ) ; String resultStr = "" ; Context cx = Context . enter ( ) ; try { Scriptable scope = cx . initStandardObjects ( null ) ; scope . put ( "log" , scope , JavaScript . log ) ; scope . put ( "ctx" , scope , jmctx ) ; scope . put ( "vars" , scope , vars ) ; scope . put ( "props" , scope , JMeterUtils . getJMeterProperties ( ) ) ; scope . put ( "threadName" , scope , Thread . currentThread ( ) . getName ( ) ) ; scope . put ( "sampler" , scope , currentSampler ) ; scope . put ( "sampleResult" , scope , previousResult ) ; Object result = cx . evaluateString ( scope , script , "<cmd>" , 1 , null ) ; resultStr = Context . toString ( result ) ; if ( ( varName != null ) && ( vars != null ) ) { vars . put ( varName , resultStr ) ; } } catch ( RhinoException e ) { <START_BUG> JavaScript . log . error ( "Error<seq2seq4repair_space>processing<seq2seq4repair_space>Javascript" , e ) ; <END_BUG> throw new InvalidVariableException ( ) ; } finally { Context . exit ( ) ; } return resultStr ; } @ Override public synchronized void setParameters ( Collection < CompoundVariable > parameters ) throws InvalidVariableException { } @ Override public String getReferenceKey ( ) { } public List < String > getArgumentDesc ( ) { } }

Fix:
JavaScript . log . error ( ( ( "Error<seq2seq4repair_space>processing<seq2seq4repair_space>Javascript:<seq2seq4repair_space>[" + script ) + "]\n" ) , e ) ;
Buggy code:
public class AddMetadataToPCOA { public static void main ( String [ ] args ) throws Exception { HashMap < String , RawDesignMatrixParser > metaMap = RawDesignMatrixParser . getByFullId ( ) ; BufferedReader reader = new BufferedReader ( new FileReader ( new File ( ( ( ( ( ( ( ( ( ( ( ( ( ConfigReader . getMbqcDir ( ) ) + ( File . separator ) ) + ( File . separator ) ) + "dropbox" ) + ( File . separator ) ) + "alpha-beta-div" ) + ( File . separator ) ) + "beta-div" ) + ( File . separator ) ) + "attic" ) + ( File . separator ) ) + "pcoa-qiime.txt" ) ) ) ) ; BufferedWriter writer = new BufferedWriter ( new FileWriter ( new File ( ( ( ( ( ( ( ( ( ( ( ( ( ConfigReader . getMbqcDir ( ) ) + ( File . separator ) ) + ( File . separator ) ) + "dropbox" ) + ( File . separator ) ) + "alpha-beta-div" ) + ( File . separator ) ) + "beta-div" ) + ( File . separator ) ) + "attic" ) + ( File . separator ) ) + "pcoa-qiimeWithMetadata.txt" ) ) ) ) ; writer . write ( "fullID\tinformaticsToken\tobscuredToken\tnumberToken\textractionWetlab\tsequencingWetlab\t" ) ; <START_BUG> writer . write ( ( ( reader . readLine ( ) ) + "\n" ) ) ; <END_BUG> int numFound = 0 ; int numMissed = 0 ; for ( String s = reader . readLine ( ) ; s != null ; s = reader . readLine ( ) ) { String [ ] splits = s . split ( "\t" ) ; if ( metaMap . containsKey ( splits [ 0 ] ) ) { numFound ++ ; writer . write ( ( ( splits [ 0 ] ) + "\t" ) ) ; StringTokenizer innerSplits = new StringTokenizer ( splits [ 0 ] , "." ) ; writer . write ( ( ( ( ( ( ( innerSplits . nextToken ( ) ) + "\t" ) + ( innerSplits . nextToken ( ) ) ) + "\t" ) + ( innerSplits . nextToken ( ) ) ) + "\t" ) ) ; if ( innerSplits . hasMoreTokens ( ) ) throw new Exception ( "No" ) ; RawDesignMatrixParser rdmp = metaMap . get ( splits [ 0 ] ) ; writer . write ( ( ( ( ( rdmp . getExtractionWetlab ( ) ) + "\t" ) + ( rdmp . getSequecingWetlab ( ) ) ) + "\t" ) ) ; writer . write ( ( ( ( ( splits [ 1 ] ) + "\t" ) + ( splits [ 2 ] ) ) + "\n" ) ) ; if ( ( splits . length ) != 3 ) throw new Exception ( "No" ) ; } else { numMissed ++ ; } } writer . flush ( ) ; writer . close ( ) ; System . out . println ( ( ( numFound + "<seq2seq4repair_space>" ) + numMissed ) ) ; } }

Fix:
writer . write ( "pcoa1\tpcoa2\n" ) ;
Buggy code:
public class CurrentLevel_Bar { private GameManager gm ; private SpriteBatch batch ; private BitmapFont textFont ; private String CurrentLevel ; @ SuppressWarnings ( "deprecation" ) public CurrentLevel_Bar ( GameManager gm ) { } public void render ( ) { batch . setProjectionMatrix ( gm . getCam ( ) . combined ) ; batch . begin ( ) ; <START_BUG> textFont . draw ( batch , CurrentLevel , ( ( gm . WIDTH ) // 8 ) , ( ( gm . HEIGHT ) // 8 ) ) ; <END_BUG> batch . end ( ) ; } }

Fix:
textFont . draw ( batch , CurrentLevel , ( ( gm . getWidth ( ) ) // 8 ) , ( ( gm . getHeight ( ) ) // 8 ) ) ;
Buggy code:
@ RunWith ( Arquillian . class ) @ RunAsClient public class FileWithPropertiesTestCase { private static final int CLI_PROC_TIMEOUT = 10000 ; private static final int STATUS_CHECK_INTERVAL = 2000 ; private static final String SERVER_PROP_NAME = "cli-arg-test" ; private static final String CLI_PROP_NAME = "cli.prop.name" ; private static final String CLI_PROP_VALUE = "cli.prop.value" ; private static final String HOST_PROP_NAME = "cli.host.name" ; private static final String HOST_PROP_VALUE = TestSuiteEnvironment . getServerAddress ( ) ; private static final String PORT_PROP_NAME = "cli.port.name" ; private static final String PORT_PROP_VALUE = String . valueOf ( TestSuiteEnvironment . getServerPort ( ) ) ; private static final String CONNECT_COMMAND = ( ( ( "connect<seq2seq4repair_space>${" + ( FileWithPropertiesTestCase . HOST_PROP_NAME ) ) + "}:${" ) + ( FileWithPropertiesTestCase . PORT_PROP_NAME ) ) + "}" ; private static final String SET_PROP_COMMAND = ( "//system-property=" + ( FileWithPropertiesTestCase . SERVER_PROP_NAME ) ) + ":add(value=${cli.prop.name})" ; private static final String GET_PROP_COMMAND = ( "//system-property=" + ( FileWithPropertiesTestCase . SERVER_PROP_NAME ) ) + ":read-resource" ; private static final String REMOVE_PROP_COMMAND = ( "//system-property=" + ( FileWithPropertiesTestCase . SERVER_PROP_NAME ) ) + ":remove" ; private static final String SCRIPT_NAME = "jboss-cli-file-arg-test.cli" ; private static final String PROPS_NAME = "jboss-cli-file-arg-test.properties" ; private static final File SCRIPT_FILE ; private static final File PROPS_FILE ; private static final File TMP_JBOSS_CLI_FILE ; @ BeforeClass public static void setup ( ) { } @ AfterClass public static void cleanUp ( ) { } protected static void ensureRemoved ( File f ) { } private String cliOutput ; private static String jbossDist ; @ Test public void testResolved ( ) { } @ Test public void testNotresolved ( ) { assertEquals ( 1 , execute ( false , true ) ) ; assertNotNull ( cliOutput ) ; assertEquals ( "failed" , getValue ( "outcome" ) ) ; <START_BUG> assertTrue ( getValue ( "failure-description" ) . contains ( "WFLYCTL0211" ) ) ; <END_BUG> } protected String getValue ( final String value ) { } protected int execute ( boolean resolveProps , boolean logFailure ) { } protected void readStream ( final StringBuilder cliOutBuf , InputStream cliStream ) { } }

Fix:
assertTrue ( getValue ( "failure-description" ) . contains ( "JBAS014802" ) ) ;
Buggy code:
public class TileCorporeaInterceptor extends TileCorporeaBase implements ICorporeaInterceptor { @ Override public boolean isItemValidForSlot ( int i , ItemStack itemstack ) { } @ Override public int getSizeInventory ( ) { } @ Override public String getInventoryName ( ) { } @ Override public void interceptRequest ( Object request , int count , ICorporeaSpark spark , ICorporeaSpark source , List < ItemStack > stacks , List < IInventory > inventories , boolean doit ) { } @ Override public void interceptRequestLast ( Object request , int count , ICorporeaSpark spark , ICorporeaSpark source , List < ItemStack > stacks , List < IInventory > inventories , boolean doit ) { } public boolean requestMatches ( Object request , ItemStack filter ) { if ( request instanceof ItemStack ) { ItemStack stack = ( ( ItemStack ) ( request ) ) ; <START_BUG> return ( stack . isItemEqual ( filter ) ) && ( ItemStack . areItemStacksEqual ( filter , stack ) ) ; <END_BUG> } String name = ( ( String ) ( request ) ) ; return CorporeaHelper . stacksMatch ( filter , name ) ; } public List < ItemStack > getFilter ( ) { } }

Fix:
return ( ( stack != null ) && ( stack . isItemEqual ( filter ) ) ) && ( ItemStack . areItemStacksEqual ( filter , stack ) ) ;
Buggy code:
public class StompSubProtocolHandlerTests { private StompSubProtocolHandler protocolHandler ; private TestWebSocketSession session ; private MessageChannel channel ; @ SuppressWarnings ( "rawtypes" ) private ArgumentCaptor < Message > messageCaptor ; @ Before public void setup ( ) { } @ Test public void handleMessageToClientConnected ( ) { } @ Test public void handleMessageToClientConnectedUniqueUserName ( ) { } @ Test public void handleMessageToClientConnectedWithHeartbeats ( ) { } @ Test public void handleMessageToClientConnectAck ( ) { } @ Test public void eventPublication ( ) { StompSubProtocolHandlerTests . TestPublisher publisher = new StompSubProtocolHandlerTests . TestPublisher ( ) ; UserSessionRegistry registry = new DefaultUserSessionRegistry ( ) ; this . protocolHandler . setUserSessionRegistry ( registry ) ; this . protocolHandler . setApplicationEventPublisher ( publisher ) ; this . protocolHandler . afterSessionStarted ( this . session , this . channel ) ; StompHeaderAccessor headers = StompHeaderAccessor . create ( CONNECT ) ; Message < byte [ ] > message = MessageBuilder . withPayload ( new byte [ 0 ] ) . setHeaders ( headers ) . build ( ) ; TextMessage textMessage = new TextMessage ( new StompEncoder ( ) . encode ( message ) ) ; this . protocolHandler . handleMessageFromClient ( this . session , textMessage , this . channel ) ; headers = StompHeaderAccessor . create ( CONNECTED ) ; message = MessageBuilder . withPayload ( new byte [ 0 ] ) . setHeaders ( headers ) . build ( ) ; this . protocolHandler . handleMessageToClient ( this . session , message ) ; this . protocolHandler . afterSessionEnded ( this . session , BAD_DATA , this . channel ) ; <START_BUG> assertEquals ( 3 , publisher . events . size ( ) ) ; <END_BUG> assertEquals ( SessionConnectEvent . class , publisher . events . get ( 0 ) . getClass ( ) ) ; assertEquals ( SessionConnectedEvent . class , publisher . events . get ( 1 ) . getClass ( ) ) ; assertEquals ( SessionDisconnectEvent . class , publisher . events . get ( 2 ) . getClass ( ) ) ; } @ Test public void eventPublicationWithExceptions ( ) { } @ Test public void handleMessageToClientUserDestination ( ) { } @ Test public void handleMessageFromClient ( ) { } @ Test public void handleMessageFromClientInvalidStompCommand ( ) { } private static class UniqueUser extends TestPrincipal implements DestinationUserNameProvider { private UniqueUser ( String name ) { } @ Override public String getDestinationUserName ( ) { } } private static class TestPublisher implements ApplicationEventPublisher { private final List < ApplicationEvent > events = new ArrayList < ApplicationEvent > ( ) ; @ Override public void publishEvent ( ApplicationEvent event ) { } } }

Fix:
assertEquals ( ( "Unexpected<seq2seq4repair_space>events<seq2seq4repair_space>" + ( publisher . events ) ) , 3 , publisher . events . size ( ) ) ;
Buggy code:
public class EjbJndiBindingsDeploymentUnitProcessor implements DeploymentUnitProcessor { private static final Logger logger = Logger . getLogger ( EjbJndiBindingsDeploymentUnitProcessor . class ) ; private final boolean appclient ; public EjbJndiBindingsDeploymentUnitProcessor ( final boolean appclient ) { } @ Override public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private void setupJNDIBindings ( EJBComponentDescription sessionBean , DeploymentUnit deploymentUnit ) throws DeploymentUnitProcessingException { } private void registerBinding ( final EJBComponentDescription componentDescription , final ViewDescription viewDescription , final String jndiName ) { } private void registerRemoteBinding ( final EJBComponentDescription componentDescription , final ViewDescription viewDescription , final String jndiName ) { final EEModuleDescription moduleDescription = componentDescription . getModuleDescription ( ) ; final InjectedValue < ClassLoader > viewClassLoader = new InjectedValue < ClassLoader > ( ) ; moduleDescription . getBindingConfigurations ( ) . add ( new BindingConfiguration ( jndiName , new org . jboss . as . ejb3 . remote . RemoteViewInjectionSource ( null , moduleDescription . getEarApplicationName ( ) , moduleDescription . getModuleName ( ) , moduleDescription . getDistinctName ( ) , componentDescription . getComponentName ( ) , viewDescription . getViewClassName ( ) , componentDescription . isStateful ( ) , viewClassLoader ) ) ) ; componentDescription . getConfigurators ( ) . add ( new ComponentConfigurator ( ) { public void configure ( DeploymentPhaseContext context , ComponentDescription description , ComponentConfiguration configuration ) throws DeploymentUnitProcessingException { <START_BUG> viewClassLoader . setValue ( Values . immediateValue ( configuration . getModuleClassLoder ( ) ) ) ; <END_BUG> } } ) ; } private void logBinding ( final StringBuilder jndiBindingsLogMessage , final String jndiName ) { } @ Override public void undeploy ( DeploymentUnit context ) { } }

Fix:
viewClassLoader . setValue ( Values . immediateValue ( configuration . getModuleClassLoader ( ) ) ) ;
Buggy code:
public class RandomDataImpl implements Serializable , RandomData { private static final long serialVersionUID = - 626730818244969716L ; private RandomGenerator rand = null ; private SecureRandom secRand = null ; public RandomDataImpl ( ) { } public RandomDataImpl ( RandomGenerator rand ) { } public String nextHexString ( int len ) { } public int nextInt ( int lower , int upper ) { } public long nextLong ( long lower , long upper ) { } public String nextSecureHexString ( int len ) { } public int nextSecureInt ( int lower , int upper ) { } public long nextSecureLong ( long lower , long upper ) { } public long nextPoisson ( double mean ) { } public double nextGaussian ( double mu , double sigma ) { } public double nextExponential ( double mean ) { } public double nextUniform ( double lower , double upper ) { if ( lower >= upper ) { <START_BUG> throw new IllegalArgumentException ( "lower<seq2seq4repair_space>bound<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space><=<seq2seq4repair_space>upper<seq2seq4repair_space>bound" ) ; <END_BUG> } RandomGenerator rand = getRan ( ) ; double u = rand . nextDouble ( ) ; while ( u <= 0.0 ) { u = rand . nextDouble ( ) ; } return lower + ( u * ( upper - lower ) ) ; } private RandomGenerator getRan ( ) { } private SecureRandom getSecRan ( ) { } public void reSeed ( long seed ) { } public void reSeedSecure ( ) { } public void reSeedSecure ( long seed ) { } public void reSeed ( ) { } public void setSecureAlgorithm ( String algorithm , String provider ) throws NoSuchAlgorithmException , NoSuchProviderException { } public int [ ] nextPermutation ( int n , int k ) { } public Object [ ] nextSample ( Collection c , int k ) { } private void shuffle ( int [ ] list , int end ) { } private int [ ] getNatural ( int n ) { } }

Fix:
throw new IllegalArgumentException ( "lower<seq2seq4repair_space>bound<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space><<seq2seq4repair_space>upper<seq2seq4repair_space>bound" ) ;
Buggy code:
public class WebResponseWithCryptedUrl extends WebResponse { private static Log log = LogFactory . getLog ( WebResponseWithCryptedUrl . class ) ; public WebResponseWithCryptedUrl ( final HttpServletResponse httpServletResponse ) throws IOException { } public String encodeURL ( String url ) { } private String escapeUrl ( String queryString ) { } private String shortenUrl ( String queryString ) { <START_BUG> queryString = Strings . replaceAll ( queryString , "component=" , "1=" ) ; <END_BUG> queryString = Strings . replaceAll ( queryString , "version=" , "2=" ) ; queryString = Strings . replaceAll ( queryString , "interface=IRedirectListener" , "4=" ) ; queryString = Strings . replaceAll ( queryString , "interface=" , "3=" ) ; queryString = Strings . replaceAll ( queryString , "bookmarkablePage=" , "5=" ) ; if ( WebResponseWithCryptedUrl . log . isInfoEnabled ( ) ) { Pattern words = Pattern . compile ( "\\w\\w\\w+" ) ; Matcher matcher = words . matcher ( queryString ) ; while ( matcher . find ( ) ) { String word = queryString . substring ( matcher . start ( ) , matcher . end ( ) ) ; WebResponseWithCryptedUrl . log . info ( ( ( ( ( "URL<seq2seq4repair_space>pattern<seq2seq4repair_space>NOT<seq2seq4repair_space>shortened:<seq2seq4repair_space>'" + word ) + "'<seq2seq4repair_space>-<seq2seq4repair_space>'" ) + queryString ) + "'" ) ) ; } } return queryString ; } }

Fix:
queryString = Strings . replaceAll ( queryString , "path=" , "1=" ) ;
Buggy code:
public enum EntityType { BALL , PADDLE , WALL ; public static Asset getAssetForEntityType ( EntityType type ) { Asset asset = null ; switch ( type ) { case BALL : asset = Asset . BALL ; break ; case PADDLE : <START_BUG> asset = Asset . BALL ; <END_BUG> break ; } return asset ; } }

Fix:
asset = Asset . PADDLE ;
Buggy code:
public class CmdTag extends FCommand { public CmdTag ( ) { } @ Override public void perform ( ) { String tag = this . argAsString ( 0 ) ; if ( ( Factions . getInstance ( ) . isTagTaken ( tag ) ) && ( ! ( MiscUtil . getComparisonString ( tag ) . equals ( myFaction . getComparisonTag ( ) ) ) ) ) { msg ( COMMAND_TAG_TAKEN ) ; return ; } ArrayList < String > errors = MiscUtil . validateTag ( tag ) ; if ( ( errors . size ( ) ) > 0 ) { sendMessage ( errors ) ; return ; } if ( ! ( canAffordCommand ( econCostTag , COMMAND_TAG_TOCHANGE . toString ( ) ) ) ) { return ; } FactionRenameEvent renameEvent = new FactionRenameEvent ( fme , tag ) ; Bukkit . getServer ( ) . getPluginManager ( ) . callEvent ( renameEvent ) ; if ( renameEvent . isCancelled ( ) ) { return ; } if ( ! ( payForCommand ( econCostTag , COMMAND_TAG_TOCHANGE , COMMAND_TAG_FORCHANGE ) ) ) { return ; } String oldtag = myFaction . getTag ( ) ; myFaction . setTag ( tag ) ; for ( FPlayer fplayer : FPlayers . getInstance ( ) . getOnlinePlayers ( ) ) { <START_BUG> if ( ( fplayer . getFactionId ( ) ) == ( myFaction . getId ( ) ) ) { <END_BUG> fplayer . msg ( COMMAND_TAG_FACTION , fme . describeTo ( myFaction , true ) , myFaction . getTag ( myFaction ) ) ; continue ; } Faction faction = fplayer . getFaction ( ) ; fplayer . msg ( COMMAND_TAG_CHANGED , ( ( fme . getColorTo ( faction ) ) + oldtag ) , myFaction . getTag ( faction ) ) ; } FTeamWrapper . updatePrefixes ( myFaction ) ; } }

Fix:
if ( fplayer . getFactionId ( ) . equals ( myFaction . getId ( ) ) ) {
Buggy code:
public class AnimoServlet extends HttpServlet { private static final long serialVersionUID = - 7842813965460705795L ; @ Override public void doGet ( HttpServletRequest req , HttpServletResponse res ) throws IOException , ServletException { long startTime = System . currentTimeMillis ( ) ; try { Expression request = new AnimoServlet . AnimoRequest ( req ) ; long modified = ( ( Long ) ( MODIFIED . get ( request ) ) ) ; res . setDateHeader ( "Last-Modified" , modified ) ; boolean isHTTP11 = req . getProtocol ( ) . endsWith ( "1.1" ) ; if ( isHTTP11 ) { String hash = byteArrayToHex ( ( ( byte [ ] ) ( HASH . get ( request ) ) ) ) ; res . setHeader ( "ETag" , hash ) ; Enumeration < String > etag = req . getHeaders ( "If-None-Match" ) ; while ( etag . hasMoreElements ( ) ) { <START_BUG> if ( hash . equals ( etag ) ) { <END_BUG> res . setStatus ( SC_NOT_MODIFIED ) ; return ; } } } long since = req . getDateHeader ( "If-Modified-Since" ) ; if ( ( since < modified ) || ( since > startTime ) ) { if ( isHTTP11 ) { res . setHeader ( "Cache-Control" , "no-cache" ) ; } res . setDateHeader ( "Expires" , modified ) ; WebSerializer . serialize ( request , res ) ; } else { res . setStatus ( SC_NOT_MODIFIED ) ; } } catch ( Exception e ) { ErrorHandler . doRequest ( req , res , e ) ; } System . out . println ( ( "Generated<seq2seq4repair_space>in<seq2seq4repair_space>" + ( ( System . currentTimeMillis ( ) ) - startTime ) ) ) ; } protected static class AnimoRequest extends AbstractRequestExpression { private static final int MAX_PARTS_COUNT = 12 ; private List < String > list = new ArrayList < String > ( AnimoServlet . AnimoRequest . MAX_PARTS_COUNT ) ; private static final String ROOT = "root" ; public AnimoRequest ( HttpServletRequest req ) throws Exception { } @ Override public void context ( ) throws IOException , AnimoException { } } }

Fix:
if ( hash . equals ( etag . nextElement ( ) ) ) {
Buggy code:
public class DirSet extends AbstractFileSet implements ResourceCollection { public DirSet ( ) { } protected DirSet ( DirSet dirset ) { } public Object clone ( ) { } public Iterator iterator ( ) { if ( isReference ( ) ) { return ( ( DirSet ) ( getRef ( getProject ( ) ) ) ) . iterator ( ) ; } <START_BUG> return new org . apache . tools . ant . types . resources . FileResourceIterator ( getDir ( getProject ( ) ) , getDirectoryScanner ( getProject ( ) ) . getIncludedDirectories ( ) ) ; <END_BUG> } public int size ( ) { } public boolean isFilesystemOnly ( ) { } public String toString ( ) { } }

Fix:
return new org . apache . tools . ant . types . resources . FileResourceIterator ( getProject ( ) , getDir ( getProject ( ) ) , getDirectoryScanner ( getProject ( ) ) . getIncludedDirectories ( ) ) ;
Buggy code:
public class Menu extends MenuWidget { public static final int DEFAULT_WIDTH = 600 ; public static final int DEFAULT_HEIGHT = 400 ; private List < MenuWidget > widgets = new ArrayList < > ( ) ; public Menu ( int width , int height ) { } public Menu ( int x , int y , int width , int height ) { } public void setBounds ( int width , int height ) { } public void add ( MenuWidget b ) { } @ Override public void render ( ) { updateBounds ( ) ; context . pushStyle ( ) ; context . fill ( 100 , 200 ) ; <START_BUG> context . rect ( xPos , yPos , width , height , 10 ) ; <END_BUG> context . popStyle ( ) ; for ( MenuWidget w : widgets ) w . render ( ) ; } }

Fix:
context . rect ( ( ( int ) ( xPos ) ) , ( ( int ) ( yPos ) ) , ( ( int ) ( width ) ) , ( ( int ) ( height ) ) , 10 ) ;
Buggy code:
public abstract class Employee { public abstract int getLocalAllocation ( ) { } public ArrayList < Employee > directSubordinates = null ; public int getAllocation ( ) { } public int getAllocation ( int depth ) { int localAllocation = getLocalAllocation ( ) ; <START_BUG> if ( ( directSubordinates ) != null ) { <END_BUG> for ( Employee e : directSubordinates ) { localAllocation += e . getAllocation ( ( depth - 1 ) ) ; } } return localAllocation ; } No newline ; at end ; of file ; }

Fix:
if ( ( ( directSubordinates ) != null ) && ( ! ( depth < 0 ) ) ) {
Buggy code:
public final class WebAsyncManager { private static final Object RESULT_NONE = new Object ( ) ; private static final Log logger = LogFactory . getLog ( WebAsyncManager . class ) ; private static final UrlPathHelper urlPathHelper = new UrlPathHelper ( ) ; private static final CallableProcessingInterceptor timeoutCallableInterceptor = new TimeoutCallableProcessingInterceptor ( ) ; private static final DeferredResultProcessingInterceptor timeoutDeferredResultInterceptor = new TimeoutDeferredResultProcessingInterceptor ( ) ; private AsyncWebRequest asyncWebRequest ; private AsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor ( this . getClass ( ) . getSimpleName ( ) ) ; private Object concurrentResult = WebAsyncManager . RESULT_NONE ; private Object [ ] concurrentResultContext ; private final Map < Object , CallableProcessingInterceptor > callableInterceptors = new LinkedHashMap < Object , CallableProcessingInterceptor > ( ) ; private final Map < Object , DeferredResultProcessingInterceptor > deferredResultInterceptors = new LinkedHashMap < Object , DeferredResultProcessingInterceptor > ( ) ; WebAsyncManager ( ) { } public void setAsyncWebRequest ( final AsyncWebRequest asyncWebRequest ) { } public void setTaskExecutor ( AsyncTaskExecutor taskExecutor ) { } public boolean isConcurrentHandlingStarted ( ) { } public boolean hasConcurrentResult ( ) { } public Object getConcurrentResult ( ) { } public Object [ ] getConcurrentResultContext ( ) { } public CallableProcessingInterceptor getCallableInterceptor ( Object key ) { } public DeferredResultProcessingInterceptor getDeferredResultInterceptor ( Object key ) { } public void registerCallableInterceptor ( Object key , CallableProcessingInterceptor interceptor ) { } public void registerCallableInterceptors ( CallableProcessingInterceptor ... interceptors ) { } public void registerDeferredResultInterceptor ( Object key , DeferredResultProcessingInterceptor interceptor ) { } public void registerDeferredResultInterceptors ( DeferredResultProcessingInterceptor ... interceptors ) { } public void clearConcurrentResult ( ) { } <START_BUG> @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) <END_BUG> public void startCallableProcessing ( final Callable < ? > callable , Object ... processingContext ) throws Exception { Assert . notNull ( callable , "Callable<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>null" ) ; startCallableProcessing ( new WebAsyncTask ( callable ) , processingContext ) ; } public void startCallableProcessing ( final WebAsyncTask < ? > webAsyncTask , Object ... processingContext ) throws Exception { } private void setConcurrentResultAndDispatch ( Object result ) { } public void startDeferredResultProcessing ( final DeferredResult < ? > deferredResult , Object ... processingContext ) throws Exception { } private void startAsyncProcessing ( Object [ ] processingContext ) { } }

Fix:
@ SuppressWarnings ( { "unchecked" } )
Buggy code:
@ RunWith ( Arquillian . class ) @ ServerSetup ( BasicDeployment15TestCase . BasicDeploymentTestCaseSetup . class ) public class BasicDeployment15TestCase extends ContainerResourceMgmtTestBase { static class BasicDeploymentTestCaseSetup extends AbstractMgmtServerSetupTask { @ Override public void doSetup ( final ManagementClient managementClient ) throws Exception { String xml = FileUtils . readFile ( BasicDeployment15TestCase . class , "basic15.xml" ) ; <START_BUG> List < ModelNode > operations = xmlToModelOperations ( xml , CURRENT . getUriString ( ) , new ResourceAdapterSubsystemParser ( ) ) ; <END_BUG> executeOperation ( operationListToCompositeOperation ( operations ) ) ; } @ Override public void tearDown ( final ManagementClient managementClient , final String containerId ) throws Exception { } } @ Deployment public static ResourceAdapterArchive createDeployment ( ) throws Exception { } @ Resource ( mappedName = "java:jboss//name1" ) private MultipleConnectionFactory1 connectionFactory1 ; @ Resource ( mappedName = "java:jboss//Name3" ) private MultipleAdminObject1 adminObject1 ; @ Test public void testConfiguration ( ) throws Throwable { } }

Fix:
List < ModelNode > operations = xmlToModelOperations ( xml , RESOURCEADAPTERS_1_0 . getUriString ( ) , new ResourceAdapterSubsystemParser ( ) ) ;
Buggy code:
@ Path ( "//users" ) @ Produces ( MediaType . TEXT_HTML ) public class UserResource { private static final long ONE_WEEK_MILLIS = TimeUnit . DAYS . toMillis ( 7 ) ; public static final String RUNBUD_COOKIE_KEY = "runbud.cookie" ; private final PasswordHasher passwordHasher = new PasswordHasher ( ) ; private final UserDAO userDAO ; private final UserCredentialsDAO userCredentialsDAO ; private final URI URL_SITE_ROOT ; public UserResource ( UserDAO userDAO , UserCredentialsDAO userCredentialsDAO ) { } @ GET @ UnitOfWork @ Path ( "//create" ) public View getCreateUserPage ( @ Auth ( required = false ) User user ) { } @ POST @ UnitOfWork @ Path ( "//create" ) public CreateUserSuccessView createNewRun ( @ FormParam ( "name" ) String name , @ FormParam ( "email" ) String email , @ FormParam ( "password" ) String password ) { final String salt = passwordHasher . generateSalt ( ) ; try { final User user = userDAO . persist ( new User ( email , name ) ) ; final UserCredentials userCredentials = new UserCredentials ( user . getUserId ( ) , passwordHasher . hash ( password , salt ) , salt , "" , 0 ) ; userCredentials . generateNewToken ( ( ( System . currentTimeMillis ( ) ) + ( UserResource . ONE_WEEK_MILLIS ) ) ) ; userCredentialsDAO . persist ( userCredentials ) ; <START_BUG> return new CreateUserSuccessView ( Optional . fromNullable ( user ) ) ; <END_BUG> } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } @ GET @ UnitOfWork @ Path ( "//login" ) public LoginView loginPage ( @ Auth ( required = false ) User user ) { } @ POST @ UnitOfWork @ Path ( "//login" ) public Response login ( @ FormParam ( "email" ) String email , @ FormParam ( "password" ) String password ) { } @ GET @ UnitOfWork @ Path ( "//logout" ) public Response logout ( ) { } }

Fix:
return new CreateUserSuccessView ( Optional . < User > absent ( ) ) ;
Buggy code:
public interface ICommentService { <START_BUG> public Comment addComment ( Comment comment ) ; <END_BUG> public Comment getComment ( Long id ) { } public Comment getCommentByMessage ( String message ) { } public Comment updateComment ( Comment comment ) { } public boolean deleteComment ( Long id ) { } public List < Comment > getComments ( ) { } }

Fix:
public void addComment ( Comment comment ) ;
Buggy code:
public class Demo { private static final int NUM_PROGRAMS = 9 ; public static final SensorPort BUMP_RIGHT = SensorPort . S1 ; public static final SensorPort BUMP_LEFT = SensorPort . S2 ; public static final SensorPort ULTRA_SOUND = SensorPort . S3 ; public static final SensorPort LIGHT = SensorPort . S4 ; public static void main ( String [ ] args ) { int program = 0 ; Program current = null ; BarcodeReader barcode = new BarcodeReader ( Demo . LIGHT ) ; while ( program < ( Demo . NUM_PROGRAMS ) ) { if ( current != null ) { while ( current . isRunning ( ) ) { current . halt ( ) ; Demo . sleep ( 10 ) ; } } switch ( program ) { case 0 : current = new StartNeu ( ) ; LCD . drawString ( "Start" , 0 , 0 ) ; break ; case 1 : current = new LineFollower ( ) ; LCD . drawString ( "Line" , 0 , 0 ) ; break ; case 2 : current = new BridgeDriving ( ) ; LCD . drawString ( "Bridge" , 0 , 0 ) ; break ; case 3 : current = new LiftDriving ( ) ; LCD . drawString ( "Lift<seq2seq4repair_space>" , 0 , 0 ) ; break ; case 4 : current = new Labyrinth ( ) ; LCD . drawString ( "Labyrinth" , 0 , 0 ) ; break ; case 5 : current = new DoorDriving ( ) ; break ; case 6 : current = new PlankBridge ( ) ; break ; case 7 : current = new TurnTableProgram ( ) ; break ; case 8 : TrackSuspension track = TrackSuspension . getInstance ( ) ; track . setSpeed ( 5000 ) ; track . forward ( ) ; SensorArm . getInstance ( ) . shootLeft ( ) ; SensorArm . getInstance ( ) . shootRight ( ) ; SensorArm . getInstance ( ) . turnToPosition ( 90 ) ; break ; default : current = null ; } if ( current != null ) { new Thread ( current ) . start ( ) ; while ( ! ( current . isRunning ( ) ) ) { Demo . sleep ( 100 ) ; } boolean buttonPressed = false ; while ( current . isRunning ( ) ) { if ( ( Button . waitForAnyPress ( 100 ) ) > 0 ) { buttonPressed = true ; current . halt ( ) ; } } if ( ! buttonPressed ) { switch ( program ) { case 1 : case 4 : case 6 : LCD . drawString ( ( "Barcode<seq2seq4repair_space>value:<seq2seq4repair_space>" + ( barcode . readBarcode ( ) ) ) , 0 , 1 ) ; <START_BUG> Aligner aligner = new Aligner ( Demo . LIGHT , 35 , false ) ; <END_BUG> aligner . align ( ) ; break ; } } } program ++ ; LCD . clear ( ) ; } Button . waitForAnyPress ( ) ; } private static void sleep ( int millis ) { } }

Fix:
Aligner aligner = new Aligner ( 35 , false ) ;
Buggy code:
public class RoutinesListFragment extends Fragment { List < Routine > mRoutines ; RoutinesListFragment . OnRoutineSelectedListener mRoutineSelectedCallback ; ArrayAdapter adapter ; ListView listview ; @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onAttach ( Activity activity ) { } private class RoutinesListAdapter extends ArrayAdapter < Routine > { public RoutinesListAdapter ( Context context , int layoutResourceId , List < Routine > items ) { } @ Override public View getView ( int position , View convertView , ViewGroup parent ) { } } private View createRoutineListItem ( LayoutInflater inflater , final Routine routine ) { } void showDeleteConfirmationDialog ( final Routine r ) { AlertDialog . Builder builder = new AlertDialog . Builder ( getActivity ( ) ) ; String message ; if ( ( r . scheduleItems ( ) . size ( ) ) > 0 ) { message = String . format ( getString ( remove_routine_message_long ) , r . name ( ) ) ; } else { message = String . format ( getString ( remove_routine_message_short ) , r . name ( ) ) ; } builder . setMessage ( message ) . setCancelable ( true ) . setTitle ( getString ( remove_routine_dialog_title ) ) . setPositiveButton ( getString ( dialog_yes_option ) , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int id ) { AlarmScheduler . instance ( ) . onDeleteRoutine ( r , getActivity ( ) ) ; r . deleteCascade ( ) ; notifyDataChange ( ) ; } <START_BUG> } ) . setNegativeButton ( getString ( dialog_yes_option ) , new DialogInterface . OnClickListener ( ) { <END_BUG> public void onClick ( DialogInterface dialog , int id ) { dialog . cancel ( ) ; } } ) ; AlertDialog alert = builder . create ( ) ; alert . show ( ) ; } public void notifyDataChange ( ) { } private class ReloadItemsTask extends AsyncTask < Void , Void , Void > { @ Override protected Void doInBackground ( Void ... params ) { } @ Override protected void onPostExecute ( Void aVoid ) { } } public interface OnRoutineSelectedListener { public void onRoutineSelected ( Routine r ) { } public void onCreateRoutine ( ) { } } No newline ; at end ; of file ; }

Fix:
} ) . setNegativeButton ( getString ( dialog_no_option ) , new DialogInterface . OnClickListener ( ) {
Buggy code:
public class ElementChangedEvent extends EventObject { public static final int POST_CHANGE = 1 ; public static final int PRE_AUTO_BUILD = 2 ; public static final int POST_RECONCILE = 4 ; private int type ; public ElementChangedEvent ( IJavaElementDelta delta , int type ) { } public IJavaElementDelta getDelta ( ) { <START_BUG> return ( ( IJavaElementDelta ) ( source ) ) ; <END_BUG> } public int getType ( ) { } }

Fix:
return ( ( IJavaElementDelta ) ( this . source ) ) ;
Buggy code:
public class LocalUserManager { private ArrayList < MyUser > myUsers ; private UserManager userManager ; private PropertiesUserManagerFactory userManagerFactory ; public LocalUserManager ( ) { } public UserManager getUserManager ( ) { } public MyUser createBaseUser ( String username , String password , String directory ) { } public MyUser getMyUser ( int id ) { } private MyUser createDefaultUser ( ) { <START_BUG> MyUser defaultMyUser = createBaseUser ( "default" , "default" , "//tmp" ) ; <END_BUG> return defaultMyUser ; } }

Fix:
MyUser defaultMyUser = createBaseUser ( "default" , "default" , "//tmp//test" ) ;
Buggy code:
public class CreatureData implements Data , RangeableData { private int data ; public CreatureData ( int mobData ) { } public CreatureData ( ) { } @ Override public int getData ( ) { } @ Override public void setData ( int d ) { } @ Override public boolean matches ( Data d ) { } @ Override public String get ( Enum < ? > creature ) { } private String get ( CreatureType type ) { switch ( type ) { case CREEPER : if ( ( data ) > 1 ) break ; return ( data ) == 1 ? "POWERED" : "UNPOWERED" ; case PIG : if ( ( data ) > 1 ) break ; return ( data ) == 1 ? "SADDLED" : "UNSADDLED" ; case WOLF : if ( ( data ) > 2 ) break ; if ( ( data ) == 2 ) return "TAME" ; return ( data ) == 1 ? "ANGRY" : "WILD" ; case SLIME : case MAGMA_CUBE : if ( ( data ) == 0 ) return "TINY" ; if ( ( data ) == 1 ) return "TINY" ; if ( ( data ) == 2 ) return "SMALL" ; if ( ( data ) == 3 ) return "BIG" ; if ( ( data ) == 4 ) return "HUGE" ; case PIG_ZOMBIE : return Integer . toString ( data ) ; case SHEEP : if ( ( data ) >= 48 ) break ; String result = "" ; if ( ( data ) > 32 ) { result += "SHEARED" ; data -= 32 ; } if ( ( data ) >= 16 ) break ; <START_BUG> if ( ( data ) > 0 ) { <END_BUG> if ( ! ( result . isEmpty ( ) ) ) result += "//" ; result += DyeColor . getByData ( ( ( byte ) ( data ) ) ) ; } return result ; case ENDERMAN : if ( ( data ) > 0 ) { int id = ( data ) & 15 ; int d = ( data ) > > 8 ; Material material = Material . getMaterial ( id ) ; @ SuppressWarnings ( "hiding" ) Data data = new SimpleData ( d ) ; String dataStr = data . get ( material ) ; result = material . toString ( ) ; if ( ! ( dataStr . isEmpty ( ) ) ) result += "//" + dataStr ; return result ; } break ; default : if ( ( data ) > 0 ) throw new IllegalArgumentException ( ( ( "Invalid<seq2seq4repair_space>data<seq2seq4repair_space>for<seq2seq4repair_space>" + type ) + "." ) ) ; } return "" ; } @ Override public void setOn ( Entity mob , Player owner ) { } @ Override public void setOn ( BlockState state ) { } @ SuppressWarnings ( "incomplete-switch" ) public static Data parse ( CreatureType creature , String state ) { } @ Override public String toString ( ) { } @ Override public int hashCode ( ) { } }

Fix:
if ( ( data ) >= 0 ) {
Buggy code:
public class MouseHandler implements MouseListener , MouseMotionListener , MouseWheelListener { private NvConnection conn ; private Robot robot ; private Dimension size ; private StreamFrame parent ; private int lastX = 0 ; private int lastY = 0 ; private boolean captureMouse = true ; private final double mouseThresh = 0.45 ; public MouseHandler ( NvConnection conn , StreamFrame parent ) { } public void free ( ) { } public void capture ( ) { } public void mouseClicked ( MouseEvent e ) { } public void mouseEntered ( MouseEvent e ) { } public void mouseExited ( MouseEvent e ) { } private static byte getButtonFromEvent ( MouseEvent e ) { } public void mousePressed ( MouseEvent e ) { } public void mouseReleased ( MouseEvent e ) { } public void mouseDragged ( MouseEvent e ) { } public void mouseMoved ( MouseEvent e ) { } private void checkBoundaries ( MouseEvent e ) { } private void moveMouse ( int x , int y ) { } public void mouseWheelMoved ( MouseWheelEvent event ) { <START_BUG> conn . sendMouseScroll ( ( ( byte ) ( event . getWheelRotation ( ) ) ) ) ; <END_BUG> event . consume ( ) ; } }

Fix:
conn . sendMouseScroll ( ( ( byte ) ( - ( event . getWheelRotation ( ) ) ) ) ) ;
Buggy code:
public class Controller implements StudentListener { public static final int SCORE_MILLISECONDS = 100 ; private static final int SEARCH_MILLISECONDS = 10 ; private static final int MATCH_SCORE = 300 ; private UltraghostRandom random = new UltraghostRandom ( ) ; private VograbularyPreferences preferences ; private UltraghostScreen screen ; private WordList wordList = new WordList ( ) ; private Runnable scoreTask ; private Runnable searchTask ; private Scheduler scheduler ; private List < Student > students = new ArrayList < Student > ( ) ; public void setRandom ( UltraghostRandom random ) { } public void setPreferences ( VograbularyPreferences preferences ) { } public VograbularyPreferences getPreferences ( ) { } public void setScreen ( UltraghostScreen screen ) { } public void addStudent ( Student student ) { } public void clearStudents ( ) { } public void setWordList ( WordList wordList ) { } public void setScheduler ( Scheduler scheduler ) { } private class ScoreTask implements Runnable { @ Override public void run ( ) { } } private class SearchTask implements Runnable { private List < Student > searchingStudents = new ArrayList < Student > ( students ) ; private Scheduler scheduler ; public SearchTask ( Scheduler scheduler ) { } @ Override public void run ( ) { } } @ Override public void askForSolution ( ) { } @ Override public void showThinking ( ) { } @ Override public void askForResponse ( ) { } public void start ( ) { } public void watchPuzzle ( final Puzzle puzzle ) { puzzle . addListener ( new Puzzle . Listener ( ) { @ Override public void completed ( ) { Puzzle puzzle = getMatch ( ) . getPuzzle ( ) ; scheduler . cancel ( scoreTask ) ; puzzle . getOwner ( ) . addScore ( puzzle . getScore ( ) ) ; String hint = puzzle . findNextBetter ( ) ; <START_BUG> puzzle . setHint ( ( hint == null ? null : "hint:<seq2seq4repair_space>" + hint ) ) ; <END_BUG> screen . focusNextButton ( ) ; } @ Override public void changed ( ) { screen . refreshPuzzle ( ) ; if ( ( ( puzzle . getResponse ( ) ) != null ) && ( ! ( puzzle . isCompleted ( ) ) ) ) { screen . focusResponse ( ) ; } } } ) ; } public Match getMatch ( ) { } public void solve ( ) { } public void cancelMatch ( ) { } }

Fix:
puzzle . setHint ( ( hint == null ? "Perfect!" : "hint:<seq2seq4repair_space>" + hint ) ) ;
Buggy code:
public class Native2Ascii extends MatchingTask { private boolean reverse = false ; private String encoding = null ; private File srcDir = null ; private File destDir = null ; private String extension = null ; private Mapper mapper ; public void setDest ( File destDir ) { } public void setEncoding ( String encoding ) { } public void setExt ( String ext ) { } public void setReverse ( boolean reverse ) { } public void setSrc ( File srcDir ) { } public Mapper createMapper ( ) throws TaskException { if ( ( mapper ) != null ) { throw new TaskException ( "Cannot<seq2seq4repair_space>define<seq2seq4repair_space>more<seq2seq4repair_space>than<seq2seq4repair_space>one<seq2seq4repair_space>mapper" ) ; } <START_BUG> mapper = new Mapper ( project ) ; <END_BUG> return mapper ; } public void execute ( ) throws TaskException { } private void convert ( String srcName , String destName ) throws TaskException { } private class ExtMapper implements FileNameMapper { public void setFrom ( String s ) { } public void setTo ( String s ) { } public String [ ] mapFileName ( String fileName ) { } } }

Fix:
mapper = new Mapper ( getProject ( ) ) ;
Buggy code:
@ Listener public class CacheRegistry < K , V > implements Registry < K , V > { private final List < Registry . Listener < K , V > > listeners = new CopyOnWriteArrayList < > ( ) ; private final RegistryEntryProvider < K , V > provider ; private final Cache < Node , Map . Entry < K , V > > cache ; private final CacheInvoker invoker ; private final Group group ; private final NodeFactory < Address > factory ; public CacheRegistry ( CacheRegistryFactoryConfiguration < K , V > config , RegistryEntryProvider < K , V > provider ) { } @ Override public void close ( ) { } @ Override public void addListener ( Registry . Listener < K , V > listener ) { } @ Override public void removeListener ( Registry . Listener < K , V > listener ) { } @ Override public Group getGroup ( ) { } @ Override public Map < K , V > getEntries ( ) { } @ Override public Map . Entry < K , V > getEntry ( Node node ) { } @ Override public Map . Entry < K , V > getLocalEntry ( ) { } @ TopologyChanged public void topologyChanged ( TopologyChangedEvent < Address , Node > event ) { if ( event . isPre ( ) ) return ; List < Address > newAddresses = event . getConsistentHashAtEnd ( ) . getMembers ( ) ; if ( ! ( newAddresses . get ( 0 ) . equals ( event . getCache ( ) . getCacheManager ( ) . getAddress ( ) ) ) ) return ; Set < Address > addresses = new java . util . HashSet ( event . getConsistentHashAtStart ( ) . getMembers ( ) ) ; addresses . removeAll ( newAddresses ) ; final List < Node > nodes = new java . util . ArrayList ( addresses . size ( ) ) ; for ( Address address : addresses ) { nodes . add ( this . factory . createNode ( address ) ) ; } CacheRegistry < K , V > . Operation < Map < K , V > > operation = new Operation < Map < K , V > > ( ) { @ Override public Map < K , V > invoke ( Cache < Node , Map . Entry < K , V > > cache ) { Map < K , V > removed = new HashMap < > ( ) ; for ( Node node : nodes ) { Map . Entry < K , V > old = cache . remove ( node ) ; if ( old != null ) { removed . put ( old . getKey ( ) , old . getValue ( ) ) ; } } return removed ; } } ; <START_BUG> Map < K , V > removed = this . invoker . invoke ( this . cache , operation ) ; <END_BUG> if ( ! ( removed . isEmpty ( ) ) ) { for ( Listener < K , V > listener : this . listeners ) { listener . removedEntries ( removed ) ; } } } @ CacheEntryModified public void modified ( CacheEntryModifiedEvent < Node , Map . Entry < K , V > > event ) { } @ CacheEntryRemoved public void removed ( CacheEntryRemovedEvent < Node , Map . Entry < K , V > > event ) { } abstract class Operation < R > implements CacheInvoker . Operation < Node , Map . Entry < K , V > , R > { } }

Fix:
Map < K , V > removed = this . invoker . invoke ( this . cache , operation , FORCE_SYNCHRONOUS ) ;
Buggy code:
public class ModClusterAddMetric implements OperationStepHandler { static final ModClusterAddMetric INSTANCE = new ModClusterAddMetric ( ) ; @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { PathAddress opAddress = PathAddress . pathAddress ( operation . get ( OP_ADDR ) ) ; PathAddress parent = opAddress . append ( DYNAMIC_LOAD_PROVIDER_PATH ) ; String name = TYPE . resolveModelAttribute ( context , operation ) . asString ( ) ; ModelNode targetOperation = Util . createAddOperation ( parent . append ( PathElement . pathElement ( LOAD_METRIC_PATH . getKey ( ) , name ) ) ) ; for ( AttributeDefinition def : LoadMetricDefinition . ATTRIBUTES ) { def . validateAndSet ( operation , targetOperation ) ; } <START_BUG> context . addStep ( targetOperation , LoadMetricAdd . INSTANCE , IMMEDIATE ) ; <END_BUG> context . completeStep ( NOOP_ROLLBACK_HANDLER ) ; } }

Fix:
context . addStep ( targetOperation , LoadMetricAdd . INSTANCE , MODEL , true ) ;