auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected KieServicesClient getClient(final String url) { KieServicesClientProvider clientProvider = clientProviders.stream().filter(provider -> provider.supports(url)).findFirst().orElseThrow(() -> new KieServerControllerNotFoundException("Kie Services Client Provider not found for url: " + url)); logger.debug("Using client provider {}", clientProvider); KieServicesClient client = clientProvider.get(url); <START> logger.debug("Using client {}", clientProvider); <END> if(client == null){ throw new KieServerControllerNotFoundException("Kie Services Client not found for url: " + url); } return client; }</code><technical_language>client instead of clientProvider</technical_language>

Target:
protected KieServicesClient getClient(final String url) { KieServicesClientProvider clientProvider = clientProviders.stream().filter(provider -> provider.supports(url)).findFirst().orElseThrow(() -> new KieServerControllerIllegalArgumentException("Kie Services Client Provider not found for url: " + url)); logger.debug("Using client provider {}", clientProvider); KieServicesClient client = clientProvider.get(url); logger.debug("Using client {}", client); if(client == null){ throw new KieServerControllerIllegalArgumentException("Kie Services Client not found for url: " + url); } return client; }
Source:
<code>protected static String getStackTraceString(Throwable t) { StringWriter sw = new StringWriter(); <START> PrintWriter pw = new PrintWriter(sw); <END> t.printStackTrace(pw); pw.close(); return sw.toString(); }</code><technical_language>a try-catch block handle closable resources</technical_language>

Target:
protected static String getStackTraceString(Throwable t) throws IOException { try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { t.printStackTrace(pw); return sw.toString(); } }
Source:
<code>public int getColumnId(String name) { <START> if (fieldsByQualifiedName.containsKey(name)) { <END> return fieldsByQualifiedName.get(name); } String parts = name.split("\\."); if (parts.length == 2 || parts.length == 3) { if (fieldsByQualifiedName.containsKey(name)) { return fieldsByQualifiedName.get(name); } else { return -1; } } else { List<Integer> list = fieldsByName.get(name); if (list == null) { return -1; } else if (list.size() == 1) { return fieldsByName.get(name).get(0); } else if (list.size() == 0) { return -1; } else { throw throwAmbiguousFieldException(list); } } }</code><technical_language>condition is checked Line 210. Furthermore, line checks name is qualified not</technical_language>

Target:
public int getColumnId(String name) { if (fieldsByQualifiedName.containsKey(name)) { return fieldsByQualifiedName.get(name); } List<Integer> list = fieldsByName.get(name); if (list == null) { return -1; } else if (list.size() == 1) { return fieldsByName.get(name).get(0); } else if (list.size() == 0) { return -1; } else { throw throwAmbiguousFieldException(list); } }
Source:
<code>public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); } catch (IOException e) { logger.log(Level.SEVERE, "Unable to get the latest copy of the PR from github", e); return; } updatePR(pr, pr.getUser()); <START> checkSkipBuild(pr); <END> tryBuild(); }</code><technical_language>I this (and tryBuild) needs a synch too, shouldRun updated</technical_language>

Target:
public void check(GHPullRequest ghpr) { setPullRequest(ghpr); if (helper.isProjectDisabled()) { logger.log(Level.FINE, "Project is disabled, ignoring pull request"); return; } try { getPullRequest(false); } catch (IOException e) { logger.log(Level.SEVERE, "Unable to get the latest copy of the PR from github", e); return; } updatePR(pr, pr.getUser()); tryBuild(); }
Source:
<code>public static ArrayList<Guid> getGuidListFromStringArray(List<String> strings) { ArrayList<Guid> guidList = new ArrayList<Guid>(); <START> if (CollectionUtils.isEmpty(strings)) { <END> for (String guidString : strings) { guidList.add(Guid.createGuidFromString(guidString)); } } return guidList; }</code><technical_language>pls replace strings != null && strings.isEmpty()</technical_language>

Target:
public static ArrayList<Guid> getGuidListFromStringArray(List<String> strings) { ArrayList<Guid> guidList = new ArrayList<Guid>(); if (strings != null && !strings.isEmpty()) { for (String guidString : strings) { guidList.add(Guid.createGuidFromString(guidString)); } } return guidList; }
Source:
<code>public PatchSet getBasePatchSet(RevisionEdit edit, RevCommit commit) throws IOException { <START> checkState(commit.getParentCount() == 1); <END> RevCommit parentCommit = commit.getParent(0); RevId parentRev = new RevId(ObjectId.toString(parentCommit.getId())); try { return Iterables.getOnlyElement(db.get().patchSets() .byRevision(parentRev).toList()); } catch (OrmException e) { throw new IOException(e); } }</code><technical_language>Useful error message this fails</technical_language>

Target:
public PatchSet getBasePatchSet(RevisionEdit edit, RevCommit commit) throws IOException { RevCommit parentCommit = commit.getParent(0); RevId parentRev = new RevId(ObjectId.toString(parentCommit.getId())); try { return Iterables.getOnlyElement(db.get().patchSets() .byRevision(parentRev).toList()); } catch (OrmException e) { throw new IOException(e); } }
Source:
<code>private void resetValuesIfNeeded(IElement element, IElementParameter mainParam, Map<String, Object> currentLine) { List<Map<String, Object>> tableValues = (List<Map<String, Object>>) mainParam.getValue(); int rowNumber = tableValues.indexOf(currentLine); if (rowNumber != -1) { for (Object item : mainParam.getListItemsValue()) { if (item instanceof IElementParameter) { IElementParameter curParam = (IElementParameter) item; switch (curParam.getFieldType()) { case CLOSED_LIST: String[] itemsToDisplay = getItemsToDisplay(element, curParam, rowNumber); Object currentValue = currentLine.get(curParam.getName()); String currentDisplay = null; if (currentValue instanceof Integer) { if (((Integer) currentValue) < curParam.getListItemsDisplayName().length) { <START> if ((Integer)currentValue >= 0) { <END> currentDisplay = curParam.getListItemsDisplayName()[(Integer) currentValue]; } } } else if (currentValue instanceof String) { int index = ArrayUtils.indexOf(curParam.getListItemsValue(), currentValue); if (index != -1) { currentDisplay = curParam.getListItemsDisplayName()[index]; } } if (currentDisplay != null) { if (!ArrayUtils.contains(itemsToDisplay, currentDisplay)) { String newValue = ""; if (itemsToDisplay.length > 0) { int index = ArrayUtils.indexOf(curParam.getListItemsDisplayName(), itemsToDisplay[0]); newValue = (String) curParam.getListItemsValue()[index]; } currentLine.put(curParam.getName(), newValue); } }else if(itemsToDisplay.length >0){ currentLine.put(curParam.getName(), 0); } break; default: } } } } }</code><technical_language>add another if add simply a && if above</technical_language>

Target:
private void resetValuesIfNeeded(IElement element, IElementParameter mainParam, Map<String, Object> currentLine) { List<Map<String, Object>> tableValues = (List<Map<String, Object>>) mainParam.getValue(); int rowNumber = tableValues.indexOf(currentLine); if (rowNumber != -1) { for (Object item : mainParam.getListItemsValue()) { if (item instanceof IElementParameter) { IElementParameter curParam = (IElementParameter) item; switch (curParam.getFieldType()) { case CLOSED_LIST: String[] itemsToDisplay = getItemsToDisplay(element, curParam, rowNumber); Object currentValue = currentLine.get(curParam.getName()); String currentDisplay = null; if (currentValue instanceof Integer) { if (((Integer) currentValue) < curParam.getListItemsDisplayName().length && (Integer)currentValue >= 0) { currentDisplay = curParam.getListItemsDisplayName()[(Integer) currentValue]; } } else if (currentValue instanceof String) { int index = ArrayUtils.indexOf(curParam.getListItemsValue(), currentValue); if (index != -1) { currentDisplay = curParam.getListItemsDisplayName()[index]; } } if (currentDisplay != null) { if (!ArrayUtils.contains(itemsToDisplay, currentDisplay)) { String newValue = ""; if (itemsToDisplay.length > 0) { int index = ArrayUtils.indexOf(curParam.getListItemsDisplayName(), itemsToDisplay[0]); newValue = (String) curParam.getListItemsValue()[index]; } currentLine.put(curParam.getName(), newValue); } }else if(itemsToDisplay.length >0){ currentLine.put(curParam.getName(), 0); } break; default: } } } } }
Source:
<code>protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.BORDERED_STYLE__BORDER_COLOR, ViewpointFactory.eINSTANCE.createFromString(ViewpointPackage.Literals.RGB_VALUES, <START> "209,209,209"))); <END> }</code><technical_language>209, 209, 209 instead of 0, 0, 0 previoulsy</technical_language>

Target:
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.BORDERED_STYLE__BORDER_COLOR, ViewpointFactory.eINSTANCE.createFromString(ViewpointPackage.Literals.RGB_VALUES, "0,0,0"))); }
Source:
<code>public List<NameValuePair> extract(EpdqTemplateData templateData) { List<NameValuePair> nameValuePairs = super.extract(templateData); EpdqParameterBuilder parameterBuilder = newParameterBuilder(nameValuePairs) .add(BROWSER_COLOR_DEPTH, getBrowserColorDepth(templateData)) .add(BROWSER_LANGUAGE, getBrowserLanguage(templateData)) .add(BROWSER_SCREEN_HEIGHT, getBrowserScreenHeight(templateData)) .add(BROWSER_SCREEN_WIDTH, getBrowserScreenWidth(templateData)) .add(BROWSER_TIMEZONE_OFFSET_MINS, getBrowserTimezoneOffsetMins(templateData)) .add(BROWSER_ACCEPT_HEADER, getBrowserAcceptHeader(templateData)) .add(BROWSER_USER_AGENT, getBrowserUserAgent(templateData)) .add(BROWSER_JAVA_ENABLED, "false"); <START> templateData.getAuthCardDetails().getAddress().map(address -> address.getCity()).ifPresent(city -> parameterBuilder.add(ADDRESS_CITY, city)); <END> return parameterBuilder.build(); }</code><technical_language>able a method reference in map( ): java templateData.getAuthCardDetails().getAddress().map(Address::getCity).ifPresent(city -> parameterBuilder.add(ADDRESS_CITY, city));</technical_language>

Target:
public List<NameValuePair> extract(EpdqTemplateData templateData) { List<NameValuePair> nameValuePairs = super.extract(templateData); EpdqParameterBuilder parameterBuilder = newParameterBuilder(nameValuePairs) .add(BROWSER_COLOR_DEPTH, getBrowserColorDepth(templateData)) .add(BROWSER_LANGUAGE, getBrowserLanguage(templateData)) .add(BROWSER_SCREEN_HEIGHT, getBrowserScreenHeight(templateData)) .add(BROWSER_SCREEN_WIDTH, getBrowserScreenWidth(templateData)) .add(BROWSER_TIMEZONE_OFFSET_MINS, getBrowserTimezoneOffsetMins(templateData)) .add(BROWSER_ACCEPT_HEADER, getBrowserAcceptHeader(templateData)) .add(BROWSER_USER_AGENT, getBrowserUserAgent(templateData)) .add(BROWSER_JAVA_ENABLED, "false"); templateData.getAuthCardDetails().getAddress().map(Address::getCity).ifPresent(city -> parameterBuilder.add(ECOM_BILLTO_POSTAL_CITY, city)); return parameterBuilder.build(); }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == Constants.ACTIVITY_REQUEST_EDIT_SECTION && resultCode == EditHandler.RESULT_REFRESH_PAGE) { pageDataClient.backFromEditing(data); FeedbackUtil.showMessage(getActivity(), R.string.edit_saved_successfully); loadPage(model.getTitleOriginal(), model.getCurEntry(), PageLoadStrategy.Cache.FALLBACK, false); } else if (requestCode == Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { if (articleHeaderView != null) { String newSubtitle = data.getStringExtra(Constants.INTENT_EXTRA_UPDATED_DESCRIPTION); <START> articleHeaderView.setSubtitle(StringUtils.capitalize(newSubtitle)); <END> } } }</code><technical_language>This working intented. I try this effect of this quickly overridden PageCache. Instead of modify view I preferable change model. In this case I means changing in page cache</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == Constants.ACTIVITY_REQUEST_EDIT_SECTION && resultCode == EditHandler.RESULT_REFRESH_PAGE) { pageDataClient.backFromEditing(data); FeedbackUtil.showMessage(getActivity(), R.string.edit_saved_successfully); loadPage(model.getTitleOriginal(), model.getCurEntry(), PageLoadStrategy.Cache.FALLBACK, false); } else if (requestCode == Constants.ACTIVITY_REQUEST_DESCRIPTION_EDIT && resultCode == RESULT_OK) { refreshPage(); } }
Source:
<code>public int compare(Session session, PlanNodeCostEstimate left, PlanNodeCostEstimate right) { if (getQueryMaxMemory(session).toBytes() < Math.max(left.getMemoryCost().getValue(), right.getMemoryCost().getValue())) { return Double.compare(left.getMemoryCost().getValue(), right.getMemoryCost().getValue()); } <START> Estimate leftCost = left.getCpuCost().map(value -> value * cpuWeight) <END> .add(left.getMemoryCost().map(value -> value * memoryWeight)) .add(left.getNetworkCost().map(value -> value * networkWeight)); Estimate rightCost = right.getCpuCost().map(value -> value * cpuWeight) .add(right.getMemoryCost().map(value -> value * memoryWeight)) .add(right.getNetworkCost().map(value -> value * networkWeight)); if (leftCost.isValueUnknown() || rightCost.isValueUnknown()) { return 0; } return Double.compare(leftCost.getValue(), rightCost.getValue()); }</code><technical_language>Minor: convenient if session properties overriding global wights. case: tweaking CBO switches, able do server restart offers for faster feedback loop. Obvious downside: sessions properties not/should of times. super-sure of this</technical_language>

Target:
public int compare(Session session, PlanNodeCostEstimate left, PlanNodeCostEstimate right) { checkArgument(!left.isUnknown() && !right.isUnknown(), "cannot compare unknown costs"); double leftCost = left.getCpuCost() * cpuWeight + left.getMemoryCost() * memoryWeight + left.getNetworkCost() * networkWeight; double rightCost = right.getCpuCost() * cpuWeight + right.getMemoryCost() * memoryWeight + right.getNetworkCost() * networkWeight; return Double.compare(leftCost, rightCost); }
Source:
<code>public ResponseType transformLoginResponse(ResponseType response, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, ClientSessionContext clientSessionCtx) { AudienceRestrictionType aud = SAMLAudienceProtocolMapper.locateAudienceRestriction(response); if (aud != null) { Set<RoleModel> roles = clientSessionCtx.getRoles(); Set<String> audiences = new HashSet<>(); for (RoleModel role : roles) { logger.tracef("Managing role: %s", role.getName()); if (role.isClientRole()) { ClientModel app = (ClientModel) role.getContainer(); if (SamlProtocol.LOGIN_PROTOCOL.equals(app.getProtocol()) && !app.getClientId().equals(clientSessionCtx.getClientSession().getClient().getClientId())) { audiences.add(app.getClientId()); } } } logger.debugf("Calculated audiences to add: %s", audiences); for (String audience : audiences) { <START> aud.addAudience(URI.create(audience)); <END> } } return response; }</code><technical_language>clientId need URI in keycloak (though SAML spec be). IllegalArgumentException needs handled</technical_language>

Target:
public ResponseType transformLoginResponse(ResponseType response, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, ClientSessionContext clientSessionCtx) { AudienceRestrictionType aud = SAMLAudienceProtocolMapper.locateAudienceRestriction(response); if (aud != null) { Set<RoleModel> roles = clientSessionCtx.getRoles(); Set<String> audiences = new HashSet<>(); for (RoleModel role : roles) { logger.tracef("Managing role: %s", role.getName()); if (role.isClientRole()) { ClientModel app = (ClientModel) role.getContainer(); if (SamlProtocol.LOGIN_PROTOCOL.equals(app.getProtocol()) && !app.getClientId().equals(clientSessionCtx.getClientSession().getClient().getClientId())) { audiences.add(app.getClientId()); } } } logger.debugf("Calculated audiences to add: %s", audiences); for (String audience : audiences) { try { aud.addAudience(URI.create(audience)); } catch (IllegalArgumentException e) { logger.warnf(e, "Invalid URI syntax for audience: %s", audience); } } } return response; }
Source:
<code>public boolean isCellEditable(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) { boolean value = super.isCellEditable(columnElement, rowElement, tableManager); if (value) { final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); if (objects.size() == <START> 2) { <END> final EObject object = (EObject) objects.get(0); if (matcher.matches(object)) { value = false; } } } return value; }</code><technical_language>I suppose this before, reuse constant if assumption is correct</technical_language>

Target:
public boolean isCellEditable(final Object columnElement, final Object rowElement, final INattableModelManager tableManager) { boolean value = super.isCellEditable(columnElement, rowElement, tableManager); if (value) { final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); if (2 == objects.size()) { final Object object = objects.get(0); if (object instanceof EObject) { value = !matcher.matches((EObject) object); } } } return value; }
Source:
<code>private void fireNavalBombardment(final IDelegateBridge bridge) { final Collection<Unit> bombard = getBombardingUnits(); final Collection<Unit> attacked = CollectionUtils.getMatches( defendingUnits, Matches.unitIsNotInfrastructureAndNotCapturedOnEntering( attacker, battleSite, gameData)); if (!headless) { final Change change = ChangeFactory.markNoMovementChange(bombard); bridge.addChange(change); } final boolean canReturnFire = Properties.getNavalBombardCasualtiesReturnFire(gameData); if (!bombard.isEmpty() && !attacked.isEmpty()) { if (!headless) { bridge .getSoundChannelBroadcaster() .playSoundForAll(SoundPath.CLIP_BATTLE_BOMBARD, attacker); } final List<Unit> allEnemyUnitsAliveOrWaitingToDie = new ArrayList<>(defendingUnits); allEnemyUnitsAliveOrWaitingToDie.addAll(defendingWaitingToDie); final List<FiringGroup> firingGroups = Bombard.builder() .firingUnits(bombard) .attackableUnits(attacked) .defending(false) .build() <START> .getFiringGroups(); <END> fire( SELECT_NAVAL_BOMBARDMENT_CASUALTIES, firingGroups, allEnemyUnitsAliveOrWaitingToDie, bombard, false, canReturnFire ? ReturnFire.ALL : ReturnFire.NONE, "Bombard"); } }</code><technical_language>Is a place build() immediately getFiringGroups()? If not, build() return them? buildFiringGroups()</technical_language>

Target:
private void fireNavalBombardment(final IDelegateBridge bridge) { final Collection<Unit> bombard = getBombardingUnits(); final Collection<Unit> attacked = CollectionUtils.getMatches( defendingUnits, Matches.unitIsNotInfrastructureAndNotCapturedOnEntering( attacker, battleSite, gameData)); if (!headless) { final Change change = ChangeFactory.markNoMovementChange(bombard); bridge.addChange(change); } final boolean canReturnFire = Properties.getNavalBombardCasualtiesReturnFire(gameData); if (!bombard.isEmpty() && !attacked.isEmpty()) { if (!headless) { bridge .getSoundChannelBroadcaster() .playSoundForAll(SoundPath.CLIP_BATTLE_BOMBARD, attacker); } final List<Unit> allEnemyUnitsAliveOrWaitingToDie = new ArrayList<>(defendingUnits); allEnemyUnitsAliveOrWaitingToDie.addAll(defendingWaitingToDie); final List<FiringGroup> firingGroups = BombardFiringGroup.builder() .firingUnits(bombard) .attackableUnits(attacked) .defending(false) .build() .getFiringGroups(); fire( SELECT_NAVAL_BOMBARDMENT_CASUALTIES, firingGroups, allEnemyUnitsAliveOrWaitingToDie, bombard, false, canReturnFire ? ReturnFire.ALL : ReturnFire.NONE, "Bombard"); } }
Source:
<code><START> public DirectoryStream<Path> newDirectoryStream(final Path dir, final DirectoryStream.Filter<Path> filter) { <END> checkNotNull("filter", filter); final Path[] content = getDirectoryContent(dir); return new SimpleFileSystemDirectoryStream(filter, content); }</code><technical_language>ignore sonarCloud :)</technical_language>

Target:
public DirectoryStream<Path> newDirectoryStream(final Path dir, final DirectoryStream.Filter<Path> filter) throws NotDirectoryException, IOException, SecurityException { checkNotNull("filter", filter); final Path[] content = getDirectoryContent(dir); return new DirectoryStream<Path>() { boolean isClosed = false; @Override public void close() throws IOException { if (isClosed) { throw new IOException(STREAM_CLOSED); } isClosed = true; } @Override public Iterator<Path> iterator() { if (isClosed) { throw new IOException(STREAM_CLOSED); } return new Iterator<Path>() { public boolean atEof = false; private int i = -1; private Path nextEntry = null; @Override public boolean hasNext() { if (isClosed) { throw new IOException(STREAM_CLOSED); } if (nextEntry == null && !atEof) { nextEntry = readNextEntry(); } return nextEntry != null; } @Override public Path next() { final Path result; if (isClosed) { throw new IOException(STREAM_CLOSED); } if (nextEntry == null && !atEof) { result = readNextEntry(); } else { result = nextEntry; nextEntry = null; } if (result == null) { throw new NoSuchElementException(); } return result; } private Path readNextEntry() { if (atEof) { return null; } Path result = null; while (true) { i++; if (i >= content.length) { atEof = true; break; } final Path path = content[i]; if (filter.accept(path)) { result = path; break; } } return result; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }
Source:
<code>protected <S extends Score<S>, H extends AbstractScoreHolder<S>> void impactScore(DroolsConstraint<?> constraint, Drools drools, H scoreHolder, int impact) { if (impact == 0) { return; <START> } <END> RuleContext kcontext = (RuleContext) drools; constraint.assertCorrectImpact(impact); scoreHolder.impactScore(kcontext, impact); }</code><technical_language>here: if a matchWeigth is zero, disable indictment. For clarity: If constraintWeight is zero, (and entire constraint execution too, in rest of this PR)</technical_language>

Target:
protected <S extends Score<S>, H extends AbstractScoreHolder<S>> void impactScore(DroolsConstraint<?> constraint, Drools drools, H scoreHolder, int impact) { RuleContext kcontext = (RuleContext) drools; constraint.assertCorrectImpact(impact); scoreHolder.impactScore(kcontext, impact); }
Source:
<code>public SAMSequenceRecord getSAMSequenceRecord() { final String lengthString = this.getGenericFieldValue("length"); <START> if (lengthString == null) return null; <END> final SAMSequenceRecord record = new SAMSequenceRecord(this.getID(), Integer.parseInt(lengthString)); record.setAssembly(this.getGenericFieldValue("assembly")); record.setSequenceIndex(this.contigIndex); return record; }</code><technical_language>SAMSequenceRecord UNKNOWN_SEQUENCE_LENGTH specifically for case length is missing. preferable return a SAMSequenceRecord, returning null in cases previously thrown</technical_language>

Target:
public SAMSequenceRecord getSAMSequenceRecord() { final String lengthString = this.getGenericFieldValue("length"); final int length; if (lengthString == null) { length = SAMSequenceRecord.UNKNOWN_SEQUENCE_LENGTH; } else { length = Integer.parseInt(lengthString); } final SAMSequenceRecord record = new SAMSequenceRecord(this.getID(), length); record.setAssembly(this.getGenericFieldValue("assembly")); record.setSequenceIndex(this.contigIndex); return record; }
Source:
<code>public void setMainTabSelectedItem(VmPool selectedItem) { driver.edit(getDetailModel()); monitorCount.setText(String.valueOf(getDetailModel().getMonitorCount())); isStateless.setText(Boolean.toString(getDetailModel().getIsStateless())); <START> oS.setText(String.valueOf(getDetailModel().getOS())); <END> formBuilder.update(getDetailModel()); }</code><technical_language>I guess name instead of id of OS - this show in general subtab for pool integer id</technical_language>

Target:
public void setMainTabSelectedItem(VmPool selectedItem) { driver.edit(getDetailModel()); monitorCount.setText(String.valueOf(getDetailModel().getMonitorCount())); isStateless.setText(Boolean.toString(getDetailModel().getIsStateless())); oS.setText(AsyncDataProvider.getOsName(getDetailModel().getOS())); formBuilder.update(getDetailModel()); }
Source:
<code>public void testNettyClientConnectRetry() throws Exception { NettyClient nettyClient = mock(NettyClient.class); PartitionRequestClientFactory factory = new PartitionRequestClientFactory(nettyClient, 1); ConnectionID serverAddress = createServerConnectionID(0); when(nettyClient.connect(serverAddress.getAddress())).thenThrow(new ChannelException()); <START> <END> try { factory.createPartitionRequestClient(serverAddress); } catch (ChannelException e) { } verify(nettyClient, times(2)).connect(serverAddress.getAddress()); }</code><technical_language>stopped mockito for tests (for of reasons), try provide a proper mock of NettyClient class? if NettyTestUtil implement NettyClient#connect method throws exception invocation, succeeds (returns real/correct ChannelFuture) attempt</technical_language>

Target:
public void testNettyClientConnectRetry() throws Exception { NettyTestUtil.NettyServerAndClient serverAndClient = createNettyServerAndClient(); UnstableNettyClient unstableNettyClient = new UnstableNettyClient(serverAndClient.client(), 2); PartitionRequestClientFactory factory = new PartitionRequestClientFactory(unstableNettyClient, 2); ConnectionID serverAddress = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), serverAndClient.server().getConfig().getServerPort()), 0); factory.createPartitionRequestClient(serverAddress); serverAndClient.client().shutdown(); serverAndClient.server().shutdown(); }
Source:
<code>public <T extends ArtifactId> ArtifactReadable getArtifactOrSentinel(T artifact) { if (artifact == null) { return ArtifactReadable.SENTINEL; } ArtifactReadable result = ArtifactReadable.SENTINEL; try { if (artifact instanceof ArtifactReadable) { result = (ArtifactReadable) artifact; } else if (artifact instanceof IAtsObject) { IAtsObject atsObject = (IAtsObject) artifact; if (atsObject.getStoreObject() instanceof ArtifactReadable) { result = (ArtifactReadable) atsObject.getStoreObject(); } else { <START> result = getArtifact(atsObject.getId()); <END> } } else { result = getArtifactOrSentinel(artifact.getId()); } } catch (ArtifactDoesNotExist ex) { } return result; }</code><technical_language>this call return null</technical_language>

Target:
public <T extends ArtifactId> ArtifactReadable getArtifactOrSentinel(T artifact) { if (artifact == null) { return ArtifactReadable.SENTINEL; } ArtifactReadable result = ArtifactReadable.SENTINEL; try { if (artifact instanceof ArtifactReadable) { result = (ArtifactReadable) artifact; } else if (artifact instanceof IAtsObject) { IAtsObject atsObject = (IAtsObject) artifact; if (atsObject.getStoreObject() instanceof ArtifactReadable) { result = (ArtifactReadable) atsObject.getStoreObject(); } else { result = getArtifactOrSentinel(atsObject.getId()); } } else { result = getArtifactOrSentinel(artifact.getId()); } } catch (ArtifactDoesNotExist ex) { } return result; }
Source:
<code>protected void executeCommand() { if (isGlusterEnabled() && upServer != null) { glusterHostRemove(); <START> if (!getSucceeded() && VdcBllErrors.GlusterHostIsNotPartOfCluster != getReturnValue().getFault().getError()) { <END> return; } } if (!clusterHasMultipleHosts()) { removeGlusterVolumesFromDb(); removeGlusterHooksFromDb(); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { RemoveVdsStatisticsFromDb(); RemoveVdsDynamicFromDb(); RemoveVdsStaticFromDb(); return null; } }); RemoveVdsFromCollection(); setSucceeded(true); }</code><technical_language>I error check in glusterHostRemove method</technical_language>

Target:
protected void executeCommand() { if (isGlusterEnabled() && upServer != null) { glusterHostRemove(); if (!getSucceeded()) { return; } } if (!clusterHasMultipleHosts()) { removeGlusterVolumesFromDb(); removeGlusterHooksFromDb(); } TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { RemoveVdsStatisticsFromDb(); RemoveVdsDynamicFromDb(); RemoveVdsStaticFromDb(); return null; } }); RemoveVdsFromCollection(); setSucceeded(true); }
Source:
<code>public IStatus validate(IProject project, String path) { <START> if(fileExists(path)) { <END> return Status.OK_STATUS; } return new Status(IStatus.ERROR, "GDB", "File not found : "+ path); }</code><technical_language>fp</technical_language>

Target:
public IStatus validate(IProject project, String path) { if (fileExists(path)) { return Status.OK_STATUS; } return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.GdbTrace_FileNotFound + ": " + path); }
Source:
<code>public final void execute() throws MojoExecutionException, MojoFailureException { if ( shouldExecute() ) { getLog().info( "Connecting to Nexus..." ); createTransport( getNexusUrl() ); createNexusClient(); final StagingWorkflowV2Service stagingWorkflow = getStagingWorkflowService(); try { doExecute( stagingWorkflow ); } catch ( NexusErrorMessageException e ) { <START> NexusErrorMessageException.dumpErrors( new PrintWriter( System.out, true ), e ); <END> throw new MojoExecutionException( "Could not perform action: Nexus ErrorResponse received!", e ); } catch ( StagingRuleFailuresException e ) { StagingRuleFailuresException.dumpErrors( new PrintWriter( System.out, true ), e ); throw new MojoExecutionException( "Could not perform action: there are failing staging rules!", e ); } } }</code><technical_language>pw encoding</technical_language>

Target:
public final void execute() throws MojoExecutionException, MojoFailureException { if ( shouldExecute() ) { getLog().info( "Connecting to Nexus..." ); createTransport( getNexusUrl() ); createNexusClient(); final StagingWorkflowV2Service stagingWorkflow = getStagingWorkflowService(); try { doExecute( stagingWorkflow ); } catch ( NexusErrorMessageException e ) { ErrorDumper.dumpErrors( getLog(), e ); throw new MojoExecutionException( "Could not perform action: Nexus ErrorResponse received!", e ); } catch ( StagingRuleFailuresException e ) { ErrorDumper.dumpErrors( getLog(), e ); throw new MojoExecutionException( "Could not perform action: there are failing staging rules!", e ); } } }
Source:
<code>public boolean isValid(final CurrentUser user, final ApprovalType at, final FunctionState state) { <START> for (final ProjectRight pr : state.getAllProjectRights(at)) { <END> if (user.getEffectiveGroups().contains(pr.getAccountGroupId()) && (pr.getMinValue() < 0 || pr.getMaxValue() > 0)) { return true; } } return false; }</code><technical_language>Hmm. I wonder, this consider RefRight instances this method is for Code Review Verified</technical_language>

Target:
public boolean isValid(final CurrentUser user, final ApprovalType at, final FunctionState state) { if (state.getRefRights(at).isEmpty()) { return isProjectStateValid(user, at, state); } else { return isRefStateValid(user, at, state); } }
Source:
<code>public void testManyUpdatesForSameLeaders() throws InterruptedException { ExecutorService executorService = PTExecutors.newFixedThreadPool(50); accumulator = new LeaderElectionDurationAccumulator(mockConsumer, 5_000); List<Integer> durationBuckets = IntStream.range(0, 100).map(x -> x * 100).boxed().collect(Collectors.toList()); Collections.shuffle(durationBuckets); durationBuckets.forEach(duration -> executorService.submit(() -> leaderElectionResultsWithPause(LEADER_1, LEADER_2, 50, duration))); executorService.shutdown(); executorService.awaitTermination(1, TimeUnit.MINUTES); <START> verify(mockConsumer).accept(0L); <END> verifyNoMoreInteractions(mockConsumer); }</code><technical_language>~I'm possibly confused: do guarantee zero is processed in five~ Ah, this test accumulator 5000. is fine, relies 5000 50 * 100 (maybe introduce some local variables obvious?) / if change line 129 60 test breaks, change slightly</technical_language>

Target:
public void testManyUpdatesForSameLeaders() throws InterruptedException { ExecutorService executorService = PTExecutors.newFixedThreadPool(50); int numBuckets = 100; int requestsPerBucket = 50; accumulator = new LeaderElectionDurationAccumulator(mockConsumer, numBuckets * requestsPerBucket); List<Integer> durationBuckets = IntStream.range(0, numBuckets) .map(x -> x * requestsPerBucket) .boxed() .collect(Collectors.toList()); Collections.shuffle(durationBuckets); durationBuckets.forEach(duration -> executorService.submit( () -> leaderElectionResultsWithPause(LEADER_1, LEADER_2, requestsPerBucket, duration))); executorService.shutdown(); executorService.awaitTermination(1, TimeUnit.MINUTES); verify(mockConsumer).accept(0L); verifyNoMoreInteractions(mockConsumer); }
Source:
<code>Store open() throws StoreException { lock.lock(); try { switch (state) { <START> default: END> throw new StoreStateException( context.getStrings().get("storage.store.closed")); case INITIAL: driver.open(); state = State.OPEN; break; case OPEN: } } catch (StoreException ex) { ex.setStore(this); throw ex; } finally { lock.unlock(); } return this; }</code><technical_language>nice, I thought put default top of switch. perfect sense</technical_language>

Target:
Store open() throws IllegalAddressException, StoreException { try { synchronized (lock) { switch (state) { default: throw new StoreStateException( StoreStateException.Reason.ALREADY_CLOSED); case OPEN: throw new StoreStateException( StoreStateException.Reason.ALREADY_OPEN); case INITIAL: URI driverAddress = driver.open(address); if (driverAddress != null) { address = driverAddress; } state = State.OPEN; } } } catch (StoreException ex) { ex.setStore(this); throw ex; } return this; }
Source:
<code>public boolean positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page page, int[] rightChannels) { if (groupByUsesEqualTo) { return positionEqualsRow(leftBlockIndex, leftPosition, rightPosition, page, rightChannels); } for (int i = 0; i < hashChannels.size(); i++) { int hashChannel = hashChannels.get(i); Type type = types.get(hashChannel); Block leftBlock = channels.get(hashChannel).get(leftBlockIndex); Block rightBlock = page.getBlock(rightChannels[i]); Signature signature = functionRegistry.resolveOperator(OperatorType.IS_DISTINCT_FROM, ImmutableList.of(type, type)); ScalarFunctionImplementation scalarFunctionImplementation = functionRegistry.getScalarFunctionImplementation(signature); <START> MethodHandle methodHandle = scalarFunctionImplementation.getMethodHandle(); <END> try { if (!(boolean) methodHandle.invokeExact(leftBlock, leftPosition, rightBlock, rightPosition)) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }</code><technical_language>Precompute methodHandle in constructor</technical_language>

Target:
public boolean positionNotDistinctFromRow(int leftBlockIndex, int leftPosition, int rightPosition, Page page, int[] rightChannels) { if (groupByUsesEqualTo) { return positionEqualsRow(leftBlockIndex, leftPosition, rightPosition, page, rightChannels); } for (int i = 0; i < hashChannels.size(); i++) { int hashChannel = hashChannels.get(i); Block leftBlock = channels.get(hashChannel).get(leftBlockIndex); Block rightBlock = page.getBlock(rightChannels[i]); MethodHandle methodHandle = distinctFromMethodHandles.get(hashChannel); try { if (!(boolean) methodHandle.invokeExact(leftBlock, leftPosition, rightBlock, rightPosition)) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }
Source:
<code>static public GaussianDistribution GetInferredDistribution(final GaussianDistribution prior, final double x, final double conjugate_prior_sigma, final double sigma_floor) { GaussianDistribution posterior = prior; switch (prior.model_type) { case RANDOM_MEAN: double variance = prior.sigma*prior.sigma; <START> double conjugate_prior_variance = conjugate_prior_sigma * conjugate_prior_sigma; <END> if (variance < k_minimum_variance) { variance = k_minimum_variance; } if (conjugate_prior_variance < k_minimum_conj_prior_variance) { conjugate_prior_variance = k_minimum_conj_prior_variance; } final double total_variance = conjugate_prior_variance + variance; final double w1 = variance / total_variance; final double w2 = conjugate_prior_variance / total_variance; final double conj_prior_information = 1.0 / conjugate_prior_variance; final double prior_information = 1.0 / variance; final double new_mean = w1 * x + w2 * prior.mean; final double new_variance = 1.0 / (conj_prior_information + prior_information); double new_sigma = Math.sqrt(new_variance); if (new_sigma < sigma_floor) { new_sigma = sigma_floor; } posterior = new GaussianDistribution(new_mean,new_sigma,prior.alpha,prior.beta,prior.model_type); break; case RANDOM_VARIANCE: break; case RANDOM_MEAN_AND_VARIANCE: break; } return posterior; }</code><technical_language>case</technical_language>

Target:
static public GaussianDistribution GetInferredDistribution(final GaussianDistribution prior, final double x, final double conjugate_prior_sigma, final double sigma_floor) { GaussianDistribution posterior = prior; switch (prior.modelType) { case RANDOM_MEAN: { double variance = prior.sigma * prior.sigma; double conjugate_prior_variance = conjugate_prior_sigma * conjugate_prior_sigma; if (variance < k_minimum_variance) { variance = k_minimum_variance; } if (conjugate_prior_variance < k_minimum_conj_prior_variance) { conjugate_prior_variance = k_minimum_conj_prior_variance; } final double total_variance = conjugate_prior_variance + variance; final double w1 = variance / total_variance; final double w2 = conjugate_prior_variance / total_variance; final double conj_prior_information = 1.0 / conjugate_prior_variance; final double prior_information = 1.0 / variance; final double new_mean = w1 * x + w2 * prior.mean; final double new_variance = 1.0 / (conj_prior_information + prior_information); double new_sigma = Math.sqrt(new_variance); if (new_sigma < sigma_floor) { new_sigma = sigma_floor; } posterior = new GaussianDistribution(new_mean, new_sigma); break; } case RANDOM_VARIANCE: break; case RANDOM_MEAN_AND_VARIANCE: { final double n = 1; final double mu = (prior.kappa * prior.mean + n * x) / (prior.kappa + n); final double kappa = prior.kappa + n; final double alpha = prior.alpha + n / 2.0; final double beta = prior.beta + 0.5 * prior.kappa * n * (x - prior.mean) * (x - prior.mean) / (prior.kappa + n); posterior = new GaussianDistribution(mu, 0.0, alpha, beta, kappa, GaussianDistribution.DistributionModel.RANDOM_MEAN_AND_VARIANCE); break; } } return posterior; }
Source:
<code>private static boolean pathContainsWindowsDrivePattern(String featureIdentifier) { <START> return featureIdentifier.matches("^(?:[a-zA-Z]:.*)$"); <END> }</code><technical_language>Is a reason for capture group</technical_language>

Target:
private static boolean pathContainsWindowsDrivePattern(String featureIdentifier) { return featureIdentifier.matches("^[a-zA-Z]:.*$"); }
Source:
<code>public Builder<?> read(Role template) { permissions.clear(); <START> for(CachePermission perm : template.getPermissions()) { <END> permissions.add(perm); } return this; }</code><technical_language>Set.addAll method instead</technical_language>

Target:
public Builder<?> read(Role template) { permissions.clear(); permissions.addAll(template.getPermissions()); return this; }
Source:
<code>public static SynthesizedPlanFragment[] createFragmentAndAggregator(long fragmentId, long aggFragmentId, Object... params) { SynthesizedPlanFragment pfs[] = new SynthesizedPlanFragment[2]; <START> <END> pfs[0] = new SynthesizedPlanFragment(); pfs[0].fragmentId = fragmentId; pfs[0].inputDepIds = new int[] {}; pfs[0].outputDepId = (int) fragmentId; pfs[0].multipartition = true; pfs[0].parameters = ParameterSet.fromArrayNoCopy(params); pfs[1] = new SynthesizedPlanFragment(); pfs[1].fragmentId = aggFragmentId; pfs[1].inputDepIds = new int[]{ (int) fragmentId }; pfs[1].outputDepId = (int) aggFragmentId; pfs[1].multipartition = false; pfs[1].parameters = ParameterSet.emptyParameterSet(); return pfs; }</code><technical_language>this protected need public</technical_language>

Target:
public static SynthesizedPlanFragment[] createFragmentAndAggregator(long fragmentId, long aggFragmentId, Object... params) { return createFragmentAndAggregatorFromParameterSet(fragmentId, aggFragmentId, ParameterSet.fromArrayNoCopy(params)); }
Source:
<code>public static byte[] uncompressBytes(byte zippedBytes) { GZIPInputStream zipInputStream = null; try { zipInputStream = new GZIPInputStream(new ByteArrayInputStream(zippedBytes)); return IOUtils.toByteArray(zipInputStream); } catch (IOException e) { <START> e.printStackTrace(); <END> return null; } finally { IOUtils.closeQuietly(zipInputStream); } }</code><technical_language>a real logger.error</technical_language>

Target:
public static byte[] uncompressBytes(byte zippedBytes) { GZIPInputStream zipInputStream = null; try { zipInputStream = new GZIPInputStream(new ByteArrayInputStream(zippedBytes)); return IOUtils.toByteArray(zipInputStream); } catch (IOException e) { logger.error("Unable to uncompress session cookie", e); return null; } finally { IOUtils.closeQuietly(zipInputStream); } }
Source:
<code>public DimensionSelector decorate(final DimensionSelector selector) { if (selector == null) { return selector; } if (matched == null) { <START> matched = new HashSet<>(values.size()); <END> for (String value : values) { int i = selector.lookupId(value); if (i >= 0) { matched.add(i); } } } return new DimensionSelector() { @Override public IndexedInts getRow() { IndexedInts baseRow = selector.getRow(); List<Integer> result = new ArrayList<>(baseRow.size()); for (int i : baseRow) { if (matched.contains(i)) { result.add(i); } } return new ListBasedIndexedInts(result); } @Override public int getValueCardinality() { return matched.size(); } @Override public String lookupName(int id) { return selector.lookupName(id); } @Override public int lookupId(String name) { return selector.lookupId(name); } }; }</code><technical_language>If this is applied multiple segments time, HashSet reference is gonna changing out us. a new close DimensionSelector</technical_language>

Target:
public DimensionSelector decorate(final DimensionSelector selector) { if (selector == null) { return selector; } final Set<Integer> matched = new HashSet<>(values.size()); for (String value : values) { int i = selector.lookupId(value); if (i >= 0) { matched.add(i); } }; return new DimensionSelector() { @Override public IndexedInts getRow() { IndexedInts baseRow = selector.getRow(); List<Integer> result = new ArrayList<>(baseRow.size()); for (int i : baseRow) { if (matched.contains(i)) { if (isWhitelist) { result.add(i); } } else { if (!isWhitelist) { result.add(i); } } } return new ListBasedIndexedInts(result); } @Override public int getValueCardinality() { return matched.size(); } @Override public String lookupName(int id) { return selector.lookupName(id); } @Override public int lookupId(String name) { return selector.lookupId(name); } }; }
Source:
<code><START> public int getUIDForPackage(final String packagename) { <END> int callingUID = 0; try { ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(packagename, 0); callingUID = info.uid; } catch (NameNotFoundException e) { Logger.e(TAG, "Package " + packagename + " is not found", "", ADALError.PACKAGE_NAME_NOT_FOUND, e); } return callingUID; }</code><technical_language>if 'packagename' is null empty this a problem</technical_language>

Target:
public int getUIDForPackage(final String packagename) { int callingUID = 0; try { ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(packagename, 0); if (info != null) { callingUID = info.uid; } } catch (NameNotFoundException e) { Logger.e(TAG, "Package " + packagename + " is not found", "", ADALError.PACKAGE_NAME_NOT_FOUND, e); } return callingUID; }
Source:
<code>public void bind(ImageEntry entry) { <START> PicassoScreens.load(entry.getImageUrl()).placeholder(R.drawable.default_placeholder_image).resize(900, 900).centerInside().into(_imageView); <END> }</code><technical_language>900? constant</technical_language>

Target:
public void bind(ImageEntry entry) { PicassoScreens.load(entry.getImageUrl()) .placeholder(R.drawable.default_placeholder_image) .resize(resizedWidth, resizedHeight) .centerInside() .into(_imageView); }
Source:
<code>public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; Object respondObject = dispatcher.dispatch(this.requestProvider.get(), Events.DURING); if (null != respondObject && null == request.getAttribute(Reply.NO_REPLY_ATTR)) { if (respondObject instanceof Respond) { Respond respond = (Respond) respondObject; final String redirect = respond.getRedirect(); if (null != redirect) { String redirectEncoded = URLEncoder.encode(redirect, "UTF-8").replaceAll("%2F", "/"); response.sendRedirect(redirectEncoded); <START> } else { END> if (null == response.getContentType()) { response.setContentType(respond.getContentType()); } response.getWriter().write(respond.toString()); } } else { headlessRenderer.render(response, respondObject); } } else { filterChain.doFilter(request, response); } }</code><technical_language>plz fix indent. this screw other URI components? matrix params: /myresource;name=value&... screw ; wont it</technical_language>

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; Object respondObject = dispatcher.dispatch(this.requestProvider.get(), Events.DURING); if (null != respondObject && null == request.getAttribute(Reply.NO_REPLY_ATTR)) { if (respondObject instanceof Respond) { Respond respond = (Respond) respondObject; final String redirect = respond.getRedirect(); if (null != redirect) { response.sendRedirect(redirect); } else { if (null == response.getContentType()) { response.setContentType(respond.getContentType()); } response.getWriter().write(respond.toString()); } } else { headlessRenderer.render(response, respondObject); } } else { filterChain.doFilter(request, response); } }