auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void setMode(String mode) { <END> String capitalizedMode = mode.toUpperCase(); if (MODE_PREPEND.equals(capitalizedMode) || MODE_APPEND.equals(capitalizedMode) || MODE_OVERWRITE.equals(capitalizedMode)) { this.mode = capitalizedMode; } else { throw new IllegalArgumentException( "Binding mode should be either '" + MODE_PREPEND + "', '" + MODE_APPEND + "' or '" + MODE_OVERWRITE + "'. Instead found '" + mode + "'."); } }</code><technical_language>config side, give option. simple for config side : append</technical_language>

Target:
public void setMode(String mode) { if (MODE_PREPEND.equals(mode) || MODE_APPEND.equals(mode) || MODE_OVERWRITE.equals(mode)) { this.mode = mode; } else { throw new IllegalArgumentException( "Binding mode should be either '" + MODE_PREPEND + "', '" + MODE_APPEND + "' or '" + MODE_OVERWRITE + "'. Instead found '" + mode + "'."); } }
Source:
<code>public void delete(ClaudiaData claudiaData, NetworkInstance networkInstance, String region) throws InvalidEntityException, InfrastructureException { log.info("Destroying network " + networkInstance.getNetworkName() + " region " + region); try { networkInstance = load(networkInstance.getNetworkName(), claudiaData.getVdc(), region); } catch (EntityNotFoundException e) { <START> log.error("Error to remove the network in BD " + e.getMessage()); <END> throw new InvalidEntityException(networkInstance); } if (!canBeDeleted(claudiaData, networkInstance, region)) { log.info("The network cannot be deleted since it is using by another" + "blueprint"); return; } log.info("Deleting from DB"); deleteInDb(networkInstance, claudiaData.getVdc(), region); log.info("Deleting the public interface"); try { networkClient.deleteNetworkToPublicRouter(claudiaData, networkInstance, region); } catch (Exception e) { log.warn ("It is not possible to delete the public interface. " + "It is not exist: " + e.getMessage()); } log.info("Deleting the subnets"); Set<SubNetworkInstance> subNetAux = networkInstance.cloneSubNets(); for (SubNetworkInstance subNet : subNetAux) { subNetworkInstanceManager.delete(claudiaData, subNet, region); } log.info("Deleting the network"); networkClient.destroyNetwork(claudiaData, networkInstance, region); }</code><technical_language>error message due try load network instance obtain error, I suppose</technical_language>

Target:
public void delete(ClaudiaData claudiaData, NetworkInstance networkInstance, String region) throws InvalidEntityException, InfrastructureException { log.info("Destroying network " + networkInstance.getNetworkName() + " region " + region); try { networkInstance = load(networkInstance.getNetworkName(), claudiaData.getVdc(), region); } catch (EntityNotFoundException e) { log.error("Error to remove the network in BD, since it is not exist in BD " + e.getMessage()); throw new InvalidEntityException(networkInstance); } if (!canBeDeleted(claudiaData, networkInstance, region)) { log.info("The network cannot be deleted since it is using by another" + "blueprint"); return; } log.info("Deleting from DB"); deleteInDb(networkInstance, claudiaData.getVdc(), region); log.info("Deleting the public interface"); try { networkClient.deleteNetworkToPublicRouter(claudiaData, networkInstance, region); } catch (Exception e) { log.warn ("It is not possible to delete the public interface. " + "It is not exist: " + e.getMessage()); } log.info("Deleting the subnets"); Set<SubNetworkInstance> subNetAux = networkInstance.cloneSubNets(); for (SubNetworkInstance subNet : subNetAux) { subNetworkInstanceManager.delete(claudiaData, subNet, region); } log.info("Deleting the network"); networkClient.destroyNetwork(claudiaData, networkInstance, region); }
Source:
<code>public void checkCommentCodeFeature() { editor.selectTabByName("deployment.yaml"); editor.goToPosition(18, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor("# generation: 4"); editor.goToPosition(20, 1); editor.launchCommentCodeFeature(); editor.goToPosition(22, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor( <START> "# generation: 4\n" <END> + " labels:\n" + "# app: che\n" + " template: che\n" + "# name: che"); editor.goToPosition(18, 1); editor.launchCommentCodeFeature(); editor.goToPosition(20, 1); editor.launchCommentCodeFeature(); editor.goToPosition(22, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor( " generation: 4\n" + " labels:\n" + " app: che\n" + " template: che\n" + " name: che"); }</code><technical_language>constant</technical_language>

Target:
public void checkCommentCodeFeature() { editor.selectTabByName("deployment.yaml"); editor.goToPosition(18, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor("# generation: 4"); editor.goToPosition(20, 1); editor.launchCommentCodeFeature(); editor.goToPosition(22, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor(COMMENTED_CODE); editor.goToPosition(18, 1); editor.launchCommentCodeFeature(); editor.goToPosition(20, 1); editor.launchCommentCodeFeature(); editor.goToPosition(22, 1); editor.launchCommentCodeFeature(); editor.waitTextIntoEditor(UNCOMMENTED_CODE); }
Source:
<code>public void commitAsync(final Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback) { acquireAndEnsureOpen(); try { maybeThrowInvalidGroupIdException(); maybeThrowIfCommitOffsetsNotOwned(offsets); log.debug("Committing offsets: {}", offsets); offsets.forEach(this::updateLastSeenEpochIfNewer); coordinator.commitOffsetsAsync(new HashMap<>(offsets), callback); } catch (CommitFailedException e) { <START> log.error("Failed to commit offsets asynchronously because they do not belong to dynamically assigned partitions"); <END> callback.onComplete(offsets, e); } finally { release(); } }</code><technical_language>wondering, this check if offsets belonged auto-assigned partitions? straight throw CommitFailedException? Is this a behavioral change</technical_language>

Target:
public void commitAsync(final Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback) { acquireAndEnsureOpen(); try { maybeThrowInvalidGroupIdException(); log.debug("Committing offsets: {}", offsets); offsets.forEach(this::updateLastSeenEpochIfNewer); coordinator.commitOffsetsAsync(new HashMap<>(offsets), callback); } finally { release(); } }
Source:
<code>protected void tick(Block b) { BlockMenu inv = BlockStorage.getInventory(b); if (isProcessing(b)) { int timeleft = progress.get(b); if (timeleft > 0) { MachineHelper.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar()); if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; ChargableBlock.addCharge(b, -getEnergyConsumption()); progress.put(b, timeleft - 1); } else { inv.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " ")); inv.pushItem(SlimefunItems.BUCKET_OF_OIL, getOutputSlots()); progress.remove(b); processing.remove(b); } } else { for (int slot : getInputSlots()) { if (SlimefunManager.isItemSimilar(inv.getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) { OreGenResource oil = OreGenSystem.getResource("Oil"); <START> Chunk chunk = b.getChunk(); <END> int supplies = OreGenSystem.getSupplies(oil, chunk, false); if(supplies > 0){ MachineRecipe r = new MachineRecipe(26, new ItemStack[0], new ItemStack[] {SlimefunItems.BUCKET_OF_OIL}); if (!inv.fits(SlimefunItems.BUCKET_OF_OIL, getOutputSlots())) { return; } inv.replaceExistingItem(slot, InvUtils.decreaseItem(inv.getItemInSlot(slot), 1)); processing.put(b, r); progress.put(b, r.getTicks()); OreGenSystem.setSupplies(oil, chunk, supplies - 1); break; }else{ ItemStack item = BlockStorage.getInventory(b).getItemInSlot(slot); ItemStack[] abucket = new ItemStack[1]; abucket[0]=item.clone(); BlockStorage.getInventory(b).replaceExistingItem(slot, null); pushItems(b, abucket); } } } } }</code><technical_language>this multiple times a good idea</technical_language>

Target:
protected void tick(Block b) { BlockMenu inv = BlockStorage.getInventory(b); if (isProcessing(b)) { int timeleft = progress.get(b); if (timeleft > 0) { MachineHelper.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar()); if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; ChargableBlock.addCharge(b, -getEnergyConsumption()); progress.put(b, timeleft - 1); } else { inv.replaceExistingItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " ")); inv.pushItem(SlimefunItems.BUCKET_OF_OIL, getOutputSlots()); progress.remove(b); processing.remove(b); } } else if (inv.fits(SlimefunItems.BUCKET_OF_OIL, getOutputSlots())) { for (int slot : getInputSlots()) { if (SlimefunManager.isItemSimilar(inv.getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) { OreGenResource oil = OreGenSystem.getResource("Oil"); Chunk chunk = b.getChunk(); int supplies = OreGenSystem.getSupplies(oil, chunk, false); if (supplies > 0) { MachineRecipe r = new MachineRecipe(26, new ItemStack[0], new ItemStack[] {SlimefunItems.BUCKET_OF_OIL}); inv.replaceExistingItem(slot, InvUtils.decreaseItem(inv.getItemInSlot(slot), 1)); processing.put(b, r); progress.put(b, r.getTicks()); OreGenSystem.setSupplies(oil, chunk, supplies - 1); } else { ItemStack item = BlockStorage.getInventory(b).getItemInSlot(slot).clone(); BlockStorage.getInventory(b).replaceExistingItem(slot, null); pushItems(b, item); } break; } } } }
Source:
<code>public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); <START> if( Defaults.APPLICATION_ID.equals( "" ) || Defaults.API_KEY.equals( "" ) || Defaults.VERSION.equals( "" ) || Defaults.CHANNEL_NAME.equals( "" ) ) <END> { showAlert( this, "Missing application ID and api key arguments. Login to Backendless Console, select your app and get the ID and key from the Manage > App Settings screen. Copy/paste the values into the Backendless.initApp call" ); return; } final EditText nameField = (EditText) findViewById( R.id.nameField ); findViewById( R.id.startButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { String name = nameField.getText().toString(); if( name == null || name.equals( "" ) ) { Toast.makeText( MainActivity.this, "Please enter your name", Toast.LENGTH_SHORT ).show(); return; } Intent intent = new Intent( getBaseContext(), ChatActivity.class ); intent.putExtra( Defaults.NAME_TAG, name ); startActivity( intent ); } } ); }</code><technical_language>get rid of VERSION</technical_language>

Target:
public void onCreate( Bundle savedInstanceState ) { super.onCreate( savedInstanceState ); setContentView( R.layout.main ); if( Defaults.APPLICATION_ID.equals( "" ) || Defaults.API_KEY.equals( "" ) || Defaults.CHANNEL_NAME.equals( "" ) ) { showAlert( this, "Missing application ID and api key arguments. Login to Backendless Console, select your app and get the ID and key from the Manage > App Settings screen. Copy/paste the values into the Backendless.initApp call" ); return; } final EditText nameField = (EditText) findViewById( R.id.nameField ); findViewById( R.id.startButton ).setOnClickListener( new View.OnClickListener() { @Override public void onClick( View view ) { String name = nameField.getText().toString(); if( name == null || name.equals( "" ) ) { Toast.makeText( MainActivity.this, "Please enter your name", Toast.LENGTH_SHORT ).show(); return; } Intent intent = new Intent( getBaseContext(), ChatActivity.class ); intent.putExtra( Defaults.NAME_TAG, name ); startActivity( intent ); } } ); }
Source:
<code><START> public List<Map> getCollectionsWithBitstreamSizesTotal(Context context) throws SQLException { <END> return collectionDAO.getCollectionsWithBitstreamSizesTotal(context); }</code><technical_language>great if this map generics contains</technical_language>

Target:
public List<Map.Entry<Collection, Long>> getCollectionsWithBitstreamSizesTotal(Context context) throws SQLException { return collectionDAO.getCollectionsWithBitstreamSizesTotal(context); }
Source:
<code>public RefreshPlan computePlan(CreatedOutput container) { RefreshPlan post = new RefreshPlan(signatureProvider); Collection<? extends Mapping> childMappings = container.getChildMappings(); pre.computeStatus(container, childMappings); post.addPreviousStatus(pre.getExistingOutputs()); Iterable<? extends Mapping> mappingsCreatingElements = Iterables.filter(childMappings, new Predicate<Mapping>() { @Override public boolean apply(Mapping input) { return input.getCreator().some(); } }); Iterable<Collection<MappingHiearchy>> transformedHiearchy = Iterables.transform(mappingsCreatingElements, toHierarchy); Iterable<MappingHiearchy> childHiearchies = Sets.newLinkedHashSet(Iterables.concat(transformedHiearchy)); for (MappingHiearchy nodeHiearch : childHiearchies) { Iterator<Mapping> it = nodeHiearch.fromMostSpecificToMostGeneral(); while (it.hasNext()) { Mapping cur = it.next(); if (cur.isEnabled() && cur.getCreator().some()) { Option<EvaluatedSemanticPartition> par = <START> invalidator.hasFastResult(container.getDescriptor().getSourceElement(), cur.getSemanticPartition()); <END> if (!par.some()) { par = Options.newSome(cur.getSemanticPartition().evaluate(container.getDescriptor().getSourceElement(), container)); } Collection<? extends OutputDescriptor> allCandidateDescriptors = cur.getCreator().get().computeDescriptors(container, par.get().elements()); post.appendOutputDescritorsKeepingTheMostSpecific(allCandidateDescriptors); } } } return post; }</code><technical_language>container added parameter of hasFastResult</technical_language>

Target:
public RefreshPlan computePlan(CreatedOutput container) { RefreshPlan post = new RefreshPlan(signatureProvider); Collection<? extends Mapping> childMappings = container.getChildMappings(); pre.computeStatus(container, childMappings); post.addPreviousStatus(pre.getExistingOutputs()); Iterable<? extends Mapping> mappingsCreatingElements = Iterables.filter(childMappings, new Predicate<Mapping>() { @Override public boolean apply(Mapping input) { return input.getCreator().some(); } }); Iterable<Collection<MappingHiearchy>> transformedHiearchy = Iterables.transform(mappingsCreatingElements, toHierarchy); Iterable<MappingHiearchy> childHiearchies = Sets.newLinkedHashSet(Iterables.concat(transformedHiearchy)); for (MappingHiearchy nodeHiearch : childHiearchies) { Iterator<Mapping> it = nodeHiearch.fromMostSpecificToMostGeneral(); while (it.hasNext()) { Mapping cur = it.next(); if (cur.isEnabled() && cur.getCreator().some()) { Option<EvaluatedSemanticPartition> par = invalidator.hasFastResult(container.getDescriptor().getSourceElement(), cur.getSemanticPartition(), container); if (!par.some()) { par = Options.newSome(cur.getSemanticPartition().evaluate(container.getDescriptor().getSourceElement(), container)); } Collection<? extends OutputDescriptor> allCandidateDescriptors = cur.getCreator().get().computeDescriptors(container, par.get().elements()); post.appendOutputDescritorsKeepingTheMostSpecific(allCandidateDescriptors); } } } return post; }
Source:
<code>public void testGetSuggestions() { final JSONArray expectedSuggestions = mock(JSONArray.class); final List<JSONValue> suggestions = new ArrayList<>(); final List<String> variableSuggestions = buildVariableSuggestions(); when(this.variableSuggestions.getSuggestions()).thenReturn(variableSuggestions); buildKeywordSuggestions().forEach(suggestion -> { <START> final JSONValue function = mock(JSONValue.class); suggestions.add(function); <END> doReturn(function).when(factory).getKeywordSuggestion(suggestion); }); buildFunctionSuggestions().forEach(suggestion -> { final JSONValue function = mock(JSONValue.class); suggestions.add(function); doReturn(function).when(factory).getFunctionSuggestion(suggestion.get(0), suggestion.get(1)); }); variableSuggestions.forEach(suggestion -> { final JSONValue function = mock(JSONValue.class); suggestions.add(function); doReturn(function).when(factory).getVariableSuggestion(suggestion); }); doReturn(expectedSuggestions).when(factory).makeJSONArray(); final JSONArray actualSuggestions = factory.getSuggestions(this.variableSuggestions); suggestions.forEach(suggestion -> { verify(factory).push(expectedSuggestions, suggestion); }); assertEquals(expectedSuggestions, actualSuggestions); }</code><technical_language>keyword function</technical_language>

Target:
public void testGetSuggestions() { final JSONArray expectedSuggestions = mock(JSONArray.class); final List<JSONValue> suggestions = new ArrayList<>(); final List<String> variableSuggestions = buildVariableSuggestions(); when(this.variableSuggestions.getSuggestions()).thenReturn(variableSuggestions); buildKeywordSuggestions().forEach(suggestion -> { final JSONValue keyword = mock(JSONValue.class); suggestions.add(keyword); doReturn(keyword).when(factory).getKeywordSuggestion(suggestion); }); buildFunctionSuggestions().forEach(suggestion -> { final JSONValue function = mock(JSONValue.class); suggestions.add(function); doReturn(function).when(factory).getFunctionSuggestion(suggestion.get(0), suggestion.get(1)); }); variableSuggestions.forEach(suggestion -> { final JSONValue variable = mock(JSONValue.class); suggestions.add(variable); doReturn(variable).when(factory).getVariableSuggestion(suggestion); }); doReturn(expectedSuggestions).when(factory).makeJSONArray(); final JSONArray actualSuggestions = factory.getSuggestions(this.variableSuggestions); suggestions.forEach(suggestion -> { verify(factory).push(expectedSuggestions, suggestion); }); assertEquals(expectedSuggestions, actualSuggestions); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; <START> if (!super.equals(o)) return false; <END> MarkerQuorumPacket that = (MarkerQuorumPacket) o; return time == that.time; }</code><technical_language>need compare super I mentioned above</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MarkerQuorumPacket that = (MarkerQuorumPacket) o; return time == that.time; }
Source:
<code>private String getSpecialFoldersList() { <START> String builder = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" + <END> "<propfind xmlns=\"DAV:\">" + "<prop>" + "<" + WebDavConstants.DAV_MAIL_INBOX_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_DRAFTS_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_OUTBOX_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_SENT_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_TRASH_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_SPAM_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "</prop>" + "</propfind>"; return builder; }</code><technical_language>variable name specialFoldersListRequest</technical_language>

Target:
private String getSpecialFoldersList() { return "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>" + "<propfind xmlns=\"DAV:\">" + "<prop>" + "<" + WebDavConstants.DAV_MAIL_INBOX_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_DRAFTS_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_OUTBOX_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_SENT_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_TRASH_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "<" + WebDavConstants.DAV_MAIL_SPAM_FOLDER + " xmlns=\"urn:schemas:httpmail:\"/>" + "</prop>" + "</propfind>"; }
Source:
<code>public void testAgentStatus() { <START> Assert.assertNotNull( this.agent.agentStatus() ); <END> }</code><technical_language>Replace java Assert.assertTrue( agent.agentStatus.startsWith( "There is message" ));</technical_language>

Target:
public void testAgentStatus() throws Exception { Assert.assertNotNull( this.agent.agentStatus() ); this.agent.stop(); this.agent.getMessagingClient().getMessageProcessor().getMessageQueue().add(Mockito.mock(MsgNotifHeartbeat.class)); this.agent.getMessagingClient().getMessageProcessor().getMessageQueue().add(Mockito.mock(MsgNotifAutonomic.class)); this.agent.getMessagingClient().getMessageProcessor().getMessageQueue().add(Mockito.mock(MsgNotifLogs.class)); Assert.assertFalse( this.agent.agentStatus().startsWith( "There is no message" )); }
Source:
<code>public static int getPrimaryColor(Context context) { if (primaryColor == -1) { String primaryColorStr = PreferenceManager.getDefaultSharedPreferences(context).getString("primary-color", COLOR_DEFAULT_STR); if (primaryColorStr.equals("#00000000") || primaryColorStr.equals(("#AAFFFFFF"))) { <START> return 0xFFBDBDBD; <END> } primaryColor = Color.parseColor(primaryColorStr); } return primaryColor; }</code><technical_language>return anymore</technical_language>

Target:
public static int getPrimaryColor(Context context) { if (primaryColor == -1) { String primaryColorStr = PreferenceManager.getDefaultSharedPreferences(context).getString("primary-color", COLOR_DEFAULT_STR); if (primaryColorStr.equals("#00000000") || primaryColorStr.equals(("#AAFFFFFF"))) { primaryColor = 0xFFBDBDBD; } else { primaryColor = Color.parseColor(primaryColorStr); } } return primaryColor; }
Source:
<code>public Date getFirstPlayed() { @Nullable NBTTagCompound data = getData().isPresent() ? getData().get() : null; long time = 0L; <START> if (data != null && data.hasKey("firstPlayed")) { <END> time = data.getLong("firstPlayed"); } Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time); return cal.getTime(); }</code><technical_language>do: Optional<NBTTagCompound> data = getData(); if(data.isPresent() && data.get().hasKey("firstPlayed")) {...}</technical_language>

Target:
public Date getFirstPlayed() { Optional<NBTTagCompound> data = getData(); long time = (data.isPresent() && data.get().hasKey("firstPlayed")) ? data.get().getLong("firstPlayed") : 0L; Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time); return cal.getTime(); }
Source:
<code>public String getVariableValue(String id) { TypedQuery<Variables> query = em.createNamedQuery("Variables.findById", Variables.class) .setParameter("id", id); try { Variables var = query.getSingleResult(); if (var != null) { return var.getValue(); } <START> } catch (NoResultException e) { } <END> return null; }</code><technical_language>@SirOibaf add a logger</technical_language>

Target:
public String getVariableValue(String id) { TypedQuery<Variables> query = em.createNamedQuery("Variables.findById", Variables.class) .setParameter("id", id); try { Variables var = query.getSingleResult(); if (var != null) { return var.getValue(); } } catch (NoResultException e) { logger.log(Level.INFO, "Variable " + id + " not found in the database"); } return null; }
Source:
<code>synchronized public void receiveMessage(Id groupId, Message message) { if (mCurrentNotifiableActivity == null || mCurrentGroup.getId().getId().equals(groupId.getId())) { List<Group> groups = YieldsApplication.getUser().getUserGroups(); for (Group group : groups) { <START> if (group.getId().getId().equals(groupId.getId())) { <END> group.addMessage(message); sendMessageNotification(group, message); } } } else { mCurrentGroup.addMessage(message); mCurrentNotifiableActivity.notifyChange(); } }</code><technical_language>do need search for Group ? mCurrentGroup correct Group</technical_language>

Target:
synchronized public void receiveMessage(Id groupId, Message message) { if (mCurrentNotifiableActivity == null || !mCurrentGroup.getId().getId().equals(groupId.getId())) { List<Group> groups = YieldsApplication.getUser().getUserGroups(); for (Group group : groups) { if (group.getId().getId().equals(groupId.getId())) { group.addMessage(message); sendMessageNotification(group, message); } } } else { mCurrentGroup.addMessage(message); mCurrentNotifiableActivity.notifyChange(); } }
Source:
<code>private boolean hasMagicLinkSignupIntent() { if (mUri != null) { String parameter = SignupEpilogueActivity.MAGIC_SIGNUP_PARAMETER; String value = (mUri.getQueryParameterNames() != null && mUri.getQueryParameter(parameter) != null) ? mUri.getQueryParameter(parameter) : ""; <START> return Intent.ACTION_VIEW.equals(mAction) && mUri.getQueryParameterNames().contains(parameter) <END> && value.equalsIgnoreCase(SignupEpilogueActivity.MAGIC_SIGNUP_VALUE); } else { return false; } }</code><technical_language>I need mUri.getQueryParameterNames().contains(parameter) check for afterwards. This create NPE</technical_language>

Target:
private boolean hasMagicLinkSignupIntent() { if (mUri != null) { String parameter = SignupEpilogueActivity.MAGIC_SIGNUP_PARAMETER; String value = (mUri.getQueryParameterNames() != null && mUri.getQueryParameter(parameter) != null) ? mUri.getQueryParameter(parameter) : ""; return Intent.ACTION_VIEW.equals(mAction) && value.equalsIgnoreCase(SignupEpilogueActivity.MAGIC_SIGNUP_VALUE); } else { return false; } }
Source:
<code>public void onCompleted() { exchange.getIn().setBody(requestList); exchange.getIn().setHeaders(headers); consumer.process(exchange, doneSync -> { <START> }); <END> Object responseBody = exchange.getIn().getBody(); if (responseBody instanceof List) { List<Object> responseList = (List<Object>)responseBody; responseList.forEach((responseItem) -> { responseObserver.onNext(responseItem); }); } else { responseObserver.onNext(responseBody); } responseObserver.onCompleted(); }</code><technical_language>below. Response computed callback</technical_language>

Target:
public void onCompleted() { CountDownLatch latch = new CountDownLatch(1); Object responseBody = null; exchange.getIn().setBody(requestList); exchange.getIn().setHeaders(headers); consumer.process(exchange, doneSync -> { latch.countDown(); }); try { latch.await(); if (exchange.hasOut()) { responseBody = exchange.getOut().getBody(); } else { responseBody = exchange.getIn().getBody(); } if (responseBody instanceof List) { List<?> responseList = (List<?>)responseBody; responseList.forEach((responseItem) -> { responseObserver.onNext(responseItem); }); } else { responseObserver.onNext(responseBody); } responseObserver.onCompleted(); } catch (InterruptedException e) { responseObserver.onError(e); } }
Source:
<code>private boolean fetchFromScheduledTaskQueue() { if (scheduledTaskQueue == null || scheduledTaskQueue.isEmpty()) { return true; } long nanoTime = AbstractScheduledEventExecutor.nanoTime(); <START> for (Runnable scheduledTask; (scheduledTask = pollScheduledTask(nanoTime)) != null;) { <END> if (!taskQueue.offer(scheduledTask)) { scheduledTaskQueue.add((ScheduledFutureTask<?>) scheduledTask); return false; } } return true; }</code><technical_language>imho easier read as: java for (;;) { Runnable scheduledTask = pollScheduledTask(nanoTime); if (scheduledTask == null) { break; } .... }</technical_language>

Target:
private boolean fetchFromScheduledTaskQueue() { if (scheduledTaskQueue == null || scheduledTaskQueue.isEmpty()) { return true; } long nanoTime = AbstractScheduledEventExecutor.nanoTime(); for (;;) { Runnable scheduledTask = pollScheduledTask(nanoTime); if (scheduledTask == null) { return true; } if (!taskQueue.offer(scheduledTask)) { scheduledTaskQueue.add((ScheduledFutureTask<?>) scheduledTask); return false; } } }
Source:
<code>public static void register(AggregationImplModule module) { module.register( Signature.builder() .name(NAME) .kind(FunctionInfo.Type.AGGREGATE) .argumentTypes(parseTypeSignature("E")) .typeVariableConstraints(typeVariable("E")) .returnType(parseTypeSignature("array(E)")) <START> .build(), <END> args -> new ArrayAgg(args.get(0)) ); }</code><technical_language>worth creating builder shortcuts Signature.scalar() for aggregates? I this improves readability. note signature.withTypeVariableContraints() builder</technical_language>

Target:
public static void register(AggregationImplModule module) { module.register( Signature.aggregate( NAME, parseTypeSignature("E"), parseTypeSignature("array(E)") ).withTypeVariableConstraints(typeVariable("E")), args -> new ArrayAgg(args.get(0)) ); }
Source:
<code>public void testCreateTableUnsupportedPartitionType() { assertUpdate("" + <START> "CREATE TABLE test_create_table_unsupported_partition_type " + <END> "WITH (partitioned_by = ARRAY['a']) " + "AS " + "SELECT 123 x, ARRAY foo a"); }</code><technical_language>Add another version of this check for normal CREATE TABLE: CREATE TABLE ... ( x bigint, a ARRAY[varchar]) (...)</technical_language>

Target:
public void testCreateTableUnsupportedPartitionType() { assertUpdate("" + "CREATE TABLE test_create_table_unsupported_partition_type " + "(foo bigint, bar ARRAY(varchar)) " + "WITH (partitioned_by = ARRAY['bar'])"); }
Source:
<code>private void shareImage() { if (galleryItem == null) { return; } parentActivity.getFunnel().logGalleryShare(pageTitle, galleryItem.getName()); new ImagePipelineBitmapGetter(galleryItem.getThumbUrl()){ @Override <START> public void onSuccess(Bitmap bitmap) { <END> ShareUtil.shareImage(parentActivity, bitmap, new java.io.File(galleryItem.getUrl()).getName(), pageTitle.getDisplayText(), imageTitle.getCanonicalUri()); } @Override public void onError(Throwable t) { FeedbackUtil.showError(getActivity(), t); } }.get(); }</code><technical_language>some of this live in super? If extra parameters constructor, I worthwhile shareImage method tiny</technical_language>

Target:
private void shareImage() { if (galleryItem == null) { return; } parentActivity.getFunnel().logGalleryShare(pageTitle, galleryItem.getName()); new ImagePipelineBitmapGetter(getActivity(), galleryItem.getThumbUrl()){ @Override public void onSuccess(Bitmap bitmap) { if (!isAdded()) { return; } ShareUtil.shareImage(parentActivity, bitmap, new java.io.File(galleryItem.getUrl()).getName(), pageTitle.getDisplayText(), imageTitle.getCanonicalUri()); } }.get(); }
Source:
<code>public void getGroupObjectUnauthorizedTest() throws Exception { GroupService groupService = EPersonServiceFactory.getInstance().getGroupService(); Group adminGroup = null; try { context.turnOffAuthorisationSystem(); adminGroup = groupService.create(context); context.commit(); <START> adminGroup = context.reloadEntity(adminGroup); <END> getClient().perform( get("/api/eperson/groups/" + adminGroup.getID() + "/object") ).andExpect(status().isUnauthorized()); } finally { if (adminGroup != null) { GroupBuilder.deleteGroup(adminGroup.getID()); } } }</code><technical_language>above. GroupBuilder, missing a context.restoreAuthSystemState(); question commit() reloadEntity() above</technical_language>

Target:
public void getGroupObjectUnauthorizedTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context) .withName("Parent Community") .withAdminGroup(admin) .build(); Group adminGroup = community.getAdministrators(); context.restoreAuthSystemState(); getClient().perform( get("/api/eperson/groups/" + adminGroup.getID() + "/object") ).andExpect(status().isUnauthorized()); }
Source:
<code>private HookResult runSyncHook(Project.NameKey project, File hook, List<String> args) throws TimeoutException { <START> HookResult result = null; <END> if (hook.exists()) { SyncHookTask syncHook = new SyncHookTask(project, hook, args); FutureTask<HookResult> task = new FutureTask<HookResult>(syncHook); syncHookThreadPool.execute(task); try { result = task.get(syncHookTimeout, TimeUnit.SECONDS); } catch (TimeoutException e) { task.cancel(true); log.error("Synchronous hook timed out " + hook.getAbsolutePath()); result = new HookResult(syncHook.getOutput(), "Synchronous hook timed out"); } catch (Exception e) { task.cancel(true); log.error("Error running hook " + hook.getAbsolutePath(), e); result = new HookResult(syncHook.getOutput(), "Error running hook: " + e); } } return result; }</code><technical_language>simpler eliminate this variable simply return is currently set</technical_language>

Target:
private HookResult runSyncHook(Project.NameKey project, File hook, List<String> args) throws TimeoutException { if (!hook.exists()) { return null; } HookResult result = null; SyncHookTask syncHook = new SyncHookTask(project, hook, args); FutureTask<HookResult> task = new FutureTask<HookResult>(syncHook); syncHookThreadPool.execute(task); try { result = task.get(syncHookTimeout, TimeUnit.SECONDS); } catch (TimeoutException e) { task.cancel(true); syncHook.cancel(); log.error("Synchronous hook timed out " + hook.getAbsolutePath()); result = new HookResult(syncHook.getOutput(), "Synchronous hook timed out"); } catch (Exception e) { task.cancel(true); syncHook.cancel(); log.error("Error running hook " + hook.getAbsolutePath(), e); result = new HookResult(syncHook.getOutput(), "Error running hook: " + e); } return result; }
Source:
<code>private Stream<String> getAgentMembers(final IdentifierConverter<Resource, FedoraResource> translator, final FedoraResource resource) { return resource.getTriples(translator, PROPERTIES).filter(memberTestFromTypes.apply(resource.getTypes())) .map(Triple::getObject) <START> .map(object -> object.isURI() ? object.getURI() : object.getLiteralValue().toString()); <END> }</code><technical_language>break this function triple objects out a private method, a method ref, (~363ish) a method</technical_language>

Target:
private static Stream<String> getAgentMembers(final IdentifierConverter<Resource, FedoraResource> translator, final FedoraResource resource) { return resource.getTriples(translator, PROPERTIES).filter(memberTestFromTypes.apply(resource.getTypes())) .map(Triple::getObject).flatMap(WebACRolesProvider::nodeToStringStream); }
Source:
<code>private void handleSubmitError(SubmitJob job) { if (form != null && !form.isDisposed()) { final IStatus status = job.getStatus(); String message = null; if (status.getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Comment_required, status); AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT); if (newCommentPart != null) { newCommentPart.setFocus(); } <START> } else if (status.getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) { <END> if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) { submitEnabled = true; doSubmit(); return; } else { message = getMessageFromStatus(status); } } else { if (status.getCode() == RepositoryStatus.ERROR_IO) { message = ERROR_NOCONNECTIVITY; } else { message = getMessageFromStatus(status); if (message == null) { message = Messages.AbstractTaskEditorPage_Submit_failed; } } } if (message != null) { getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status); } }); } } }</code><technical_language>I add a return remove null check line 1241</technical_language>

Target:
private void handleSubmitError(SubmitJob job) { if (form != null && !form.isDisposed()) { final IStatus status = job.getStatus(); String message = null; if (status.getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Comment_required, status); AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT); if (newCommentPart != null) { newCommentPart.setFocus(); } return; } else if (status.getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) { if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) { submitEnabled = true; doSubmit(); return; } else { message = getMessageFromStatus(status); } } else if (status.getCode() == RepositoryStatus.ERROR_IO) { message = ERROR_NOCONNECTIVITY; } else { message = getMessageFromStatus(status); if (message == null) { message = Messages.AbstractTaskEditorPage_Submit_failed; } } getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status); } }); } }
Source:
<code><START> protected List<StorageDomainStatic> filterAttachedStorageDomains() { <END> List<StorageDomain> connectedStorageDomainsToVds = new ArrayList<>(); for (StorageDomain storageDomain : getParameters().getStorageDomainList()) { if (!connectStorageDomain(storageDomain)) { logErrorMessage(storageDomain); } else { connectedStorageDomainsToVds.add(storageDomain); } } storageDomainsWithAttachedStoragePoolId = getAttachedStorageDomains(connectedStorageDomainsToVds); for (StorageDomain storageDomain : connectedStorageDomainsToVds) { if (!disConnectStorageDomain(storageDomain)) { log.warn("Could not disconnect Storage Domain from VDS '{}'. ", storageDomain.getName(), getVdsId()); } } return storageDomainsWithAttachedStoragePoolId; }</code><technical_language>/s/filter/checkFor</technical_language>

Target:
protected List<StorageDomainStatic> filterAttachedStorageDomains() { List<StorageDomain> connectedStorageDomainsToVds = new ArrayList<>(); for (StorageDomain storageDomain : getParameters().getStorageDomainList()) { if (!connectStorageDomain(storageDomain)) { logErrorMessage(storageDomain); } else { connectedStorageDomainsToVds.add(storageDomain); } } List<StorageDomainStatic> storageDomainsWithAttachedStoragePoolId = getAttachedStorageDomains(connectedStorageDomainsToVds); for (StorageDomain storageDomain : connectedStorageDomainsToVds) { if (!disconnectStorageDomain(storageDomain)) { log.warn("Could not disconnect Storage Domain from VDS '{}'. ", storageDomain.getName(), getVdsId()); } } return storageDomainsWithAttachedStoragePoolId; }
Source:
<code>protected void doSetUserClaimValue(String userName, String claimURI, String claimValue, String profileName) throws UserStoreException { try { String attributeName = getClaimAtrribute(claimURI, userName, null); Map<String, String> userStoreAttributeValueMap = new HashMap<>(); userStoreAttributeValueMap.put(attributeName, claimValue); processAttributesBeforeUpdate(userStoreAttributeValueMap); for (Map.Entry<String, String> entry : userStoreAttributeValueMap.entrySet()) { doSetUserAttribute(userName, entry.getKey(), entry.getValue(), profileName); } } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException( "Error occurred while getting the claim attribute for claimURI: " + claimURI + " of the user: " <START> + userName); <END> } }</code><technical_language>include 'e' in wrapped exception</technical_language>

Target:
protected void doSetUserClaimValue(String userName, String claimURI, String claimValue, String profileName) throws UserStoreException { try { String attributeName = getClaimAtrribute(claimURI, userName, null); Map<String, String> userStoreAttributeValueMap = new HashMap<>(); userStoreAttributeValueMap.put(attributeName, claimValue); processAttributesBeforeUpdate(userName, userStoreAttributeValueMap, profileName); for (Map.Entry<String, String> entry : userStoreAttributeValueMap.entrySet()) { doSetUserAttribute(userName, entry.getKey(), entry.getValue(), profileName); } } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserStoreException( "Error occurred while getting the claim attribute for claimURI: " + claimURI + " of the user: " + userName, e); } }
Source:
<code>protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { while (true) { try { return method.invoke(delegate(), args); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof NotCurrentLeaderException) { <START> Thread.sleep(10); <END> continue; } throw targetException; } } }</code><technical_language>a bit fragile rely Thread.sleep do interrupted checking for considering a while(true) loop. If check top of while loop thread is interrupted, reset flag react accordingly. this is a proxy, weird throw a checked exception InterruptedException people catch (it's a compile error), especially if is behaviour attached. test references UndeclaredThrowableException. Tempted throw NotCurrentLeaderException get this case. unchecked, "expect" get exception some point is leader for instance</technical_language>

Target:
protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { while (true) { if (Thread.currentThread().isInterrupted()) { throw new SafeIllegalStateException("interrupted"); } try { return method.invoke(delegate(), args); } catch (InvocationTargetException e) { Throwable targetException = e.getTargetException(); if (targetException instanceof NotCurrentLeaderException) { Uninterruptibles.sleepUninterruptibly(10, TimeUnit.MILLISECONDS); continue; } throw targetException; } } }
Source:
<code>public boolean performNextOperation(int completedChildCount) { switch(getParameters().getImportPhase()) { case CREATE_DISKS: getParameters().setImportPhase(Phase.CONVERT); if (getParameters().getProxyHostId() == null) { getParameters().setProxyHostId(selectProxyHost()); } break; case CONVERT: <START> if (EnumSet.of(OriginType.OVIRT).contains(getVm().getOrigin())) { <END> return false; } getParameters().setImportPhase(Phase.POST_CONVERT); break; case POST_CONVERT: return false; default: } persistCommandIfNeeded(); executeNextOperation(); return true; }</code><technical_language>replacing with: if (getVm().getOrigin() == OriginType.OVIRT) ? real need for EnumSet anymore check</technical_language>

Target:
public boolean performNextOperation(int completedChildCount) { switch(getParameters().getImportPhase()) { case CREATE_DISKS: getParameters().setImportPhase(Phase.CONVERT); if (getParameters().getProxyHostId() == null) { getParameters().setProxyHostId(selectProxyHost()); } break; case CONVERT: if (getVm().getOrigin() == OriginType.OVIRT) { return false; } getParameters().setImportPhase(Phase.POST_CONVERT); break; case POST_CONVERT: return false; default: } persistCommandIfNeeded(); executeNextOperation(); return true; }
Source:
<code>public VoidResult call() throws NoSuchRefException, NoSuchProjectException, IOException, ConfigInvalidException, OrmConcurrencyException, InvalidNameException { final ProjectControl projectControl = projectControlFactory.controlFor(projectName); final MetaDataUpdate md; try { md = metaDataUpdateFactory.create(projectName); } catch (RepositoryNotFoundException notFound) { throw new NoSuchProjectException(projectName); } try { final ProjectConfig config = ProjectConfig.read(md, base); Set<String> toDelete = scanSectionNames(config); for (MergeStrategySection section : distinctMergeSections(sectionList)) { final String name = section.getName(); if (!projectControl.controlForRef(name).isOwner()) { <START> throw new NoSuchRefException(section.getName()); <END> } RefControl.validateRefPattern(name); config.replace(section); toDelete.remove(section.getName()); } for (String name : toDelete) { if (projectControl.controlForRef(name).isOwner()) { config.remove(config.getMergeStrategySection(name)); } } if (message != null && !message.isEmpty()) { if (!message.endsWith("\n")) { message += "\n"; } md.setMessage(message); } else { md.setMessage("Modify merge strategy\n"); } if (config.commit(md)) { projectCache.evict(config.getProject()); return VoidResult.INSTANCE; } else { throw new OrmConcurrencyException("Cannot update " + projectName); } } finally { md.close(); } }</code><technical_language>a extreme? owner able a ref? (It appears attempting obfuscate existence I is reserved for user allowed see.)</technical_language>

Target:
public VoidResult call() throws NoSuchRefException, NoSuchProjectException, IOException, ConfigInvalidException, OrmConcurrencyException, InvalidNameException { final ProjectControl projectControl = projectControlFactory.controlFor(projectName); final MetaDataUpdate md; try { md = metaDataUpdateFactory.create(projectName); } catch (RepositoryNotFoundException notFound) { throw new NoSuchProjectException(projectName); } try { final ProjectConfig config = ProjectConfig.read(md, base); Set<String> toDelete = scanSectionNames(config); final Set<MergeStrategySection> mergeSections = new HashSet<MergeStrategySection>(sectionList); for (MergeStrategySection section : mergeSections) { final String name = section.getName(); if (!projectControl.isVisible() || !projectControl.controlForRef(name).isOwner()) { continue; } RefControl.validateRefPattern(name); config.replace(section); toDelete.remove(section.getName()); } for (String name : toDelete) { if (projectControl.controlForRef(name).isOwner()) { config.remove(config.getMergeStrategySection(name)); } } if (message != null && !message.isEmpty()) { if (!message.endsWith("\n")) { message += "\n"; } md.setMessage(message); } else { md.setMessage("Modify merge strategy\n"); } if (config.commit(md)) { projectCache.evict(config.getProject()); return VoidResult.INSTANCE; } else { throw new OrmConcurrencyException("Cannot update " + projectName); } } finally { md.close(); } }
Source:
<code>public void testSavedBuildSelector() throws Exception { FreeStyleProject other = createArtifactProject(), p = rule.createFreeStyleProject(); ParameterDefinition paramDef = new StringParameterDefinition("FOO","foo"); ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef); other.addProperty(paramsDef); <START> CopyArtifactPermissionProperty cpp=new CopyArtifactPermissionProperty("/"+p.getName()); <END> other.addProperty(cpp); p.getBuildersList().add(CopyArtifactUtil.createCopyArtifact(other.getName(), null, new SavedBuildSelector(), "*.txt", "", false, false, true)); FreeStyleBuild b = other.scheduleBuild2(0, new UserCause(), new ParametersAction(new StringParameterValue("FOO", "buildone"))).get(); rule.assertBuildStatusSuccess(b); rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause())); b.keepLog(true); b = p.scheduleBuild2(0, new UserCause()).get(); rule.assertBuildStatusSuccess(b); assertFile(true, "foo.txt", b); assertFile(true, "buildone.txt", b); assertFile(false, "subdir/subfoo.txt", b); }</code><technical_language>I need / CopyArtifactPernissionProperty accepts relative names. getFullName() if want express absolute names</technical_language>

Target:
public void testSavedBuildSelector() throws Exception { FreeStyleProject other = createArtifactProject(), p = rule.createFreeStyleProject(); ParameterDefinition paramDef = new StringParameterDefinition("FOO", "foo"); ParametersDefinitionProperty paramsDef = new ParametersDefinitionProperty(paramDef); other.addProperty(paramsDef); p.getBuildersList().add(CopyArtifactUtil.createCopyArtifact(other.getName(), null, new SavedBuildSelector(), "*.txt", "", false, false, true)); FreeStyleBuild b = other.scheduleBuild2(0, new UserCause(), new ParametersAction(new StringParameterValue("FOO", "buildone"))).get(); rule.assertBuildStatusSuccess(b); rule.assertBuildStatusSuccess(other.scheduleBuild2(0, new UserCause())); b.keepLog(true); b = p.scheduleBuild2(0, new UserCause()).get(); rule.assertBuildStatusSuccess(b); assertFile(true, "foo.txt", b); assertFile(true, "buildone.txt", b); assertFile(false, "subdir/subfoo.txt", b); }
Source:
<code>public void nextTuple() { try { if (initialized) { if (refreshSubscriptionTimer.isExpiredResetOnTrue()) { kafkaSpoutConfig.getSubscription().refreshAssignment(); } <START> if (isCommitAllowed()) { <END> commitOffsetsForAckedTuples(); } PollablePartitionInfo pollablePartitionInfo = getPollablePartitionInfo(); if (!pollablePartitionInfo.isPollAllowed()) { try { setWaitingToEmit(pollKafkaBroker(pollablePartitionInfo)); } catch (RetriableException e) { LOG.error("Failed to poll from kafka.", e); } } emitIfWaitingNotEmitted(); } else { LOG.debug("Spout not initialized. Not sending tuples until initialization completes"); } } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }</code><technical_language>I guess allowed of isAtLeastOnceProcessing() && ... ? Other ideas isReadyToCommit / isCommitReady / isCommittable ? for atLeastOnceProcessing() commits allowed if ready, right</technical_language>

Target:
public void nextTuple() { try { if (initialized) { if (refreshSubscriptionTimer.isExpiredResetOnTrue()) { kafkaSpoutConfig.getSubscription().refreshAssignment(); } if (shouldCommit()) { commitOffsetsForAckedTuples(); } PollablePartitionsInfo pollablePartitionsInfo = getPollablePartitionsInfo(); if (pollablePartitionsInfo.shouldPoll()) { try { setWaitingToEmit(pollKafkaBroker(pollablePartitionsInfo)); } catch (RetriableException e) { LOG.error("Failed to poll from kafka.", e); } } emitIfWaitingNotEmitted(); } else { LOG.debug("Spout not initialized. Not sending tuples until initialization completes"); } } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }