auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Observable<Void> deleteAddress(Long customerId, Long addressId) { if (customerId == null) { throw new NullPointerException("customerId cannot be null"); } if (addressId == null) { throw new NullPointerException("addressId cannot be null"); } int[] successCodes = {HTTP_NO_CONTENT}; return retrofitService.deleteAddress(customerId, addressId) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>(successCodes)) <START> .map(new Func1<Response<Void>, Void>() { <END> @Override public Void call(Response<Void> voidResponse) { return null; } }) .onErrorResumeNext(new BuyClientExceptionHandler<Void>()) .observeOn(callbackScheduler); }</code><technical_language>Do need this map op</technical_language>

Target:
public Observable<Void> deleteAddress(Long customerId, Long addressId) { if (customerId == null) { throw new NullPointerException("customerId cannot be null"); } if (addressId == null) { throw new NullPointerException("addressId cannot be null"); } int[] successCodes = {HTTP_NO_CONTENT}; return retrofitService.deleteAddress(customerId, addressId) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>(successCodes)) .map(new Func1<Response<Void>, Void>() { @Override public Void call(Response<Void> voidResponse) { return voidResponse.body(); } }) .onErrorResumeNext(new BuyClientExceptionHandler<Void>()) .observeOn(callbackScheduler); }
Source:
<code>protected Map<String, Object> delegate() { Map<String, Object> updatedEvent = new LinkedHashMap<>(); <START> event.forEach((key, value) -> { <END> flattenNestedFields(key, value, updatedEvent, new LinkedList<>(Arrays.asList(key))); }); LOG.debug("updated DruidEvent: {}", updatedEvent ); return updatedEvent; }</code><technical_language>delegate is invoked multiple times, map operation, save flattened result re-use it</technical_language>

Target:
protected Map<String, Object> delegate() { return event; }
Source:
<code>public void configure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { if (!PDE.hasFeatureNature(project)) { try { CoreUtility.addNatureToProject(project, PDE.FEATURE_NATURE, monitor); <START> } catch (Exception ex) { <END> PDEPlugin.log(ex); } } }</code><technical_language>catch exception</technical_language>

Target:
public void configure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { if (!PDE.hasFeatureNature(project)) { try { CoreUtility.addNatureToProject(project, PDE.FEATURE_NATURE, monitor); } catch (CoreException ex) { PDEPlugin.log(ex); } } }
Source:
<code>public void removeColumn(long columnIndex) { nativeRemoveColumn(nativePtr, columnIndex); <START> if (hasPrimaryKey() && columnIndex < getPrimaryKey()) { <END> invalidateCachedPrimaryKeyIndex(); } }</code><technical_language>columnIndex < getPrimaryKey() -> columnIndex <= getPrimaryKey()? If column is primary key, cached index cleared</technical_language>

Target:
public void removeColumn(long columnIndex) { final long oldPkColumnIndex = getPrimaryKey(); nativeRemoveColumn(nativePtr, columnIndex); if (oldPkColumnIndex >= 0) { if (oldPkColumnIndex == columnIndex) { setPrimaryKey(null); } else if (oldPkColumnIndex > columnIndex) { invalidateCachedPrimaryKeyIndex(); } } }
Source:
<code><START> public void addParentLevel(ParentKey parent) { <END> this.parentLevels.add(parent); parent.getKey().childLevels.add(this); }</code><technical_language>Speaking of access modifiers, this package private, this called constructing key graph</technical_language>

Target:
void addParentLevel(ParentKey parent) { this.parentLevels.add(parent); parent.getKey().childLevels.add(this); }
Source:
<code><START> public InputStream getAuxFileAsInputStream(String auxItemTag) { <END> throw new UnsupportedOperationException("Not supported yet."); }</code><technical_language>Do need this getAuxFileAsInputStream method? for</technical_language>

Target:
public InputStream getAuxFileAsInputStream(String auxItemTag) { throw new UnsupportedOperationException("InputStreamIO: this method is not supported in this DataAccess driver."); }
Source:
<code>public ListenableFuture<?> waitForWriting() { if (isFinished()) { return NOT_BLOCKED; } <START> return exchanger.getNotFullFuture(); <END> }</code><technical_language>rename this getNotFullFuture waitForWriting</technical_language>

Target:
public ListenableFuture<?> waitForWriting() { if (isFinished()) { return NOT_BLOCKED; } return exchanger.waitForWriting(); }
Source:
<code>protected AttributeChange getAttributeChangeWithFeatureValue(Iterable<?> c, final String featureName, final Object value) { Iterable<AttributeChange> matches = filter(c, AttributeChange.class); Predicate<AttributeChange> predicate = new Predicate<AttributeChange>() { public boolean apply(AttributeChange attributeChange) { Object attributeChangeValue = attributeChange.getValue(); if (attributeChangeValue instanceof EObject) { return Objects.equal(eGet((EObject) attributeChangeValue, featureName), value); } else if (attributeChangeValue instanceof String) { <START> return featureName.equals(attributeChange.getAttribute().getName()) && value.equals(attributeChangeValue); <END> } return false; } }; return find(matches, predicate); }</code><technical_language>Add another else branch a NotImplementedException IllegalStateException, a clear message fact developer needs implement anothe case, for instance attributeChangeValue of type Integer. thank for in future</technical_language>

Target:
protected AttributeChange getAttributeChangeWithFeatureValue(Iterable<?> c, final String featureName, final Object value) { Iterable<AttributeChange> matches = filter(c, AttributeChange.class); Predicate<AttributeChange> predicate = new Predicate<AttributeChange>() { public boolean apply(AttributeChange attributeChange) { Object attributeChangeValue = attributeChange.getValue(); if (attributeChangeValue instanceof EObject) { return Objects.equal(eGet((EObject) attributeChangeValue, featureName), value); } else if (attributeChangeValue instanceof String) { return featureName.equals(attributeChange.getAttribute().getName()) && value.equals(attributeChangeValue); } else { throw new IllegalStateException("Developers need to implement missing cases."); } } }; return find(matches, predicate); }
Source:
<code>private JAXBElement<BBOXType> buildBBoxType(String propertyName, String wkt) { BBOXType bboxType = new BBOXType(); bboxType.setPropertyName(createPropertyNameType(propertyName).getValue()); EnvelopeType envelopeType = gmlObjectFactory.createEnvelopeType(); Envelope envelope = createEnvelopeFromWkt(wkt); <START> List<Double> lowerCornerCoordinates = asList(envelope.getMinX(), envelope.getMinY()); <END> List<Double> upperCornerCoordinates = asList(envelope.getMaxX(), envelope.getMaxY()); if (isLatLonOrder) { Collections.reverse(lowerCornerCoordinates); Collections.reverse(upperCornerCoordinates); } DirectPositionType lowerCorner = new DirectPositionType(); lowerCorner.setValue(lowerCornerCoordinates); envelopeType.setLowerCorner(lowerCorner); DirectPositionType upperCorner = new DirectPositionType(); upperCorner.setValue(upperCornerCoordinates); envelopeType.setUpperCorner(upperCorner); bboxType.setEnvelope(gmlObjectFactory.createEnvelope(envelopeType)); return filterObjectFactory.createBBOX(bboxType); }</code><technical_language>In ideal world, I a more pure OO solution. For example, a class called LatLonList a ctor takes doubles isLatLonOrder flag. class asList() method returns a java.util.List is constructed in correct order. objective is group data (the double values flag) methods (the asList) class</technical_language>

Target:
private JAXBElement<BBOXType> buildBBoxType(String propertyName, String wkt) { BBOXType bboxType = new BBOXType(); bboxType.setPropertyName(createPropertyNameType(propertyName).getValue()); EnvelopeType envelopeType = gmlObjectFactory.createEnvelopeType(); Envelope envelope = createEnvelopeFromWkt(wkt); List<Double> lowerCornerCoordinates = coordinateStrategy.lowerCorner(envelope); List<Double> upperCornerCoordinates = coordinateStrategy.upperCorner(envelope); DirectPositionType lowerCorner = new DirectPositionType(); lowerCorner.setValue(lowerCornerCoordinates); envelopeType.setLowerCorner(lowerCorner); DirectPositionType upperCorner = new DirectPositionType(); upperCorner.setValue(upperCornerCoordinates); envelopeType.setUpperCorner(upperCorner); bboxType.setEnvelope(gmlObjectFactory.createEnvelope(envelopeType)); return filterObjectFactory.createBBOX(bboxType); }
Source:
<code>public void onEvent(Event event) { String eventUei = event.getUei(); if (eventUei == null) <START> return; <END> LOG.debug("Received event: {}", eventUei); if (EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI.equals(eventUei)) { if (event.getNodeid() != null && event.getInterface() != null) { m_trapdIpMgr.setNodeId(event.getInterface(), event.getNodeid().intValue()); } LOG.debug("Added to known node list", event.getInterface()); } else if (EventConstants.INTERFACE_DELETED_EVENT_UEI.equals(eventUei)) { if (event.getInterface() != null) { m_trapdIpMgr.removeNodeId(event.getInterface()); } LOG.debug("Removed from known node list", event.getInterface()); } else if (EventConstants.INTERFACE_REPARENTED_EVENT_UEI.equals(eventUei)) { if (event.getNodeid() != null && event.getInterface() != null) { m_trapdIpMgr.setNodeId(event.getInterface(), event.getNodeid().intValue()); } LOG.debug("Reparented to known node list", event.getInterface()); } }</code><technical_language>intentionally remove this warning</technical_language>

Target:
public void onEvent(Event event) { String eventUei = event.getUei(); if (eventUei == null) { LOG.warn("Received an unexpected event with a null UEI"); return; } LOG.debug("Received event: {}", eventUei); if (EventConstants.NODE_GAINED_INTERFACE_EVENT_UEI.equals(eventUei)) { if (event.getNodeid() != null && event.getInterface() != null) { m_trapdIpMgr.setNodeId(event.getInterface(), event.getNodeid().intValue()); } LOG.debug("Added to known node list", event.getInterface()); } else if (EventConstants.INTERFACE_DELETED_EVENT_UEI.equals(eventUei)) { if (event.getInterface() != null) { m_trapdIpMgr.removeNodeId(event.getInterface()); } LOG.debug("Removed from known node list", event.getInterface()); } else if (EventConstants.INTERFACE_REPARENTED_EVENT_UEI.equals(eventUei)) { if (event.getNodeid() != null && event.getInterface() != null) { m_trapdIpMgr.setNodeId(event.getInterface(), event.getNodeid().intValue()); } LOG.debug("Reparented to known node list", event.getInterface()); } }
Source:
<code>protected void onFinishInflate() { super.onFinishInflate(); mContainer = (ViewGroup) findViewById(R.id.container); mRow0 = (ViewGroup) findViewById(R.id.row0); mRow1 = (ViewGroup) findViewById(R.id.row1); mRow2 = (ViewGroup) findViewById(R.id.row2); mRow3 = (ViewGroup) findViewById(R.id.row3); mDivider = findViewById(R.id.divider); mViews = new View[][]{ new View[]{ mRow0, null, null }, new View[]{ findViewById(R.id.key1), findViewById(R.id.key2), findViewById(R.id.key3) }, new View[]{ findViewById(R.id.key4), findViewById(R.id.key5), findViewById(R.id.key6) }, new View[]{ findViewById(R.id.key7), findViewById(R.id.key8), findViewById(R.id.key9) }, new View[]{ null, findViewById(R.id.key0), findViewById(R.id.key_enter) }, new View[]{ null, mEcaView, null }}; <START> mSecurityMessageDisplay = (KeyguardMessageArea) findViewById(R.id.keyguard_message_area); <END> }</code><technical_language>remove</technical_language>

Target:
protected void onFinishInflate() { super.onFinishInflate(); mContainer = (ViewGroup) findViewById(R.id.container); mRow0 = (ViewGroup) findViewById(R.id.row0); mRow1 = (ViewGroup) findViewById(R.id.row1); mRow2 = (ViewGroup) findViewById(R.id.row2); mRow3 = (ViewGroup) findViewById(R.id.row3); mDivider = findViewById(R.id.divider); mViews = new View[][]{ new View[]{ mRow0, null, null }, new View[]{ findViewById(R.id.key1), findViewById(R.id.key2), findViewById(R.id.key3) }, new View[]{ findViewById(R.id.key4), findViewById(R.id.key5), findViewById(R.id.key6) }, new View[]{ findViewById(R.id.key7), findViewById(R.id.key8), findViewById(R.id.key9) }, new View[]{ null, findViewById(R.id.key0), findViewById(R.id.key_enter) }, new View[]{ null, mEcaView, null }}; }
Source:
<code>private static void validateScanSourceForStreaming( ObjectIdentifier sourceIdentifier, TableSchema schema, ScanTableSource scanSource, ChangelogMode changelogMode) { final boolean hasUpdateBefore = changelogMode.contains(RowKind.UPDATE_BEFORE); final boolean hasUpdateAfter = changelogMode.contains(RowKind.UPDATE_AFTER); if (!hasUpdateBefore && hasUpdateAfter) { if (!schema.getPrimaryKey().isPresent()) { throw new TableException( String.format( <START> "Table '%s' produces a changelog stream contains UPDATE_AFTER no UPDATE_BEFORE, " + <END> "this requires to define primary key constraint on the table.", sourceIdentifier.asSummaryString() ) ); } } else if (hasUpdateBefore && !hasUpdateAfter) { throw new ValidationException( String.format( "Invalid source for table '%s'. A %s doesn't support a changelog which contains " + "UPDATE_BEFORE but no UPDATE_AFTER. Please adapt the implementation of class '%s'.", sourceIdentifier.asSummaryString(), ScanTableSource.class.getSimpleName(), scanSource.getClass().getName() ) ); } }</code><technical_language>contains UPDATE_AFTER, UPDATE_BEFORE.</technical_language>

Target:
private static void validateScanSourceForStreaming( ObjectIdentifier sourceIdentifier, TableSchema schema, ScanTableSource scanSource, ChangelogMode changelogMode) { final boolean hasUpdateBefore = changelogMode.contains(RowKind.UPDATE_BEFORE); final boolean hasUpdateAfter = changelogMode.contains(RowKind.UPDATE_AFTER); if (!hasUpdateBefore && hasUpdateAfter) { if (!schema.getPrimaryKey().isPresent()) { throw new TableException( String.format( "Table '%s' produces a changelog stream contains UPDATE_AFTER, no UPDATE_BEFORE. " + "This requires to define primary key constraint on the table.", sourceIdentifier.asSummaryString() ) ); } } else if (hasUpdateBefore && !hasUpdateAfter) { throw new ValidationException( String.format( "Invalid source for table '%s'. A %s doesn't support a changelog which contains " + "UPDATE_BEFORE but no UPDATE_AFTER. Please adapt the implementation of class '%s'.", sourceIdentifier.asSummaryString(), ScanTableSource.class.getSimpleName(), scanSource.getClass().getName() ) ); } }
Source:
<code>public CloudServiceClusterChangeHandler(String dcName, ClusterMapConfig clusterMapConfig, ClusterChangeHandlerCallback changeHandlerCallback) throws Exception { this.dcName = dcName; this.clusterMapConfig = clusterMapConfig; this.changeHandlerCallback = changeHandlerCallback; cloudServiceDataNode = new CloudServiceDataNode(dcName, clusterMapConfig); cloudServiceInstanceName = <START> ClusterMapUtils.getInstanceName(cloudServiceDataNode.getDatacenterName(), cloudServiceDataNode.getPort()); <END> }</code><technical_language>in CloudServiceDataNode hostname datacenter name, I cloudServiceDataNode.getHostname() generate instance name</technical_language>

Target:
public CloudServiceClusterChangeHandler(String dcName, ClusterMapConfig clusterMapConfig, ClusterChangeHandlerCallback changeHandlerCallback) throws Exception { this.dcName = dcName; this.clusterMapConfig = clusterMapConfig; this.changeHandlerCallback = changeHandlerCallback; cloudServiceDataNode = new CloudServiceDataNode(dcName, clusterMapConfig); }
Source:
<code>private String requestToken() { String accessToken = ""; HttpURLConnection http = null; try { http = (HttpURLConnection) new URL(keycloakTokenEndpoint).openConnection(); http.setRequestMethod(POST); http.setAllowUserInteraction(false); http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); http.setInstanceFollowRedirects(true); http.setDoOutput(true); <START> OutputStream output = http.getOutputStream(); <END> StringBuilder sb = new StringBuilder(); sb.append("grant_type=password") .append("&username=") .append(keycloakUser) .append("&password=") .append(keycloakPassword) .append("&client_id=admin-cli"); output.write(sb.toString().getBytes(UTF_8)); if (http.getResponseCode() != 200) { throw new RuntimeException( "Cannot get access KeyCloak token. Server response code: " + keycloakTokenEndpoint + " " + http.getResponseCode() + IoUtil.readStream(http.getErrorStream())); } output.close(); final BufferedReader response = new BufferedReader(new InputStreamReader(http.getInputStream(), UTF_8)); JsonParser jsonParser = new JsonParser(); JsonElement jsonElement = jsonParser.parse(response); JsonObject asJsonObject = jsonElement.getAsJsonObject(); if (asJsonObject.has("access_token")) { accessToken = asJsonObject.get("access_token").getAsString(); } } catch (IOException | JsonSyntaxException ex) { LOG.error(ex.getMessage(), ex); throw new RuntimeException("Cannot get access KeyCloak token.", ex); } finally { if (http != null) { http.disconnect(); } } return accessToken; }</code><technical_language>Try-finally</technical_language>

Target:
private String requestToken() throws ServerException { String accessToken = ""; HttpURLConnection http = null; try { http = (HttpURLConnection) new URL(keycloakTokenEndpoint).openConnection(); http.setConnectTimeout(60000); http.setReadTimeout(60000); http.setRequestMethod(POST); http.setAllowUserInteraction(false); http.setRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED); http.setInstanceFollowRedirects(true); http.setDoOutput(true); StringBuilder sb = new StringBuilder(); sb.append("grant_type=password") .append("&username=") .append(keycloakUser) .append("&password=") .append(keycloakPassword) .append("&client_id=admin-cli"); try (OutputStream output = http.getOutputStream()) { output.write(sb.toString().getBytes(UTF_8)); } if (http.getResponseCode() != 200) { throw new ServerException( "Cannot get Keycloak access token. Server response: " + keycloakTokenEndpoint + " " + http.getResponseCode() + IoUtil.readStream(http.getErrorStream())); } final BufferedReader response = new BufferedReader(new InputStreamReader(http.getInputStream(), UTF_8)); JsonParser jsonParser = new JsonParser(); JsonElement jsonElement = jsonParser.parse(response); JsonObject asJsonObject = jsonElement.getAsJsonObject(); if (asJsonObject.has("access_token")) { accessToken = asJsonObject.get("access_token").getAsString(); } } catch (IOException | JsonSyntaxException ex) { LOG.error(ex.getMessage(), ex); throw new ServerException("Cannot get Keycloak access token.", ex); } finally { if (http != null) { http.disconnect(); } } return accessToken; }
Source:
<code>public void onBlock(BlockSummary blockSummary) { compositeListener.onBlock(blockSummary); <START> publisher.publish(Events.onBlockAdded(blockSummary)); <END> }</code><technical_language>In a new pub/sub a version of onBlockAdded() accept class. Treat a deprecated feature</technical_language>

Target:
public void onBlock(BlockSummary blockSummary) { compositeListener.onBlock(blockSummary); publisher.publish(Events.onBlockAdded(blockSummary, false)); }
Source:
<code>protected Pair<String, PVlanType> getPrivateVlanPair(String pvlanId, String pvlanTypeStr, String vlanId) { String secondaryVlanId = pvlanId; PVlanType type = null; if (isNotBlank(secondaryVlanId) && (secondaryVlanId.startsWith("i") || secondaryVlanId.startsWith("c") || secondaryVlanId.startsWith("p"))) { String[] parts = secondaryVlanId.split("-"); <START> if (parts.length < 2) { throw new CloudRuntimeException("Could not properly parse the secondary VLAN ID to format TYPE-SVLANID: " + secondaryVlanId); } secondaryVlanId = parts[1]; type = PVlanType.fromValue(parts[0]); <END> } if (isNotBlank(pvlanTypeStr)) { PVlanType providedType = PVlanType.fromValue(pvlanTypeStr); if (type != null && type != providedType) { throw new CloudRuntimeException("The type set in the secondary VLAN ID: " + secondaryVlanId + " does not match the provided Private VLAN type: " + providedType); } type = providedType; } if (isBlank(secondaryVlanId) && type != null && type == PVlanType.Promiscuous) { secondaryVlanId = vlanId; } return new Pair<>(secondaryVlanId, type); }</code><technical_language>a check for >2 ==2 is expected, potential IndexOutOfRange? check for numerical</technical_language>

Target:
protected Pair<String, PVlanType> getPrivateVlanPair(String pvlanId, String pvlanTypeStr, String vlanId) { String secondaryVlanId = pvlanId; PVlanType type = null; if (isNotBlank(pvlanTypeStr)) { PVlanType providedType = PVlanType.fromValue(pvlanTypeStr); type = providedType; } else if (isNotBlank(vlanId) && isNotBlank(secondaryVlanId)) { type = vlanId.equals(secondaryVlanId) ? PVlanType.Promiscuous : PVlanType.Isolated; } if (isBlank(secondaryVlanId) && type == PVlanType.Promiscuous) { secondaryVlanId = vlanId; } if (isNotBlank(secondaryVlanId)) { try { Integer.parseInt(secondaryVlanId); } catch (NumberFormatException e) { throw new CloudRuntimeException("The secondary VLAN ID: " + secondaryVlanId + " is not in numeric format", e); } } return new Pair<>(secondaryVlanId, type); }
Source:
<code>public void testValidContainerIdWhenContainerIdIsValidInTheFirstAttempt() { final ServerTemplate template = mock(ServerTemplate.class); when(template.getContainerSpec("org.jbpm:Evaluation:1.0")).thenReturn(null); doReturn(template).when(specManagementService).getServerTemplate(TEMPLATE_ID); final String containerId = specManagementServiceCDI.validContainerId(TEMPLATE_ID, "org.jbpm:Evaluation:1.0"); <START> assertEquals(containerId, "org.jbpm:Evaluation:1.0"); <END> }</code><technical_language>"org.jbpm:Evaluation:1.0" is repeated, in variable</technical_language>

Target:
public void testValidContainerIdWhenContainerIdIsValidInTheFirstAttempt() { final ServerTemplate template = mock(ServerTemplate.class); when(template.getContainerSpec(EVALUATION_GAV_1_0)).thenReturn(null); doReturn(template).when(specManagementService).getServerTemplate(TEMPLATE_ID); final String containerId = specManagementServiceCDI.validContainerId(TEMPLATE_ID, EVALUATION_GAV_1_0); assertEquals(containerId, EVALUATION_GAV_1_0); }
Source:
<code>@Override public Object execute(GridClientConfiguration clientCfg, Logger log) throws Exception { try (GridClient client = Command.startClient(clientCfg)) { Object res = executeTaskByNameOnNode( client, taskName, taskArgs, null, clientCfg ); <START> if (taskName.equals(VisorSnapshotStatusTask.class.getName())) <END> log.info(String.valueOf(res)); return res; } catch (Throwable e) { log.severe("Failed to perform operation."); log.severe(CommandLogger.errorMessage(e)); throw e; } }</code><technical_language>do need here? a task-specific actions avoided basic SnapshotCommand class</technical_language>

Target:
@Override public Object execute(GridClientConfiguration clientCfg, Logger log) throws Exception { try (GridClient client = Command.startClient(clientCfg)) { Object res = executeTaskByNameOnNode( client, taskName, taskArgs, null, clientCfg ); if (res != null) log.info(String.valueOf(res)); return res; } catch (Throwable e) { log.severe("Failed to perform operation."); log.severe(CommandLogger.errorMessage(e)); throw e; } }
Source:
<code>public void show(final CheckoutResult result) { <START> if (result.getStatus() == CheckoutResult.Status.CONFLICTS) <END> PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.BranchResultDialog_CheckoutConflictsTitle, NLS.bind( UIText.BranchResultDialog_CheckoutConflictsMessage, Repository.shortenRefName(target)), repository, result.getConflictList()); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { BranchOperationUI op = BranchOperationUI .checkoutWithoutQuestion(repository, target); op.start(); } } }); else if (result.getStatus() == CheckoutResult.Status.NONDELETED) { boolean show = false; List<String> pathList = result.getUndeletedList(); for (String path : pathList) if (new File(repository.getWorkTree(), path).exists()) { show = true; break; } if (!show) return; PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new NonDeletedFilesDialog(shell, repository, result .getUndeletedList()).open(); } }); } else if (result.getStatus() == CheckoutResult.Status.OK) { if (RepositoryUtil.isDetachedHead(repository)) showDetachedHeadWarning(); } }</code><technical_language>I prefer braces this pretty large block</technical_language>

Target:
public void show(final CheckoutResult result) { if (result.getStatus() == CheckoutResult.Status.CONFLICTS) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); CleanupUncomittedChangesDialog cleanupUncomittedChangesDialog = new CleanupUncomittedChangesDialog( shell, UIText.BranchResultDialog_CheckoutConflictsTitle, NLS.bind( UIText.BranchResultDialog_CheckoutConflictsMessage, Repository.shortenRefName(target)), repository, result.getConflictList()); cleanupUncomittedChangesDialog.open(); if (cleanupUncomittedChangesDialog.shouldContinue()) { BranchOperationUI op = BranchOperationUI .checkoutWithoutQuestion(repository, target); op.start(); } } }); } else if (result.getStatus() == CheckoutResult.Status.NONDELETED) { boolean show = false; List<String> pathList = result.getUndeletedList(); for (String path : pathList) if (new File(repository.getWorkTree(), path).exists()) { show = true; break; } if (!show) return; PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); new NonDeletedFilesDialog(shell, repository, result .getUndeletedList()).open(); } }); } else if (result.getStatus() == CheckoutResult.Status.OK) { if (RepositoryUtil.isDetachedHead(repository)) showDetachedHeadWarning(); } }
Source:
<code>private Optional<TableToSweep> getNextTableToSweep(Transaction tx, SweepPriorityOverrideConfig overrideConfig) { Optional<TableToSweep> nextTableToSweep = nextTableToSweepProvider.getNextTableToSweep( tx, specificTableSweeper.getSweepRunner().getConservativeSweepTimestamp(), overrideConfig); <START> nextTableToSweep.ifPresent(tableToSweep -> lockForCurrentTable = tableToSweep.getSweepLock()); <END> return nextTableToSweep; }</code><technical_language>nit: extract lock returning TableToSweep? Feels odd separately extract lock well</technical_language>

Target:
private Optional<TableToSweep> getNextTableToSweep(Transaction tx, SweepPriorityOverrideConfig overrideConfig) { Optional<TableToSweep> nextTableToSweep = nextTableToSweepProvider.getNextTableToSweep( tx, specificTableSweeper.getSweepRunner().getConservativeSweepTimestamp(), overrideConfig); if (nextTableToSweep.isPresent()) { nextTableToSweep = augmentWithProgress(nextTableToSweep.get()); currentTable = nextTableToSweep; } return nextTableToSweep; }
Source:
<code>protected String getLabel(EObject eObject) { <START> Preconditions.checkNotNull(adapterFactory); <END> if (eObject != null) { Object adapter = adapterFactory.adapt(eObject, ISemanticObjectLabelProvider.class); if (adapter instanceof ISemanticObjectLabelProvider) { return ((ISemanticObjectLabelProvider)adapter).getSemanticObjectLabel(eObject); } } return null; }</code><technical_language>please delete this line, replace adapterfactory != null in If statement. want raise error if tooltip computed</technical_language>

Target:
protected String getLabel(EObject eObject) { if (eObject != null) { Object adapter = adapterFactory.adapt(eObject, ISemanticObjectLabelProvider.class); if (adapter instanceof ISemanticObjectLabelProvider) { return ((ISemanticObjectLabelProvider)adapter).getSemanticObjectLabel(eObject); } } return null; }
Source:
<code><START> private String getValue(JsonNode json, String key) { <END> if (!json.has(key)) { return null; } return json.get(key).textValue(); }</code><technical_language>Nitpicky stuff: This method performs key lookup do operation one: JsonNode node = json.get(key); return node != null ? node.textValue() : null;</technical_language>

Target:
private String getValue(JsonNode json, String key) { JsonNode node = json.get(key); return node != null ? node.textValue() : null; }
Source:
<code>private static boolean isSelectedCategory(CustomTxtTraceDefinition[] customTxtTraceDefinitions, Set<String> selectedTraceTypes) { for (CustomTxtTraceDefinition def : customTxtTraceDefinitions) { <START> String traceTypeId = CustomTxtTrace.class.getCanonicalName() + ":" + def.definitionName; END> if (selectedTraceTypes.contains(traceTypeId)) { return true; } } return false; }</code><technical_language>':'</technical_language>

Target:
private static boolean isSelectedCategory(CustomTxtTraceDefinition[] customTxtTraceDefinitions, Set<String> selectedTraceTypes) { for (CustomTxtTraceDefinition def : customTxtTraceDefinitions) { String traceTypeId = CustomTxtTrace.class.getCanonicalName() + ':' + def.definitionName; if (selectedTraceTypes.contains(traceTypeId)) { return true; } } return false; }
Source:
<code>public CommunicationIdentityClientBuilder credential(TokenCredential tokenCredential) { this.tokenCredential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); <START> if (accessKeyCredential != null) { logger.info("'accessKey' is being replaced with 'credential', only one authorization method can be used."); this.accessKeyCredential = null; } <END> return this; }</code><technical_language>change of accessKeyCredential user set. This silently set null user - logs noticed. I do validation end build*Client is called. Check if set throw exception</technical_language>

Target:
public CommunicationIdentityClientBuilder credential(TokenCredential tokenCredential) { this.tokenCredential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null."); return this; }
Source:
<code>public void generate(Cube cube, GeneratorStage targetStage) { GeneratorStage stage = cube.getCurrentStage(); if (cube.getTargetStage().precedes(targetStage)) { cube.setTargetStage(targetStage); } if (cube.getCurrentStage().precedes(cube.getTargetStage())) { Dependency dependency = stage.getDependency(cube); if (dependency != null) { Dependent dependent = new Dependent(cube, dependency); this.dependencyManager.register(dependent); } else { stage.getProcessor().processor.add(cube.getAddress()); } <START> <END> } }</code><technical_language>wait, what? work</technical_language>

Target:
public void generate(Cube cube, GeneratorStage targetStage) { if (cube.getTargetStage().precedes(targetStage)) { cube.setTargetStage(targetStage); } this.generate(cube); }
Source:
<code>public void run() { try { while (isOpen.get()) { boolean idleIteration = true; for (PutOperation op : putOperations) { if (!op.isChunkFillComplete()) { op.fillChunks(); <START> idleIteration = false; <END> } } if (idleIteration && !areChunksAvailableForFilling && !chunkFillerThreadSleepDisabled) { synchronized (chunkFillerSynchronizer) { while (!areChunksAvailableForFilling && !chunkFillerThreadSleepDisabled) { isChunkFillerThreadAsleep = true; chunkFillerSynchronizer.wait(); } isChunkFillerThreadAsleep = false; } } } } catch (InterruptedException e) { logger.error("ChunkFillerThread was interrupted", e); if (isOpen.compareAndSet(true, false)) { completePendingOperations(); } } }</code><technical_language>logic of idleIterationis, this loop is for do, I assume next loop do, I sleep for next loop. Do assumption this? Curious if performance substantially impacted if idleIteration is removed</technical_language>

Target:
public void run() { try { while (isOpen.get()) { chunkFillerThreadMaySleep = true; for (PutOperation op : putOperations) { if (!op.isChunkFillComplete()) { op.fillChunks(); chunkFillerThreadMaySleep = false; } } if (chunkFillerThreadMaySleep) { synchronized (chunkFillerSynchronizer) { while (chunkFillerThreadMaySleep) { isChunkFillerThreadAsleep = true; chunkFillerSynchronizer.wait(); } isChunkFillerThreadAsleep = false; } } } } catch (InterruptedException e) { logger.error("ChunkFillerThread was interrupted", e); if (isOpen.compareAndSet(true, false)) { completePendingOperations(); } } }
Source:
<code>public void drawTabs(boolean isFront, int mouseX, int mouseY, float partialTicks, int guiLeft, int guiTop, int xSize, int ySize, RenderItem itemRender, FontRenderer fontRendererObj) { if (getTabs().size() == 1 && container.getClass().equals(GuiInventory.class)) return; int start = page * 12; int end = Math.min(getTabs().size(), (page + 1) * 12); for (GuiTab tab : getTabs()) { if (tab.getTabIndex() >= start && tab.getTabIndex() < end) { if (!tab.isActiveTab(container.getClass()) && !isFront) { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE_TABS); tab.draw(container, isFront, guiLeft, guiTop, xSize, ySize, itemRender, fontRendererObj); } <START> if (tab.isActiveTab(container.getClass()) && isFront) <END> { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE_TABS); tab.draw(container, isFront, guiLeft, guiTop, xSize, ySize, itemRender, fontRendererObj); } } } }</code><technical_language>If want a bit operation for cases, put "else"</technical_language>

Target:
public void drawTabs(boolean isFront, int mouseX, int mouseY, float partialTicks, int guiLeft, int guiTop, int xSize, int ySize, RenderItem itemRender, FontRenderer fontRendererObj) { if (getTabs().size() == 1 && guiContainer instanceof GuiInventory) return; int start = page * maxTabsPerPage; int end = Math.min(getTabs().size(), (page + 1) * maxTabsPerPage); for (GuiTab tab : getTabs()) { if (tab.getTabIndex() >= start && tab.getTabIndex() < end && (tab.isActiveTab(guiContainerClass) || !isFront)) { Minecraft.getMinecraft().getTextureManager().bindTexture(TEXTURE_TABS); tab.draw(guiContainer, isFront, guiLeft, guiTop, xSize, ySize, itemRender, fontRendererObj); } } }
Source:
<code>private AddVmInterfaceParameters getAddParameters(Nic nic) { AddVmInterfaceParameters addParameters = new AddVmInterfaceParameters(vmId, map(nic)); if (nic.isSetNetworkFilterParameters()) { List<VmNicFilterParameter> parameters = nic.getNetworkFilterParameters() .getNetworkFilterParameters().stream() .map(networkFilterParameter -> { VmNicFilterParameter parameter = NetworkFilterParameterMapper.map(networkFilterParameter, null); parameter.setVmInterfaceId(Guid.Empty); return parameter; }) <START> .collect(Collectors.toList()); <END> addParameters.setFilterParameters(parameters); } return addParameters; }</code><technical_language>Consider static import for Collectors.toList</technical_language>

Target:
private AddVmInterfaceParameters getAddParameters(Nic nic) { AddVmInterfaceParameters addParameters = new AddVmInterfaceParameters(vmId, map(nic)); if (nic.isSetNetworkFilterParameters()) { List<VmNicFilterParameter> parameters = nic.getNetworkFilterParameters() .getNetworkFilterParameters().stream() .map(networkFilterParameter -> { VmNicFilterParameter parameter = NetworkFilterParameterMapper.map(networkFilterParameter, null); parameter.setVmInterfaceId(Guid.Empty); return parameter; }) .collect(toList()); addParameters.setFilterParameters(parameters); } return addParameters; }
Source:
<code>public void shouldDrillDownUntilItFindsAFileBasedSuite() throws Exception { final TestSuite rootSuite = new TestSuite(null); final TestSuite intermediateSuite = new TestSuite(null); rootSuite.addNested(intermediateSuite); final TestSuite fileSuite = new TestSuite("file"); intermediateSuite.addNested(fileSuite); <START> assertThat(rootSuite.generateReports()).contains(fileSuite.generateReports().iterator().next()); <END> }</code><technical_language>@inverno containsOnly</technical_language>

Target:
public void shouldDrillDownUntilItFindsAFileBasedSuite() throws Exception { final TestSuite rootSuite = new TestSuite(null); final TestSuite intermediateSuite = new TestSuite(null); rootSuite.addNested(intermediateSuite); final TestSuite fileSuite = new TestSuite("file"); intermediateSuite.addNested(fileSuite); assertThat(rootSuite.generateReports()).containsOnly(fileSuite.generateReports().iterator().next()); }
Source:
<code>private void addErrataForHostsFeature(Features features) { Feature feature = new Feature(); feature.setName("Host Errata"); feature.setDescription("View available errata for hosts."); <START> features.getFeature().add(feature); <END> }</code><technical_language>Consider adding "Katello" name in name and/or description</technical_language>

Target:
private void addErrataForHostsFeature(Features features) { Feature feature = new Feature(); feature.setName("Katello Host Errata"); feature.setDescription("View available Katello Errata for hosts."); features.getFeature().add(feature); }
Source:
<code>public void performGracefulShutdown() { <START> Optional<PassivationManager> passivationManager = componentRegistry.getOptionalComponent(PassivationManager.class); <END> passivationManager.ifPresent(pm -> pm.passivateAll()); }</code><technical_language>PassivationManager optional me, created EmptyConstructorNamedCacheFactory. True, created if other component depends it, getOptionalComponent() method name wrong impression. TBH I lambda-less version :) Edit: inject PassivationManager</technical_language>

Target:
public void performGracefulShutdown() { PassivationManager passivationManager = componentRegistry.getComponent(PassivationManager.class); if (passivationManager != null) { passivationManager.passivateAll(); } }
Source:
<code>public void setArgumentCount(String argumentCountString) { argumentCount = Integer.parseInt(argumentCountString); if (argumentCount < 0) { <START> throw new IllegalArgumentException("Argument count " + argumentCount + " was negative"); <END> } }</code><technical_language>throw exception for 0</technical_language>

Target:
public void setArgumentCount(String argumentCountString) { argumentCount = Integer.parseInt(argumentCountString); if (argumentCount <= 0) { throw new IllegalArgumentException("Argument count " + argumentCount + " was 0 or negative"); } }
Source:
<code>public static IJBoss7ManagerService findService(String runtimeType) { forceStart("org.jboss.ide.eclipse.as.core"); <START> forceStart("org.jboss.ide.eclipse.as.management.as71"); <END> forceStart("org.jboss.ide.eclipse.as.management.wildfly8"); try { return JBoss7ManagerUtil.getService(runtimeType); } catch(JBoss7ManangerException ise) { return null; } }</code><technical_language>forceStart call is required org.jboss.ide.eclipse.as.management.as71 is declared a dependency for test plugin</technical_language>

Target:
public static IJBoss7ManagerService findService(String runtimeType) { try { return JBoss7ManagerUtil.getService(runtimeType); } catch(JBoss7ManangerException ise) { return null; } }
Source:
<code>public Object convert(byte[] tuple) { <START> return null; <END> }</code><technical_language>If this is invoked, please throw UnsupportedOperationException returning value</technical_language>

Target:
public Object convert(byte[] tuple) { throw new UnsupportedOperationException("Not supported"); }
Source:
<code>private void write(SelectionKey key) throws IOException { long startTimeInMs = SystemTime.getInstance().milliseconds(); try { SocketChannel socketChannel = (SocketChannel) key.channel(); SocketServerResponse response = (SocketServerResponse) key.attachment(); Send responseSend = response.getPayload(); if (responseSend == null) { throw new IllegalStateException("Registered for write interest but no response attached to key."); } responseSend.writeTo(socketChannel); if (logger.isTraceEnabled()) { logger.trace("Bytes written to using key ", socketChannel.socket().getRemoteSocketAddress(), key); } if (responseSend.isSendComplete()) { if (logger.isTraceEnabled()) { logger.trace("Finished writing, registering for read on connection {}", socketChannel.socket().getRemoteSocketAddress()); } response.onSendComplete(); metrics.sendInFlight.dec(); key.attach(null); key.interestOps(SelectionKey.OP_READ); } else { if (logger.isTraceEnabled()) { logger.trace("Did not finish writing, registering for write again on connection {}", socketChannel.socket().getRemoteSocketAddress()); } key.interestOps(SelectionKey.OP_WRITE); wakeup(); } } finally { long writeTime = SystemTime.getInstance().milliseconds() - startTimeInMs; <START> logger.trace("SocketServer write piece of data to channel time = {}", writeTime); <END> } }</code><technical_language>"SocketServer time spent write key"</technical_language>

Target:
private void write(SelectionKey key) throws IOException { long startTimeToWriteInMs = SystemTime.getInstance().milliseconds(); try { SocketChannel socketChannel = (SocketChannel) key.channel(); SocketServerResponse response = (SocketServerResponse) key.attachment(); Send responseSend = response.getPayload(); if (responseSend == null) { throw new IllegalStateException("Registered for write interest but no response attached to key."); } responseSend.writeTo(socketChannel); if (logger.isTraceEnabled()) { logger.trace("Bytes written to using key ", socketChannel.socket().getRemoteSocketAddress(), key); } if (responseSend.isSendComplete()) { if (logger.isTraceEnabled()) { logger.trace("Finished writing, registering for read on connection {}", socketChannel.socket().getRemoteSocketAddress()); } response.onSendComplete(); metrics.sendInFlight.dec(); key.attach(null); key.interestOps(SelectionKey.OP_READ); } else { if (logger.isTraceEnabled()) { logger.trace("Did not finish writing, registering for write again on connection {}", socketChannel.socket().getRemoteSocketAddress()); } key.interestOps(SelectionKey.OP_WRITE); wakeup(); } } finally { long writeTime = SystemTime.getInstance().milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", writeTime); } }
Source:
<code>public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof HttpURI)) return false; <START> return toString().equals(o.toString()); <END> }</code><technical_language>this is a good idea toString() for equality, modify toString() include hashCode screwed. Introduce asString() method toURI() a clear semantic those</technical_language>

Target:
public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof HttpURI)) return false; return asString().equals(((HttpURI)o).asString()); }
Source:
<code>private AnnotationMirror standardizeDependentTypeAnnotation( FlowExpressionContext context, TreePath localScope, AnnotationMirror anno, boolean useLocalScope, boolean removeErroneousExpressions) { AnnotationBuilder builder = new AnnotationBuilder( factory.getProcessingEnv(), AnnotationUtils.annotationName(anno)); for (String value : getListOfExpressionElements(anno)) { List<String> expressionStrings = AnnotationUtils.getElementValueArray(anno, value, String.class, true); List<String> standardizedStrings = new ArrayList<>(); for (String expression : expressionStrings) { String standardized = standardizeString( expression, context, localScope, useLocalScope, removeErroneousExpressions); <START> if (standardized == null) { <END> assert removeErroneousExpressions; } else { standardizedStrings.add(standardized); } } builder.setValue(value, standardizedStrings); } return builder.build(); }</code><technical_language>Instead of passing removeErroneousExpressions standardizeString, this if statement check if standardized is error string DependentTypesError#isExpressionError</technical_language>

Target:
private AnnotationMirror standardizeDependentTypeAnnotation( FlowExpressionContext context, TreePath localScope, AnnotationMirror anno, boolean useLocalScope, boolean removeErroneousExpressions) { AnnotationBuilder builder = new AnnotationBuilder( factory.getProcessingEnv(), AnnotationUtils.annotationName(anno)); for (String value : getListOfExpressionElements(anno)) { List<String> expressionStrings = AnnotationUtils.getElementValueArray(anno, value, String.class, true); List<String> standardizedStrings = new ArrayList<>(); for (String expression : expressionStrings) { String standardized = standardizeString(expression, context, localScope, useLocalScope); if (removeErroneousExpressions && DependentTypesError.isExpressionError(standardized)) { } else { standardizedStrings.add(standardized); } } builder.setValue(value, standardizedStrings); } return builder.build(); }
Source:
<code>public void showConflicts(final String projectPath, final List<String> paths, final AsyncCallback<List<String>> callback) { status(projectPath, paths, "infinity", false, false, false, false, false, <START> new ArrayList<String>(), <END> new AsyncRequestCallback<CLIOutputResponse>(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputResponse.class)) { @Override protected void onSuccess(CLIOutputResponse result) { if (result != null) { List<String> conflictsList = parseConflictsList(result.getOutput()); callback.onSuccess(conflictsList); } else { callback.onFailure(new Exception("showConflicts : no SvnResponse.")); } } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); }</code><technical_language>Collections.emtpyList()</technical_language>

Target:
public void showConflicts(final String projectPath, final List<String> paths, final AsyncCallback<List<String>> callback) { status(projectPath, paths, "infinity", false, false, false, false, false, Collections.<String>emptyList(), new AsyncRequestCallback<CLIOutputResponse>(dtoUnmarshallerFactory.newUnmarshaller(CLIOutputResponse.class)) { @Override protected void onSuccess(CLIOutputResponse result) { if (result != null) { List<String> conflictsList = parseConflictsList(result.getOutput()); callback.onSuccess(conflictsList); } else { callback.onFailure(new Exception("showConflicts : no SvnResponse.")); } } @Override protected void onFailure(Throwable exception) { callback.onFailure(exception); } }); }
Source:
<code>private void registerDeviceDiscoveryService(LIRCBridgeHandler handler) { LIRCRemoteDiscoveryService discoveryService = new LIRCRemoteDiscoveryService(handler); <START> discoveryService.activate(); <END> this.discoveryServiceRegs.put(handler.getThing().getUID(), bundleContext .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>())); }</code><technical_language>no! OSGi do job</technical_language>

Target:
private void registerDeviceDiscoveryService(LIRCBridgeHandler handler) { LIRCRemoteDiscoveryService discoveryService = new LIRCRemoteDiscoveryService(handler); this.discoveryServiceRegs.put(handler.getThing().getUID(), bundleContext .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>())); }