auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); Bundle data = getArguments(); final Uri dataUri = data.getParcelable("ARG_DATA_URI"); AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()) .setIcon(android.R.drawable.ic_dialog_info) <START> .setTitle("Upload key") <END> .setMessage("Do you want to upload your key to the server?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ((EditKeyActivity) getActivity()).uploadToKeyserver(dataUri); } }) .setNegativeButton("No", new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { ((EditKeyActivity) getActivity()).finish(); } }); return dialog.create(); }</code><technical_language>Please strings.xml instead of hard-coding strings. some upload related strings in there, able re-use some of them, appropriate</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); Bundle data = getArguments(); final Uri dataUri = data.getParcelable(EditKeyActivity.ARG_DATA_URI); AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()) .setIcon(android.R.drawable.ic_dialog_info) .setTitle(getString(R.string.section_upload_key)) .setMessage(getString(R.string.upload_key_dialog_message)) .setPositiveButton(getString(R.string.choice_yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ((EditKeyActivity) getActivity()).uploadToKeyserver(dataUri); } }) .setNegativeButton(getString(R.string.choice_no), new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { ((EditKeyActivity) getActivity()).finish(); } }); return dialog.create(); }
Source:
<code>private void outputTangentNormalizationResult(final TangentNormalizationResult tangentNormalizationResult){ <START> writeTangentNormalizedOutput(tangentNormalizationResult.getTangentNormalized()); <END> writePreTangentNormalizationOutput(tangentNormalizationResult.getPreTangentNormalized()); writeTangentBetaHats(tangentNormalizationResult.getTangentBetaHats(), tangentNormalizationResult.getTargetFactorNormalizedCounts().columnNames()); writeTargetFactorNormalizedOutput(tangentNormalizationResult.getTargetFactorNormalizedCounts()); }</code><technical_language>Write files in order of calculation, i.e. factor-normalized counts first</technical_language>

Target:
private void outputTangentNormalizationResult(final TangentNormalizationResult tangentNormalizationResult){ writeTargetFactorNormalizedOutput(tangentNormalizationResult.getTargetFactorNormalizedCounts()); writePreTangentNormalizationOutput(tangentNormalizationResult.getPreTangentNormalized()); writeTangentBetaHats(tangentNormalizationResult.getTangentBetaHats(), tangentNormalizationResult.getTargetFactorNormalizedCounts().columnNames()); writeTangentNormalizedOutput(tangentNormalizationResult.getTangentNormalized()); }
Source:
<code>public static boolean checkValidity(final byte[] keystore, final char[] password) { try { final KeyStore keyStore = KeyStore.getInstance(KEYSTORE_TYPE); keyStore.load(new ByteArrayInputStream(keystore), password); final Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { final String alias = aliases.nextElement(); final X509Certificate certificate = (X509Certificate) keyStore.getCertificate(alias); try{ certificate.checkValidity(); } catch (CertificateExpiredException | CertificateNotYetValidException e) { LOGGER.error("Provided APNs .p12 file is not valid"); return false; } } } catch (Exception e) { LOGGER.error("Error parsing .p12 file content", e); return false; } <START> return true; END> }</code><technical_language>this reduced a return true right checkValidity() a return false end of method. I code is more clear exit paths</technical_language>

Target:
public static boolean checkValidity(final byte[] keystore, final char[] password) { try { final KeyStore keyStore = KeyStore.getInstance(KEYSTORE_TYPE); keyStore.load(new ByteArrayInputStream(keystore), password); final Enumeration<String> aliases = keyStore.aliases(); while (aliases.hasMoreElements()) { final String alias = aliases.nextElement(); final X509Certificate certificate = (X509Certificate) keyStore.getCertificate(alias); final X500Principal subjectX500Principal = certificate.getSubjectX500Principal(); final String subject = subjectX500Principal.getName(); final Matcher matcher = COMMON_NAME_PATTERN.matcher(subject); while(matcher.find()) { if (PUSH_SUBJECTS.contains(matcher.group(1))) { try{ certificate.checkValidity(); break; } catch (CertificateExpiredException | CertificateNotYetValidException e) { LOGGER.error("Provided APNs .p12 file is expired or not yet valid"); return false; } } } } return true; } catch (Exception e) { LOGGER.error("Error parsing .p12 file content", e); return false; } }
Source:
<code>private static List<Symbol> cast(List<Symbol> symbolsToCast, List<DataType> targetTypes) { Preconditions.checkState(symbolsToCast.size() == targetTypes.size(), "Given symbol list has to match the target type list."); int size = symbolsToCast.size(); List<Symbol> castList = new ArrayList<>(size); for (int i = 0; i < size; i++) { var symbolToCast = symbolsToCast.get(i); <START> if (ArrayType.unnest(symbolToCast.valueType()).id() != ObjectType.ID) { symbolToCast = symbolToCast.cast(targetTypes.get(i), false); } castList.add(symbolToCast); } <END> return castList; }</code><technical_language>arrays of objects skipped here? array-type/object-type adapted instead</technical_language>

Target:
private static List<Symbol> cast(List<Symbol> symbolsToCast, List<DataType> targetTypes) { Preconditions.checkState(symbolsToCast.size() == targetTypes.size(), "Given symbol list has to match the target type list."); int size = symbolsToCast.size(); List<Symbol> castList = new ArrayList<>(size); for (int i = 0; i < size; i++) { var symbolToCast = symbolsToCast.get(i); var targetType = targetTypes.get(i); if (targetType.id() == UndefinedType.ID) { castList.add(symbolToCast); } else { castList.add(symbolToCast.cast(targetType, false)); } } return castList; }
Source:
<code>private void setupNetworkDao() { when(getDbFacadeMockInstance().getNetworkDao()).thenReturn(networkDaoMock); when(networkDaoMock.get(networkId)).thenReturn((networkMocked)); <START> when(networkMocked.getQosId()).thenReturn(null); <END> }</code><technical_language>return proper ID - mimic real behavior</technical_language>

Target:
private void setupNetworkDao() { when(getDbFacadeMockInstance().getNetworkDao()).thenReturn(networkDaoMock); when(networkDaoMock.get(networkId)).thenReturn((networkMocked)); }
Source:
<code>public Object resource() { KeycloakIdentity identity = createIdentity(true); ResourceServer resourceServer = getResourceServer(identity); RealmModel realm = authorization.getRealm(); <START> ClientModel client = realm.getClientByClientId(identity.getAccessToken().getIssuedFor()); <END> KeycloakSession keycloakSession = authorization.getKeycloakSession(); UserModel serviceAccount = keycloakSession.users().getServiceAccount(client); AdminEventBuilder adminEvent = new AdminEventBuilder(realm, new AdminAuth(realm, identity.getAccessToken(), serviceAccount, client), keycloakSession, clientConnection); ResourceSetService resourceManager = new ResourceSetService(resourceServer, this.authorization, null, adminEvent.realm(realm).authClient(client).authUser(serviceAccount)); ResteasyProviderFactory.getInstance().injectProperties(resourceManager); ResourceService resource = new ResourceService(resourceServer, identity, resourceManager); ResteasyProviderFactory.getInstance().injectProperties(resource); return resource; }</code><technical_language>is change this line to: java ClientModel client = realm.getClientById(resourceServer.getId()); If able this change, happy approve merge it</technical_language>

Target:
public Object resource() { KeycloakIdentity identity = createIdentity(true); ResourceServer resourceServer = getResourceServer(identity); RealmModel realm = authorization.getRealm(); ClientModel client = realm.getClientById(resourceServer.getId()); KeycloakSession keycloakSession = authorization.getKeycloakSession(); UserModel serviceAccount = keycloakSession.users().getServiceAccount(client); AdminEventBuilder adminEvent = new AdminEventBuilder(realm, new AdminAuth(realm, identity.getAccessToken(), serviceAccount, client), keycloakSession, clientConnection); ResourceSetService resourceManager = new ResourceSetService(resourceServer, this.authorization, null, adminEvent.realm(realm).authClient(client).authUser(serviceAccount)); ResteasyProviderFactory.getInstance().injectProperties(resourceManager); ResourceService resource = new ResourceService(resourceServer, identity, resourceManager); ResteasyProviderFactory.getInstance().injectProperties(resource); return resource; }
Source:
<code>public boolean validate(final JEEContext context) { val clientId = OAuth20Utils.getClientIdAndClientSecret(context).getLeft(); val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(this.servicesManager, clientId); if (registeredService == null) { <START> LOGGER.warn("Provided client id cannot be matched against a service definition"); <END> return false; } return true; }</code><technical_language>Include client-id in log message please</technical_language>

Target:
public boolean validate(final JEEContext context) { val clientId = OAuth20Utils.getClientIdAndClientSecret(context).getLeft(); val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(this.servicesManager, clientId); if (registeredService == null) { LOGGER.warn("Provided client id cannot be matched against a service definition", clientId); return false; } return true; }
Source:
<code>private void addOverride(JsonNode root, String name, String value) { JsonNode node = root; final Iterator<String> keys = Splitter.on('.').trimResults().split(name).iterator(); while (keys.hasNext()) { final String key = keys.next(); if (!(node instanceof ObjectNode)) { throw new IllegalArgumentException("Unable to override " + name + "; it's not a valid path."); } final ObjectNode obj = (ObjectNode) node; if (keys.hasNext()) { JsonNode child = obj.get(key); if (child == null) { child = obj.objectNode(); obj.put(key, child); } node = child; } else { if (obj.get(key) != null && obj.get(key).isArray()) <START> { <END> final Iterator<String> values = Splitter.on('|').trimResults().split(value).iterator(); ArrayNode arrayNode = (ArrayNode) obj.get(key); arrayNode.removeAll(); while (values.hasNext()) arrayNode.add (values.next()); } else { obj.put(key, value); } } } }</code><technical_language>Coding style: Dropwizard inline braces: e.g. if (...) {</technical_language>

Target:
private void addOverride(JsonNode root, String name, String value) { JsonNode node = root; final Iterator<String> keys = Splitter.on('.').trimResults().split(name).iterator(); while (keys.hasNext()) { final String key = keys.next(); if (!(node instanceof ObjectNode)) { throw new IllegalArgumentException("Unable to override " + name + "; it's not a valid path."); } final ObjectNode obj = (ObjectNode) node; if (keys.hasNext()) { JsonNode child = obj.get(key); if (child == null) { child = obj.objectNode(); obj.put(key, child); } node = child; } else { if (obj.get(key) != null && obj.get(key).isArray()) { ArrayNode arrayNode = (ArrayNode) obj.get(key); arrayNode.removeAll(); Pattern escapedComma = Pattern.compile("\\\\,"); for (String val : Splitter.on(Pattern.compile("(?<!\\\\),")).trimResults().split(value)) arrayNode.add (escapedComma.matcher(val).replaceAll(",")); } else { obj.put(key, value); } } } }
Source:
<code>public ColdMergeCommandParameters(Guid storagePoolId, SubchainInfo subchainInfo) { <START> super(); <END> setStoragePoolId(storagePoolId); this.subchainInfo = subchainInfo; }</code><technical_language>needed</technical_language>

Target:
public ColdMergeCommandParameters(Guid storagePoolId, SubchainInfo subchainInfo) { setStoragePoolId(storagePoolId); this.subchainInfo = subchainInfo; }
Source:
<code>private static Type getExistingSpecial(StructuralFeature structuralFeature) { Set<Type> types = new HashSet<Type>(); Element owner = structuralFeature.getOwner(); for(RedefinableElement redef : structuralFeature.getRedefinedElement()){ if(redef instanceof TypedElement){ types.add(((TypedElement) redef).getType()); <START> System.out.println("Found type: "+((TypedElement) redef).getType().getName() +" id "+ ((TypedElement) redef).getType().toString() + " for SF " + structuralFeature.getName() + " " + structuralFeature.toString()); <END> } } for(Element oe : owner.getOwnedElement()){ if(oe instanceof Property){ if(!oe.equals(structuralFeature)){ for(RedefinableElement redef : ((Property) oe).getRedefinedElement()){ if(redef instanceof TypedElement) { if (types.contains(((TypedElement) redef).getType())) { System.out.println("Found type: "+((TypedElement) oe).getType().getName() +" id "+ ((TypedElement) oe).getType().toString() + " for SF " + redef.getName() + " " + redef.toString()); return ((Property) oe).getType(); } } } } } } return null; }</code><technical_language>Remove debugging</technical_language>

Target:
private static Type getExistingSpecial(StructuralFeature structuralFeature) { Set<Type> types = new HashSet<Type>(); Element owner = structuralFeature.getOwner(); for(RedefinableElement redef : structuralFeature.getRedefinedElement()){ if(redef instanceof TypedElement){ types.add(((TypedElement) redef).getType()); } } for(Element oe : owner.getOwnedElement()){ if(oe instanceof Property){ if(!oe.equals(structuralFeature)){ for(RedefinableElement redef : ((Property) oe).getRedefinedElement()){ if(redef instanceof TypedElement) { if (types.contains(((TypedElement) redef).getType())) { return ((Property) oe).getType(); } } } } } } return null; }
Source:
<code>private void createExistingTagsSection(Composite parent) { Composite right = new Composite(parent, SWT.NORMAL); right.setLayout(GridLayoutFactory.swtDefaults().create()); right.setLayoutData(GridLayoutFactory.fillDefaults().create()); new Label(right, SWT.WRAP).setText(UIText.CreateTagDialog_existingTags); Table table = new Table(right, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE); table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true) .hint(80, 100).create()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, 20)); table.setLayout(layout); tagViewer = new TableViewer(table); tagViewer.setLabelProvider(new TagLabelProvider()); <START> tagViewer.setContentProvider(new ArrayContentProvider()); <END> tagViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { fillTagDialog(); } }); tagViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof String) return true; RevTag actTag = (RevTag) element; if (tagNamePattern != null) return tagNamePattern.matcher(actTag.getTagName()).find(); else return true; } }); tagViewer .setInput(new String[] { UIText.CreateTagDialog_LoadingMessageText }); tagViewer.getTable().setEnabled(false); applyDialogFont(parent); }</code><technical_language>I 3.5 now, correct? call ArrayContentProvider.getInstance() instead then</technical_language>

Target:
private void createExistingTagsSection(Composite parent) { Composite right = new Composite(parent, SWT.NORMAL); right.setLayout(GridLayoutFactory.swtDefaults().create()); right.setLayoutData(GridLayoutFactory.fillDefaults().create()); new Label(right, SWT.WRAP).setText(UIText.CreateTagDialog_existingTags); Table table = new Table(right, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE); table.setLayoutData(GridDataFactory.fillDefaults().grab(true, true) .hint(80, 100).create()); TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(100, 20)); table.setLayout(layout); tagViewer = new TableViewer(table); tagViewer.setLabelProvider(new TagLabelProvider()); tagViewer.setContentProvider(ArrayContentProvider.getInstance()); tagViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { fillTagDialog(); } }); tagViewer.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof String) return true; RevTag actTag = (RevTag) element; if (tagNamePattern != null) return tagNamePattern.matcher(actTag.getTagName()).find(); else return true; } }); tagViewer .setInput(new String[] { UIText.CreateTagDialog_LoadingMessageText }); tagViewer.getTable().setEnabled(false); applyDialogFont(parent); }
Source:
<code><START> public MyWalker() { <END> super(ProjectState.this.wildProject, ProjectState.this.projectCache); }</code><technical_language>Declare package access</technical_language>

Target:
MyWalker() { super(ProjectState.this.wildProject, ProjectState.this.projectCache); }
Source:
<code>protected void onReveal() { Event entityChangedEvent = getModel().getDiskViewType().getEntityChangedEvent(); if (!entityChangedEvent.getListeners().contains(getView().getDiskTypeChangedEventListener())) { entityChangedEvent.addListener(getView().getDiskTypeChangedEventListener()); } Event systemTreeSelectedItemChangedEvent = CommonModel.getInstance().getSystemTree().getSelectedItemChangedEvent(); if (!systemTreeSelectedItemChangedEvent.getListeners().contains(getView().systemTreeChangedEventListener())) { <START> systemTreeSelectedItemChangedEvent.addListener(getView().systemTreeChangedEventListener()); <END> } super.onReveal(); ((MainTabDiskView) getView()).handleQuotaColumnVisibility(); }</code><technical_language>This unsafe me; this view is destroyed, SystemTreeModel exists listener registered for events. a node is picked, expect some exception thrown. verify? I override onHide() remove this listener. This render check listeners this listener unnecessary - onReveal(), removed onHide()</technical_language>

Target:
protected void onReveal() { Event entityChangedEvent = getModel().getDiskViewType().getEntityChangedEvent(); if (!entityChangedEvent.getListeners().contains(getView().getDiskTypeChangedEventListener())) { entityChangedEvent.addListener(getView().getDiskTypeChangedEventListener()); } Event systemTreeSelectedItemChangedEvent = CommonModel.getInstance().getSystemTree().getSelectedItemChangedEvent(); systemTreeSelectedItemChangedEvent.addListener(systemTreeChangedEventListener); super.onReveal(); getView().handleQuotaColumnVisibility(); }
Source:
<code>public void define(WebService.NewController context) { <START> WebService.NewAction action = context.createAction("search_members") <END> .setResponseExample(getClass().getResource("search_members-example.json")) .setSince("6.4") .setInternal(true) .setHandler(this); action.addSearchQuery("orwe", "names", "logins"); action.addPagingParams(50, MAX_LIMIT); action.createParam(Param.SELECTED) .setDescription("Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected).") .setInternal(true) .setDefaultValue(SelectionMode.SELECTED.value()) .setPossibleValues(SelectionMode.SELECTED.value(), SelectionMode.DESELECTED.value()); action.createParam("organization") .setDescription("Organization key") .setInternal(true) .setRequired(false); }</code><technical_language>Description is missing</technical_language>

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("search_members") .setDescription("Search members of an organization") .setResponseExample(getClass().getResource("search_members-example.json")) .setSince("6.4") .setInternal(true) .setHandler(this); action.addSearchQuery("orwe", "names", "logins"); action.addPagingParams(50, MAX_LIMIT); action.createParam(Param.SELECTED) .setDescription("Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected).") .setInternal(true) .setDefaultValue(SelectionMode.SELECTED.value()) .setPossibleValues(SelectionMode.SELECTED.value(), SelectionMode.DESELECTED.value()); action.createParam("organization") .setDescription("Organization key") .setInternal(true) .setRequired(false); }
Source:
<code>public void addAll(Collection<Metric> metrics, String clientId) { <START> Utils.injectTag(TsdbMetricsQueue.CLIENT_TAG, clientId, metrics); <END> synchronized (this) { queue.addAll(metrics); incrementPerClientBacklog(clientId, metrics.size()); } incrementIncoming(metrics.size()); }</code><technical_language>want add a new tag metric in zenoss</technical_language>

Target:
public void addAll(Collection<Metric> metrics, String clientId) { Utils.injectTag(TsdbMetricsQueue.CLIENT_TAG, clientId, metrics); queue.addAll(metrics); perClientBacklog.addAndGet(clientId, metrics.size()); incrementIncoming(metrics.size()); }
Source:
<code>private Value getValueSlow(ResultInterface rows, Value l) { if (all) { while (rows.next()) { Value[] currentRow = rows.currentRow(); Value r = query.getColumnCount() == 1 ? currentRow[0] : ValueRow.get(currentRow); Value cmp; if (r == ValueNull.INSTANCE || (cmp = Comparison.compareNotNull(database, l, r, compareType)) == ValueNull.INSTANCE) { return ValueNull.INSTANCE; } else if (cmp == ValueBoolean.FALSE) { <START> return cmp; <END> } } return ValueBoolean.TRUE; } else { boolean hasNull = false; while (rows.next()) { Value[] currentRow = rows.currentRow(); Value r = query.getColumnCount() == 1 ? currentRow[0] : ValueRow.get(currentRow); Value cmp; if (r == ValueNull.INSTANCE || (cmp = Comparison.compareNotNull(database, l, r, compareType)) == ValueNull.INSTANCE) { hasNull = true; } else if (cmp == ValueBoolean.TRUE) { return cmp; } } if (hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.FALSE; } }</code><technical_language>this chunk of code repeated often, pull out put Comparison</technical_language>

Target:
private Value getValueSlow(ResultInterface rows, Value l) { boolean hasNull = false; if (all) { while (rows.next()) { Value cmp = compare(l, rows); if (cmp == ValueNull.INSTANCE) { hasNull = true; } else if (cmp == ValueBoolean.FALSE) { return cmp; } } } else { while (rows.next()) { Value cmp = compare(l, rows); if (cmp == ValueNull.INSTANCE) { hasNull = true; } else if (cmp == ValueBoolean.TRUE) { return cmp; } } } if (hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.get(all); }
Source:
<code>private void updateGeoRepStatus(GlusterGeoRepSession session) { GlusterVolumeEntity volume = getVolumeDao().getById(session.getMasterVolumeId()); List<HashMap<Guid, GeoRepSessionStatus>> list = new ArrayList<>(); for (int i=0; i < volume.getBricks().size(); i= i + volume.getReplicaCount()) { <START> HashMap<Guid, GeoRepSessionStatus> nodeStatus = new HashMap<>(); <END> int j = 0; while (j < volume.getReplicaCount()) { Guid brickId = volume.getBricks().get(i + j).getId(); nodeStatus.put(brickId, getStatusForBrickFromSession(session, brickId)); j++; } list.add(nodeStatus); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (HashMap<Guid, GeoRepSessionStatus> nodeStatusMap : list) { if (nodeStatusMap.containsValue(GeoRepSessionStatus.ACTIVE)) { continue; } else if (CollectionUtils.countMatches(nodeStatusMap.values(), PredicateUtils.equalPredicate(GeoRepSessionStatus.FAULTY)) > 0) { session.setStatus(GeoRepSessionStatus.FAULTY); continue; } GeoRepSessionStatus nodeStatus = (GeoRepSessionStatus) nodeStatusMap.values().toArray()[0]; if (CollectionUtils.countMatches(nodeStatusMap.values(), PredicateUtils.equalPredicate(nodeStatus)) == nodeStatusMap.size() && GeoRepSessionStatus.ACTIVE.equals(session.getStatus())) { session.setStatus(nodeStatus); } } }</code><technical_language>node status subvolumeStatus</technical_language>

Target:
private void updateGeoRepStatus(GlusterGeoRepSession session) { GlusterVolumeEntity volume = getVolumeDao().getById(session.getMasterVolumeId()); List<HashMap<Guid, GeoRepSessionStatus>> list = new ArrayList<>(); for (int i=0; i < volume.getBricks().size(); i= i + volume.getReplicaCount()) { HashMap<Guid, GeoRepSessionStatus> subVolumeStatusMap = new HashMap<>(); int j = 0; while (j < volume.getReplicaCount()) { Guid brickId = volume.getBricks().get(i + j).getId(); subVolumeStatusMap.put(brickId, getStatusForBrickFromSession(session, brickId)); j++; } list.add(subVolumeStatusMap); } session.setStatus(GeoRepSessionStatus.ACTIVE); for (HashMap<Guid, GeoRepSessionStatus> subVolumeStatusMap : list) { if (subVolumeStatusMap.containsValue(GeoRepSessionStatus.ACTIVE)) { continue; } else if (subVolumeStatusMap.containsValue(GeoRepSessionStatus.FAULTY)) { session.setStatus(GeoRepSessionStatus.FAULTY); return; } HashSet<GeoRepSessionStatus> statusValues = new HashSet<GeoRepSessionStatus>(subVolumeStatusMap.values()); if (ArrayUtils.contains(overridableStatuses, session.getStatus())) { if (statusValues.size() == 1) { session.setStatus((GeoRepSessionStatus) statusValues.toArray()[0]); } else { log.infoFormat("Multiple status values found in volume {0}" , session.getMasterVolumeName()); } } } }
Source:
<code>@Override public void excludeNode(String nodeId) { <START> impl.failNode(UUID.fromString(nodeId), "Node failed from JMX interface, initiator=" + getLocalNodeId()); <END> }</code><technical_language>need choose term, in TcpDiscovery</technical_language>

Target:
@Override public void excludeNode(String nodeId) { UUID node; try { node = UUID.fromString(nodeId); } catch (IllegalArgumentException e) { U.error(log, e); return; } String msg = "Node excluded, node=" + nodeId + "using JMX interface, initiator=" + getLocalNodeId(); impl.failNode(node, msg); }
Source:
<code>private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry, long stopRank, long startTime, long stopTime) { ITmfTrace trace = timeAnalysisEntry.getTrace(); TimeChartDecorationProvider decorationProvider = fDecorationProviders.get(trace); if (decorationProvider == null) { return; } boolean done = false; while (!done) { synchronized (timeAnalysisEntry) { <START> try (ITmfContext context = checkNotNull( <END> timeAnalysisEntry.getLastRank() != -1 ? trace.seekEvent(timeAnalysisEntry.getLastRank()) : trace.seekEvent(0));) { if (timeAnalysisEntry.getLastRank() >= trace.getNbEvents()) { done = true; break; } while (true) { long rank = context.getRank(); ITmfEvent event = trace.getNext(context); if (event == null) { done = true; break; } TimeChartEvent timeEvent = new TimeChartEvent(timeAnalysisEntry, event, rank, decorationProvider); if (timeEvent.getTime() >= startTime && timeEvent.getTime() <= stopTime) { timeAnalysisEntry.addTraceEvent(timeEvent); } if (context.getRank() == trace.getNbEvents() || context.getRank() == stopRank) { done = true; break; } if (context.getRank() % trace.getCacheSize() == 1) { break; } } timeAnalysisEntry.setLastRank(context.getRank()); } } redrawViewer(true); } }</code><technical_language>original code intent is that, continuing loop a break for UI refresh, normal case is context is right rank reused a seek. changes a new context is created a seek time. I original behavior achieved, calling close() instead of dispose() done in this patch for raw event viewer</technical_language>

Target:
private void updateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry, long stopRank, long startTime, long stopTime) { ITmfTrace trace = timeAnalysisEntry.getTrace(); TimeChartDecorationProvider decorationProvider = fDecorationProviders.get(trace); if (decorationProvider == null) { return; } boolean done = false; while (!done) { synchronized (timeAnalysisEntry) { try (ITmfContext context = (timeAnalysisEntry.getLastRank() != -1) ? trace.seekEvent(timeAnalysisEntry.getLastRank()) : trace.seekEvent(0);) { while (!done) { if (timeAnalysisEntry.getLastRank() >= trace.getNbEvents()) { done = true; break; } if (context == null || context.getRank() != timeAnalysisEntry.getLastRank()) { break; } while (true) { long rank = context.getRank(); ITmfEvent event = trace.getNext(context); if (event == null) { done = true; break; } TimeChartEvent timeEvent = new TimeChartEvent(timeAnalysisEntry, event, rank, decorationProvider); if (timeEvent.getTime() >= startTime && timeEvent.getTime() <= stopTime) { timeAnalysisEntry.addTraceEvent(timeEvent); } if (context.getRank() == trace.getNbEvents() || context.getRank() == stopRank) { done = true; break; } if (context.getRank() % trace.getCacheSize() == 1) { break; } } timeAnalysisEntry.setLastRank(context.getRank()); } redrawViewer(true); } } } redrawViewer(true); }
Source:
<code>public ListRequest list() { return new ListRequest() { @Override public List<ProjectInfo> get() throws RestApiException { <START> return ProjectsImpl.this.list(this); <END> } }; }</code><technical_language>I ProjectsImpl.this is necessary, necessary if method call get(this) conflicts method name in anonymous class</technical_language>

Target:
public ListRequest list() { return new ListRequest() { @Override public List<ProjectInfo> get() throws RestApiException { return list(this); } }; }
Source:
<code>private void readTXSHD() throws NitfFormatException { TreCollection extendedSubheaderTREs = parsingStrategy.parseTREs(reader, textExtendedSubheaderLength - TextConstants.TXSOFL_LENGTH, TreSource.TextExtendedSubheaderData); segment.mergeTREs(extendedSubheaderTREs); <START> } <END></code><technical_language>I static imports</technical_language>

Target:
private void readTXSHD() throws NitfFormatException { TreCollection extendedSubheaderTREs = parsingStrategy.parseTREs(reader, textExtendedSubheaderLength - TXSOFL_LENGTH, TreSource.TextExtendedSubheaderData); segment.mergeTREs(extendedSubheaderTREs); }
Source:
<code>public BlobReadOptions getBlobReadInfo(StoreKey id, EnumSet<StoreGetOptions> getOptions) throws StoreException { IndexValue value = findKey(id); if (value == null) { throw new StoreException("Id " + id + " not present in index " + dataDir, StoreErrorCodes.ID_Not_Found); } else if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { if (getOptions.contains(StoreGetOptions.Store_Include_Deleted)) { MessageInfo deletedBlobInfo = <START> hardDelete.getInfoOfMessageAtOffset(log, value.getOriginalMessageOffset(), value.getOffset(), factory); <END> if (deletedBlobInfo == null) { logger.error("Could not get info of deleted blob at original offset {}", value.getOriginalMessageOffset()); return null; } if (!deletedBlobInfo.getStoreKey().equals(id)) { logger.error("Key at offset different from key in index", deletedBlobInfo.getStoreKey(), id); return null; } return new BlobReadOptions(value.getOriginalMessageOffset(), deletedBlobInfo.getSize(), deletedBlobInfo.getExpirationTimeInMs(), deletedBlobInfo.getStoreKey()); } else { throw new StoreException("Id " + id + " has been deleted in index " + dataDir, StoreErrorCodes.ID_Deleted); } } else if (value.isExpired() && !getOptions.contains(StoreGetOptions.Store_Include_Expired)) { throw new StoreException("Id " + id + " has expired ttl in index " + dataDir, StoreErrorCodes.TTL_Expired); } return new BlobReadOptions(value.getOffset(), value.getSize(), value.getTimeToLiveInMs(), id); }</code><technical_language>do need pass in end offset explicitly? Lets pass in start offset, reading header offset find end offset for message suffice right? do need this extra check</technical_language>

Target:
public BlobReadOptions getBlobReadInfo(StoreKey id, EnumSet<StoreGetOptions> getOptions) throws StoreException { IndexValue value = findKey(id); if (value == null) { throw new StoreException("Id " + id + " not present in index " + dataDir, StoreErrorCodes.ID_Not_Found); } else if (value.isFlagSet(IndexValue.Flags.Delete_Index)) { if (getOptions.contains(StoreGetOptions.Store_Include_Deleted)) { try { MessageInfo deletedBlobInfo = hardDelete.getMessageInfo(log, value.getOriginalMessageOffset(), factory); return new BlobReadOptions(value.getOriginalMessageOffset(), deletedBlobInfo.getSize(), deletedBlobInfo.getExpirationTimeInMs(), deletedBlobInfo.getStoreKey()); } catch (IOException e) { throw new StoreException("IOError when reading delete blob info from the log " + dataDir, e, StoreErrorCodes.IOError); } } else { throw new StoreException("Id " + id + " has been deleted in index " + dataDir, StoreErrorCodes.ID_Deleted); } } else if (value.isExpired() && !getOptions.contains(StoreGetOptions.Store_Include_Expired)) { throw new StoreException("Id " + id + " has expired ttl in index " + dataDir, StoreErrorCodes.TTL_Expired); } return new BlobReadOptions(value.getOffset(), value.getSize(), value.getTimeToLiveInMs(), id); }
Source:
<code>default List<BibEntry> performSearch(String query) throws FetcherException { if (StringUtil.isBlank(query)) { return Collections.emptyList(); } try (InputStream stream = getUrlDownload(query).asInputStream()) { List<BibEntry> fetchedEntries = new ArrayList<>(); <START> PushbackInputStream pushbackInputStream = new PushbackInputStream(stream); <END> int b; b = pushbackInputStream.read(); if (b != -1) { pushbackInputStream.unread(b); fetchedEntries = getParser().parseEntries(pushbackInputStream); fetchedEntries.forEach(this::doPostCleanup); } pushbackInputStream.close(); return fetchedEntries; } catch (URISyntaxException e) { throw new FetcherException("Search URI is malformed", e); } catch (IOException e) { throw new FetcherException("A network error occurred", e); } catch (ParseException e) { throw new FetcherException("An internal parser error occurred", e); } }</code><technical_language>wrap stream in a Try Resources Statement stream closed automatically errors. please rename "b" a more meaningful variable, e.g. readByte <LINK_0></technical_language>

Target:
default List<BibEntry> performSearch(String query) throws FetcherException { if (StringUtil.isBlank(query)) { return Collections.emptyList(); } try (InputStream stream = getUrlDownload(getURLForQuery(query)).asInputStream()) { List<BibEntry> fetchedEntries = getParser().parseEntries(stream); fetchedEntries.forEach(this::doPostCleanup); return fetchedEntries; } catch (URISyntaxException e) { throw new FetcherException("Search URI is malformed", e); } catch (IOException e) { throw new FetcherException("A network error occurred", e); } catch (ParseException e) { throw new FetcherException("An internal parser error occurred", e); } }
Source:
<code>public String getAddressValidationMessageIfCheckPayment(String employeeId) { String validationMessage = StringUtils.EMPTY; if (isPayeeSignedUpForACH(employeeId)) { LOG.info("validateAddressIfCheckPayment, the employee ID " + employeeId + " is signed up for ACH so no need to validdate address."); } else { boolean valid = validPdpAddress(employeeId); <START> if (!valid) { <END> validationMessage = getConfigurationService().getPropertyValueAsString(ConcurKeyConstants.CONCUR_INCOMPLETE_ADDRESS); } } return validationMessage; }</code><technical_language>check validPdpAddress(employeeId) valid variable is for else</technical_language>

Target:
public String getAddressValidationMessageIfCheckPayment(String employeeId) { String validationMessage = StringUtils.EMPTY; if (isPayeeSignedUpForACH(employeeId)) { LOG.info("validateAddressIfCheckPayment, the employee ID " + employeeId + " is signed up for ACH so no need to validdate address."); } else { if (!validPdpAddress(employeeId)) { LOG.info("validateAddressIfCheckPayment, the employee ID " + employeeId + " has an INVALID address."); validationMessage = getConfigurationService().getPropertyValueAsString(ConcurKeyConstants.CONCUR_INCOMPLETE_ADDRESS); } else { LOG.info("validateAddressIfCheckPayment, the employee ID " + employeeId + " has an valid address."); } } return validationMessage; }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ApplyAclRuleVspCommand that = (ApplyAclRuleVspCommand) o; if (_egressDefaultPolicy != that._egressDefaultPolicy) return false; if (_isL2Network != that._isL2Network) return false; if (_networkAcl != that._networkAcl) return false; if (_networkId != that._networkId) return false; if (_networkReset != that._networkReset) return false; if (_aclRules != null ? !_aclRules.equals(that._aclRules) : that._aclRules != null) return false; if (_acsIngressAcl != null ? !_acsIngressAcl.equals(that._acsIngressAcl) : that._acsIngressAcl != null) return false; if (_domainTemplateName != null ? !_domainTemplateName.equals(that._domainTemplateName) : that._domainTemplateName != null) return false; if (_networkDomainUuid != null ? !_networkDomainUuid.equals(that._networkDomainUuid) : that._networkDomainUuid != null) return false; if (_networkName != null ? !_networkName.equals(that._networkName) : that._networkName != null) return false; if (_networkUuid != null ? !_networkUuid.equals(that._networkUuid) : that._networkUuid != null) return false; if (_vpcOrSubnetUuid != null ? !_vpcOrSubnetUuid.equals(that._vpcOrSubnetUuid) : that._vpcOrSubnetUuid != null) return false; return true; }</code><technical_language>This equals implementation include attributes Command super class</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ApplyAclRuleVspCommand)) return false; if (!super.equals(o)) return false; ApplyAclRuleVspCommand that = (ApplyAclRuleVspCommand) o; if (_egressDefaultPolicy != that._egressDefaultPolicy) return false; if (_isL2Network != that._isL2Network) return false; if (_networkAcl != that._networkAcl) return false; if (_networkId != that._networkId) return false; if (_networkReset != that._networkReset) return false; if (_aclRules != null ? !_aclRules.equals(that._aclRules) : that._aclRules != null) return false; if (_acsIngressAcl != null ? !_acsIngressAcl.equals(that._acsIngressAcl) : that._acsIngressAcl != null) return false; if (_domainTemplateName != null ? !_domainTemplateName.equals(that._domainTemplateName) : that._domainTemplateName != null) return false; if (_networkDomainUuid != null ? !_networkDomainUuid.equals(that._networkDomainUuid) : that._networkDomainUuid != null) return false; if (_networkName != null ? !_networkName.equals(that._networkName) : that._networkName != null) return false; if (_networkUuid != null ? !_networkUuid.equals(that._networkUuid) : that._networkUuid != null) return false; if (_vpcOrSubnetUuid != null ? !_vpcOrSubnetUuid.equals(that._vpcOrSubnetUuid) : that._vpcOrSubnetUuid != null) return false; return true; }
Source:
<code><START> public LongSelectiveStreamReader( <END> StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, AggregatedMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); directReader = new LongDirectSelectiveStreamReader(streamDescriptor, filter, outputType, systemMemoryContext.newLocalMemoryContext(LongSelectiveStreamReader.class.getSimpleName())); dictionaryReader = new LongDictionarySelectiveStreamReader(streamDescriptor, filter, outputType, systemMemoryContext.newLocalMemoryContext(LongSelectiveStreamReader.class.getSimpleName())); }</code><technical_language>for this for dictionary reader; used</technical_language>

Target:
public LongSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, AggregatedMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); directReader = new LongDirectSelectiveStreamReader(streamDescriptor, filter, outputType, systemMemoryContext.newLocalMemoryContext(LongSelectiveStreamReader.class.getSimpleName())); dictionaryReader = new LongDictionarySelectiveStreamReader(streamDescriptor, filter, outputType, systemMemoryContext.newLocalMemoryContext(LongSelectiveStreamReader.class.getSimpleName())); }
Source:
<code>private static Optional<Expression> searchVerifyAssignment(CallExpression callExpr) { for (Argument a : callExpr.arguments()) { <START> if (a instanceof RegularArgumentImpl) { <END> RegularArgumentImpl regArg = (RegularArgumentImpl) a; Name keywordArgument = regArg.keywordArgument(); if (keywordArgument != null && "verify".equals(keywordArgument.name())) { return Optional.of(regArg.expression()); } } } return Optional.empty(); }</code><technical_language>I a.is(Kind.REGULAR_ARGUMENT)</technical_language>

Target:
private static Optional<List<Expression>> searchVerifyAssignment(CallExpression callExpr) { for (Argument a : callExpr.arguments()) { if (a.is(Tree.Kind.REGULAR_ARGUMENT)) { RegularArgument regArg = (RegularArgument) a; Name keywordArgument = regArg.keywordArgument(); if (keywordArgument != null && "verify".equals(keywordArgument.name())) { return Optional.of(Collections.singletonList(regArg.expression())); } } } return Optional.empty(); }
Source:
<code>private void restoreSendFeedbackTask() { Object object = getLastNonConfigurationInstance(); if (object != null && object instanceof SendFeedbackTask) { <START> mSendFeedbackTask = (SendFeedbackTask) (object); <END> mSendFeedbackTask.setHandler(mFeedbackHandler); } }</code><technical_language>IMO (SendFeedbackTask) object is fine</technical_language>

Target:
private void restoreSendFeedbackTask() { Object object = getLastNonConfigurationInstance(); if (object != null && object instanceof SendFeedbackTask) { mSendFeedbackTask = (SendFeedbackTask) object; mSendFeedbackTask.setHandler(mFeedbackHandler); } }
Source:
<code>private Set<TopicPartition> validCheckpointableTopics() { final Set<TopicPartition> result = new HashSet<>(storeToChangelogTopic.size()); <START> for (final Map.Entry<String, String> storeToChangelog : storeToChangelogTopic.entrySet()) { <END> if (registeredStores.containsKey(storeToChangelog.getKey()) && registeredStores.get(storeToChangelog.getKey()).isPresent() && registeredStores.get(storeToChangelog.getKey()).get().persistent()) { result.add(new TopicPartition(storeToChangelog.getValue(), getPartition(storeToChangelog.getValue()))); } } return result; }</code><technical_language>I assign storeToChangelog.getKey() a variable called storeName code more readable</technical_language>

Target:
private Set<TopicPartition> validCheckpointableTopics() { final Set<TopicPartition> result = new HashSet<>(storeToChangelogTopic.size()); for (final Map.Entry<String, String> storeToChangelog : storeToChangelogTopic.entrySet()) { final String storeName = storeToChangelog.getKey(); if (registeredStores.containsKey(storeName) && registeredStores.get(storeName).isPresent() && registeredStores.get(storeName).get().persistent()) { final String changelogTopic = storeToChangelog.getValue(); result.add(new TopicPartition(changelogTopic, getPartition(changelogTopic))); } } return result; }
Source:
<code>public <START> synchronized static <END> void setTasksMap(String hostName, String taskId) { tasksmap.put(hostName, taskId); }</code><technical_language>concurrent hash map instead of synchronized</technical_language>

Target:
public static void setTasksMap(String hostName, String taskId) { tasksmap.put(hostName, taskId); }
Source:
<code>public String url(String remoteHost, String workingUrl) throws IOException { boolean fileExist = artifact.exists(); LOG.debug( <START> "Requesting the file [" + artifact.getAbsolutePath() + "], exist? [" + fileExist + "]"); <END> if (fileExist && artifact.isFile()) { String sha1 = StringUtil.sha1Digest(artifact); return format("%s/%s/%s/%s?sha1=%s", remoteHost, "remoting", "files", workingUrl, URLEncoder.encode(sha1, "UTF-8")); } else { return format("%s/%s/%s/%s", remoteHost, "remoting", "files", workingUrl); } }</code><technical_language>change</technical_language>

Target:
public String url(String remoteHost, String workingUrl) throws IOException { boolean fileExist = artifact.exists(); LOG.debug("Requesting the file [{}], exist? [{}]", artifact.getAbsolutePath(), fileExist); if (fileExist && artifact.isFile()) { String sha1 = StringUtil.sha1Digest(artifact); return format("%s/%s/%s/%s?sha1=%s", remoteHost, "remoting", "files", workingUrl, URLEncoder.encode(sha1, "UTF-8")); } else { return format("%s/%s/%s/%s", remoteHost, "remoting", "files", workingUrl); } }
Source:
<code>public boolean hasMemoryToRunVM(VDS curVds, VM vm) { boolean retVal = false; if (curVds.getMemCommited() != null && curVds.getPhysicalMemMb() != null && curVds.getReservedMem() != null <START> && curVds.getSwapTotal() != null) { <END> double vdsCurrentMem = getVdsCurrentReservedMemory(curVds) + vm.getMinAllocatedMem(); double vdsMemLimit = getVdsMemLimit(curVds); log.debug("hasMemoryToRunVM: host '{}' physical vmem size is : {}, swap total vmem size is : MB", curVds.getName(), curVds.getPhysicalMemMb(), curVds.getSwapTotal()); log.debug("Host Mem Conmmitted: '{}', pending vmem size is : {}, Host Guest Overhead {}, Host Reserved Mem: {}, VM Min Allocated Mem {}", curVds.getMemCommited(), curVds.getPendingVmemSize(), curVds.getGuestOverhead(), curVds.getReservedMem(), vm.getMinAllocatedMem()); log.debug("{} <= ??? {}", vdsCurrentMem, vdsMemLimit); retVal = (vdsCurrentMem <= vdsMemLimit); } return retVal; }</code><technical_language>swap removed</technical_language>

Target:
public boolean hasMemoryToRunVM(VDS curVds, VM vm) { boolean retVal = false; if (curVds.getMemCommited() != null && curVds.getPhysicalMemMb() != null && curVds.getReservedMem() != null) { double vdsCurrentMem = getVdsCurrentMemoryInUse(curVds) + vm.getMinAllocatedMem(); double vdsMemLimit = getVdsMemLimit(curVds); log.debug("hasMemoryToRunVM: host '{}' physical vmem size is : MB", curVds.getName(), curVds.getPhysicalMemMb()); log.debug("Host Mem Conmmitted: '{}', pending vmem size is : {}, Host Guest Overhead {}, Host Reserved Mem: {}, VM Min Allocated Mem {}", curVds.getMemCommited(), curVds.getPendingVmemSize(), curVds.getGuestOverhead(), curVds.getReservedMem(), vm.getMinAllocatedMem()); log.debug("{} <= ??? {}", vdsCurrentMem, vdsMemLimit); retVal = (vdsCurrentMem <= vdsMemLimit); } return retVal; }