auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateToolbarTitle() { if (toolbar != null) { TextView tvTitle = toolbar.findViewById(R.id.toolbar_title); if (screenType == REORDER_SCREEN_TYPE) { tvTitle.setText(getString(R.string.configure_screen_quick_action)); <START> } else { <END> int selectedCount = actionsToDelete != null ? actionsToDelete.size() : 0; String title = String.format( getString(R.string.ltr_or_rtl_combine_via_colon), getString(R.string.shared_string_selected), String.valueOf(selectedCount)); tvTitle.setText(title); } } }</code><technical_language>else blocks screenType == SCREEN_TYPE_</technical_language>

Target:
private void updateToolbarTitle() { if (toolbar != null) { TextView tvTitle = toolbar.findViewById(R.id.toolbar_title); if (screenType == SCREEN_TYPE_REORDER) { tvTitle.setText(getString(R.string.configure_screen_quick_action)); } else if (screenType == SCREEN_TYPE_DELETE) { int selectedCount = actionsToDelete != null ? actionsToDelete.size() : 0; String title = String.format( getString(R.string.ltr_or_rtl_combine_via_colon), getString(R.string.shared_string_selected), String.valueOf(selectedCount)); tvTitle.setText(title); } } }
Source:
<code>public synchronized void doSubmitSummary( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { <START> setDescription(req.getParameter("summary")); <END> rsp.sendRedirect("."); }</code><technical_language>setting description instead of summary</technical_language>

Target:
public synchronized void doSubmitSummary( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { setSummary(req.getParameter("summary")); rsp.sendRedirect("."); }
Source:
<code>private void loadCampaignsStateFromCache() throws JSONException { String campaignsStateFromCache = cachedLocalStorage.getCacheEntryForUser(userId, CAMPAIGNS_STATE_CATEGORY); if (!SwrveHelper.isNullOrEmpty(campaignsStateFromCache)) { JSONObject campaignsStateJson = new JSONObject(campaignsStateFromCache); Iterator<String> campaignIdIterator = campaignsStateJson.keys(); while(campaignIdIterator.hasNext()) { String campaignIdStr = campaignIdIterator.next(); try { int campaignId = Integer.parseInt(campaignIdStr); SwrveCampaignState campaignState = new SwrveCampaignState(campaignsStateJson.getJSONObject(campaignIdStr)); campaignsState.put(campaignId, campaignState); } catch(Exception exp) { <START> SwrveLogger.e(LOG_TAG, "Could not load state for campaign " + campaignIdStr, exp); <END> } } } }</code><technical_language>If corrupt data saved local cache, do recover ok this</technical_language>

Target:
private void loadCampaignsStateFromCache() { try { String campaignsStateFromCache = cachedLocalStorage.getCacheEntryForUser(userId, CAMPAIGNS_STATE_CATEGORY); if (!SwrveHelper.isNullOrEmpty(campaignsStateFromCache)) { JSONObject campaignsStateJson = new JSONObject(campaignsStateFromCache); Iterator<String> campaignIdIterator = campaignsStateJson.keys(); while (campaignIdIterator.hasNext()) { String campaignIdStr = campaignIdIterator.next(); try { int campaignId = Integer.parseInt(campaignIdStr); SwrveCampaignState campaignState = new SwrveCampaignState(campaignsStateJson.getJSONObject(campaignIdStr)); campaignsState.put(campaignId, campaignState); } catch (Exception exp) { SwrveLogger.e(LOG_TAG, "Could not load state for campaign " + campaignIdStr, exp); } } } } catch(JSONException e) { SwrveLogger.e(LOG_TAG, "Could not load state of campaigns, bad JSON", e); } }
Source:
<code>private static void fillRwadefProperties(Model model, Representation representation) { if (model.getProperties() == null) { return; } sortSwaggerPropertiesByPosition(model); for (String key : model.getProperties().keySet()) { org.restlet.ext.apispark.internal.model.Property property = new org.restlet.ext.apispark.internal.model.Property(); Property swaggerProperty = model.getProperties().get(key); property.setDefaultValue(swaggerProperty.getDefault()); property.setDescription(swaggerProperty.getDescription()); property.setExample(swaggerProperty.getExample()); <START> property.setMinOccurs(swaggerProperty.getRequired() ? 1 : 0); <END> property.setMaxOccurs(swaggerProperty instanceof ArrayProperty ? -1 : 1); property.setName(key); property.setUniqueItems(false); if (swaggerProperty instanceof AbstractNumericProperty) { AbstractNumericProperty numericProperty = (AbstractNumericProperty) swaggerProperty; formatPropertyMinMax(numericProperty, property); } else if (swaggerProperty instanceof ArrayProperty) { ArrayProperty arrayProperty = (ArrayProperty) swaggerProperty; property.setExample(arrayProperty.getItems().getExample()); } property.setType(SwaggerTypes.toDefinitionType(swaggerProperty)); representation.getProperties().add(property); } }</code><technical_language>add setRequired setList in rwadef property (update minOccurs / maxOccurs field / stored in a field / JsonIgnore)</technical_language>

Target:
private static void fillRwadefProperties(Model model, Representation representation) { if (model.getProperties() == null) { return; } for (String key : model.getProperties().keySet()) { org.restlet.ext.apispark.internal.model.Property property = new org.restlet.ext.apispark.internal.model.Property(); Property swaggerProperty = model.getProperties().get(key); property.setDefaultValue(swaggerProperty.getDefault()); property.setDescription(swaggerProperty.getDescription()); property.setExample(swaggerProperty.getExample()); property.setRequired(swaggerProperty.getRequired()); property.setList(swaggerProperty instanceof ArrayProperty); property.setName(key); property.setUniqueItems(false); if (swaggerProperty instanceof ArrayProperty) { ArrayProperty arrayProperty = (ArrayProperty) swaggerProperty; property.setExample(arrayProperty.getItems().getExample()); } property.setType(SwaggerTypes.toDefinitionType(swaggerProperty)); representation.getProperties().add(property); } }
Source:
<code>public void onEventMainThread(final NotificationEvents.NoteLikeStatusChanged event) { NotificationsActions.downloadNoteAndUpdateDB(event.noteId, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { EventBus.getDefault().removeStickyEvent(NotificationEvents.NoteLikeStatusChanged.class); <START> Note note = NotificationsTable.getNoteById(event.noteId); <END> mNotesAdapter.replaceNote(note); } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { EventBus.getDefault().removeStickyEvent(NotificationEvents.NoteLikeStatusChanged.class); } } ); }</code><technical_language>note is null here, a check replacing note in adapter</technical_language>

Target:
public void onEventMainThread(final NotificationEvents.NoteLikeStatusChanged event) { NotificationsActions.downloadNoteAndUpdateDB(event.noteId, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { EventBus.getDefault().removeStickyEvent(NotificationEvents.NoteLikeStatusChanged.class); Note note = NotificationsTable.getNoteById(event.noteId); if (note != null) { mNotesAdapter.replaceNote(note); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { EventBus.getDefault().removeStickyEvent(NotificationEvents.NoteLikeStatusChanged.class); } } ); }
Source:
<code>private void addItemOnTarget( T item, T target, String targetItemNotFoundErrorMessage, SerializableFunction<Integer, Integer> insertItemsIndexProvider) { final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); if (!(backendItems instanceof List)) { throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); } if (equals(item, target, dataProvider)) { return; } final int targetItemIndex = getItemIndex(target, dataProvider::getId); if (targetItemIndex == -1) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } final List<T> itemList = (List<T>) backendItems; removeItemIfPresent(item, dataProvider); itemList.add(insertItemsIndexProvider <START> .apply(getItemIndex(target, dataProvider::getId)), item); <END> dataProvider.refreshAll(); }</code><technical_language>Oh, a silly mistake! replace call getItemIndex contains: if (!contains(targetItemIndex, dataProvider)) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } easier read</technical_language>

Target:
private void addItemOnTarget( T item, T target, String targetItemNotFoundErrorMessage, SerializableFunction<Integer, Integer> insertItemsIndexProvider) { final ListDataProvider<T> dataProvider = getDataProvider(); final Collection<T> backendItems = dataProvider.getItems(); if (!(backendItems instanceof List)) { throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, backendItems.getClass().getSimpleName())); } if (equals(item, target, dataProvider)) { return; } if (!contains(target, dataProvider)) { throw new IllegalArgumentException(targetItemNotFoundErrorMessage); } final List<T> itemList = (List<T>) backendItems; removeItemIfPresent(item, dataProvider); itemList.add(insertItemsIndexProvider .apply(getItemIndex(target, dataProvider::getId)), item); dataProvider.refreshAll(); }
Source:
<code>public void testRepresentedCountry() { assertNotNull("city.getRepresentedCountry() returns null", this.insights.getRepresentedCountry()); assertEquals( "city.getRepresentedCountry().getType() does not return C<military>", "C<military>", this.insights.getRepresentedCountry().getType()); <START> assertEquals( <END> "city.getRepresentedCountry().isInEuropeanUnion() does not return true", true, this.insights.getRepresentedCountry().isInEuropeanUnion()); }</code><technical_language>assertTrue</technical_language>

Target:
public void testRepresentedCountry() { assertNotNull("city.getRepresentedCountry() returns null", this.insights.getRepresentedCountry()); assertEquals( "city.getRepresentedCountry().getType() does not return C<military>", "C<military>", this.insights.getRepresentedCountry().getType()); assertTrue( "city.getRepresentedCountry().isInEuropeanUnion() does not return true", this.insights.getRepresentedCountry().isInEuropeanUnion()); }
Source:
<code>public void canCreateRelease() throws Exception { final Releases releases = RtReleasesITCase.releases(); final String tag = "0.1"; int number = 0; try { final Release created = releases.create(tag); number = created.number(); final Release obtained = releases.get(number); MatcherAssert.assertThat( created, Matchers.is(obtained) ); MatcherAssert.assertThat( new Release.Smart(created).tag(), Matchers.equalTo(new Release.Smart(obtained).tag()) ); } finally { <START> releases.remove(number); <END> } }</code><technical_language>if line 91 throws exception try remove release number zero this line, is correct, I</technical_language>

Target:
public void canCreateRelease() throws Exception { final Releases releases = RtReleasesITCase.releases(); final String tag = "0.1"; final Release created = releases.create(tag); final int number = created.number(); try { final Release obtained = releases.get(number); MatcherAssert.assertThat( created, Matchers.is(obtained) ); MatcherAssert.assertThat( new Release.Smart(created).tag(), Matchers.equalTo(new Release.Smart(obtained).tag()) ); } finally { releases.remove(number); } }
Source:
<code>protected String getValueFromSwitchOrProp(String what, String switchName, String propName) { if (switchName != null && ! switchName.startsWith("-")) { <START> LOG.warn("Specifying switch names (e.g. '{}') without a leading dash is no longer supported. You must update your notification command definitions. See <LINK_0>", switchName); <END> } LOG.debug("Trying to get from notification switch {}", what, switchName); String val = getSwitchValue(switchName); if (val != null) { LOG.info("Using value from notification switch {}", what, val, switchName); return val; } LOG.debug("Trying to get from system property {}", what, propName); val = System.getProperty(propName); if (val != null) { LOG.info("Using value from system property {}", what, val, propName); return val; } LOG.warn("Could not determine value for from notification command switch or system property {}", what, switchName, propName); return null; }</code><technical_language>approach is "old outdated" setups work. follow this well? Meaning, add - if is missing try</technical_language>

Target:
protected String getValueFromSwitchOrProp(String what, String switchName, String propName) { if (Strings.isNullOrEmpty(switchName)) { LOG.error("Switch name must not be null or empty"); return null; } if (!switchName.startsWith("-")) { LOG.warn("Specifying switch names (e.g. '{}') without a leading dash is deprecated. Please update your notification command definition to use '-{}' instead. See <LINK_0>", switchName, switchName); } LOG.debug("Trying to get from notification switch '{}'", what, switchName); if (hasSwitchName(switchName) && hasSwitchValue(switchName)) { final String val = getSwitchValue(switchName); LOG.info("Using value from notification switch {}", what, val, switchName); return val; } final String alternateSwitchName = switchName.startsWith("-") ? switchName.substring(1) : "-" + switchName; LOG.debug("Trying to get from notification switch '{}'", what, alternateSwitchName); if (hasSwitchValue(alternateSwitchName) && hasSwitchValue(alternateSwitchName)) { final String val = getSwitchValue(alternateSwitchName); LOG.info("Using value from notification switch '{}'", what, val, switchName); return val; } if (propName != null) { LOG.debug("Trying to get from system property '{}'", what, propName); final String val = System.getProperty(propName); if (val != null) { LOG.info("Using value from system property '{}'", what, val, propName); return val; } } LOG.warn("Could not determine value for from notification command switch '{}' or system property '{}'", what, switchName, propName); return null; }
Source:
<code><START> protected void requireOriginalContext(TreeReference forReference) throws AnalysisInvalidException{ <END> if (getOriginalContextRef() == null) { throw AnalysisInvalidException.INSTANCE; } }</code><technical_language>curious messages useful? _really_ hard understand kinds of analysis fail a binary check, I a negative lose context (even if require in circumstance)</technical_language>

Target:
protected void requireOriginalContext(TreeReference forReference) throws AnalysisInvalidException{ if (getOriginalContextRef() == null) { throw AnalysisInvalidException.INSTANCE_NO_ORIGINAL_CONTEXT_REF; } }
Source:
<code><START> public void start() throws IOException, UnavailableException, InterruptedException, KeeperException, BKException { <END> this.bookie.start(); if (!this.bookie.isRunning()) { exitCode = bookie.getExitCode(); return; } this.nettyServer.start(); running = true; deathWatcher = new DeathWatcher(conf); deathWatcher.start(); }</code><technical_language>remove KeeperException here</technical_language>

Target:
public void start() throws IOException, UnavailableException, InterruptedException, BKException { this.bookie.start(); if (!this.bookie.isRunning()) { exitCode = bookie.getExitCode(); return; } this.nettyServer.start(); running = true; deathWatcher = new DeathWatcher(conf); deathWatcher.start(); }
Source:
<code>private void updateFirewallTypeUponVersionChange(Version version) { ListModel<FirewallType> firewallType = getFirewallType(); <START> firewallType.setIsChangeable(version.greaterOrEquals(Version.v4_0)); <END> if (version.greater(Version.v4_2)) { firewallType.setSelectedItem(FirewallType.FIREWALLD); } else if (version.less(Version.v4_2)) { firewallType.setSelectedItem(FirewallType.IPTABLES); } }</code><technical_language>hardcode supported features version this. correct approach is a ConfigValue in a form "FirewallTypeSupported" a method similar to: AsyncDataProvider.isDestroyRebootSupported(version) If want this backend, common is FeatureSupported class</technical_language>

Target:
private void updateFirewallTypeUponVersionChange(Version version) { ListModel<FirewallType> firewallType = getFirewallType(); if (version.less(AsyncDataProvider.getInstance().multiFirewallSupportSince())) { firewallType.setIsChangeable(false); firewallType.setSelectedItem(FirewallType.IPTABLES); } else { firewallType.setIsChangeable(true); } }
Source:
<code>public void onMessage(CommandStatusReportFromDatanode report, EventPublisher publisher) { Preconditions.checkNotNull(report); List<CommandStatus> cmdStatusList = report.getReport().getCmdStatusList(); Preconditions.checkNotNull(cmdStatusList); LOGGER.trace("Processing command status report for dn: {}", report .getDatanodeDetails()); cmdStatusList.forEach(cmdStatus -> { LOGGER.trace("Emitting command status for id:{} type: {}", cmdStatus .getCmdId(), cmdStatus.getType()); switch (cmdStatus.getType()) { case deleteBlocksCommand: if (cmdStatus.getStatus() == CommandStatus.Status.EXECUTED) { publisher.fireEvent(SCMEvents.DELETE_BLOCK_STATUS, new DeleteBlockStatus(cmdStatus)); } break; case createPipelineCommand: if (cmdStatus.getStatus() != CommandStatus.Status.PENDING) { publisher.fireEvent(SCMEvents.CREATE_PIPELINE_STATUS, new CreatePipelineStatus(cmdStatus)); <START> } <END> break; default: LOGGER.warn("CommandStatus of type:{} not handled in " + "CommandStatusReportHandler.", cmdStatus.getType()); } }); }</code><technical_language>Do need a handler for destoryPipeline</technical_language>

Target:
public void onMessage(CommandStatusReportFromDatanode report, EventPublisher publisher) { Preconditions.checkNotNull(report); List<CommandStatus> cmdStatusList = report.getReport().getCmdStatusList(); Preconditions.checkNotNull(cmdStatusList); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Processing command status report for dn: {}", report .getDatanodeDetails()); } cmdStatusList.forEach(cmdStatus -> { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Emitting command status for id:{} type: {}", cmdStatus .getCmdId(), cmdStatus.getType()); } if (cmdStatus.getType() == SCMCommandProto.Type.deleteBlocksCommand) { if (cmdStatus.getStatus() == CommandStatus.Status.EXECUTED) { publisher.fireEvent(SCMEvents.DELETE_BLOCK_STATUS, new DeleteBlockStatus(cmdStatus)); } } else { LOGGER.debug("CommandStatus of type:{} not handled in " + "CommandStatusReportHandler.", cmdStatus.getType()); } }); }
Source:
<code>private PlanNodeCostEstimate calculateCumulativeCost(PlanNode node) { PlanNodeCostEstimate localCost = costCalculator.calculateCost(node, statsProvider, lookup, session, types); PlanNodeCostEstimate sourcesCost = sourceProvider.getSources(node).stream() .map(this::getCumulativeCost) .reduce(ZERO_COST, PlanNodeCostEstimate::add); PlanNodeCostEstimate cumulativeCost = node.accept(new CostCombiner(), new CostCombiner.Context(localCost, sourcesCost)); <START> verify(cumulativeCost != null); <END> return cumulativeCost; }</code><technical_language>add a message in case fails</technical_language>

Target:
private PlanCostEstimate calculateCumulativeCost(PlanNode node) { PlanNodeCostEstimate localCost = costCalculator.calculateCost(node, statsProvider, session, types); List<PlanCostEstimate> sourcesCosts = node.getSources().stream() .map(this::getPlanCost) .collect(toImmutableList()); MemoryEstimate memoryEstimate = node.accept(new PeakMemoryEstimator(), new EstimationContext(localCost.getMemoryCost(), sourcesCosts)); verify(memoryEstimate != null); PlanCostEstimate sourcesCost = sourcesCosts.stream() .reduce(PlanCostEstimate.zero(), CachingCostProvider::addSiblingsCost); return new PlanCostEstimate( localCost.getCpuCost() + sourcesCost.getCpuCost(), Math.max(sourcesCost.getMaxMemory(), Math.max(memoryEstimate.maxMemoryBeforeOutputting, memoryEstimate.maxMemoryWhenOutputting)), memoryEstimate.maxMemoryWhenOutputting, localCost.getNetworkCost() + sourcesCost.getNetworkCost()); }
Source:
<code>public void visitNode(Tree tree) { for (Tree member : ((ClassTree) tree).members()) { if (member.is(Kind.VARIABLE)) { VariableTreeImpl variableTree = (VariableTreeImpl) member; if (variableTree.modifiers().modifiers().contains(Modifier.STATIC)) { Tree variableType = variableTree.type(); VariableSymbol symbol = variableTree.getSymbol(); <START> if (variableType.is(Kind.ARRAY_TYPE) || <END> (variableType.is(Kind.PARAMETERIZED_TYPE) && symbol.getType().isSubtypeOf(COLLECTION_QUALIFIED_NAME)) || (variableType.is(Kind.IDENTIFIER) && (symbol.getType().is(DATE_QUALIFIER_NAME) || symbol.getType().isSubtypeOf(COLLECTION_QUALIFIED_NAME)))) { addIssue(variableTree, MESSAGE.replace("xxx", variableTree.simpleName().name())); } } } } }</code><technical_language>condition is complex is : this externalized in submethod understand sight is (this trigger issue dory anyway)</technical_language>

Target:
public void visitNode(Tree tree) { for (Tree member : ((ClassTree) tree).members()) { if (member.is(Kind.VARIABLE)) { VariableTreeImpl variableTree = (VariableTreeImpl) member; if (isStaticMember(variableTree) && isMutableMember(variableTree)) { addIssue(variableTree, MessageFormat.format("Move \"{0}\" to a class and lower its visibility", variableTree.simpleName().name())); } } } }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { <START> if (tuple == null || tuple.size() == 0) return false; <END> long ts = tuple.getValue(0).getTimestamp(); Cell emptyColumnKV = tuple.getValue(emptyCF, emptyCQ); if ((emptyColumnKV != null) && CellUtil.matchingColumn(emptyColumnKV, emptyCF, emptyCQ)) { ts = emptyColumnKV.getTimestamp(); } Date rowTimestamp = new Date(ts); ptr.set(PDate.INSTANCE.toBytes(rowTimestamp)); return true; }</code><technical_language>nit: braces move return next line</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (tuple == null || tuple.size() == 0) { return false; } byte[] emptyCF = ((KeyValueColumnExpression)children.get(0)).getColumnFamily(); byte[] emptyCQ = ((KeyValueColumnExpression)children.get(0)).getColumnQualifier(); long ts = tuple.getValue(0).getTimestamp(); Cell emptyColumnKV = tuple.getValue(emptyCF, emptyCQ); if ((emptyColumnKV != null) && CellUtil.matchingColumn(emptyColumnKV, emptyCF, emptyCQ)) { ts = emptyColumnKV.getTimestamp(); } Date rowTimestamp = new Date(ts); ptr.set(PDate.INSTANCE.toBytes(rowTimestamp)); return true; }
Source:
<code>protected static Map<String, String> createStructFromConnection(final StorageServerConnections connection, final StoragePool storagePool) { DefaultValueMap conParams = new DefaultValueMap(); conParams.put("id", connection.getid(), Guid.Empty.toString()); conParams.put("connection", connection.getconnection(), ""); switch (connection.getstorage_type()) { case ISCSI: conParams.put("portal", connection.getportal(), ""); conParams.put("port", connection.getport(), ""); conParams.put("iqn", connection.getiqn(), ""); conParams.put("user", connection.getuser_name(), ""); conParams.put("password", connection.getpassword(), ""); break; case NFS: if (storagePool == null || Config.<Boolean> GetValue(ConfigValues.AdvancedNFSOptionsEnabled, storagePool.getcompatibility_version().getValue())) { conParams.putIfNotEmpty("mnt_options", connection.getMountOptions()); <START> conParams.putIfNotEmpty("vfs_type", connection.getVfsType()); <END> if (connection.getNfsVersion() != null) { conParams.put("protocol_version", connection.getNfsVersion().getValue()); } conParams.putIfNotEmpty("timeout", connection.getNfsTimeo()); conParams.putIfNotEmpty("retrans", connection.getNfsRetrans()); } break; } return conParams; }</code><technical_language>something's right (seems exists in code patch too), mnt_options vfs_type relevant posix too</technical_language>

Target:
protected static Map<String, String> createStructFromConnection(final StorageServerConnections connection, final StoragePool storagePool) { DefaultValueMap conParams = new DefaultValueMap(); conParams.put("id", connection.getid(), Guid.Empty.toString()); conParams.put("connection", connection.getconnection(), ""); switch (connection.getstorage_type()) { case ISCSI: conParams.put("portal", connection.getportal(), ""); conParams.put("port", connection.getport(), ""); conParams.put("iqn", connection.getiqn(), ""); conParams.put("user", connection.getuser_name(), ""); conParams.put("password", connection.getpassword(), ""); break; case POSIXFS: conParams.putIfNotEmpty("mnt_options", connection.getMountOptions()); conParams.putIfNotEmpty("vfs_type", connection.getVfsType()); break; case NFS: if (storagePool == null || Config.<Boolean> getValue(ConfigValues.AdvancedNFSOptionsEnabled, storagePool.getcompatibility_version().getValue())) { if (connection.getNfsVersion() != null) { conParams.put("protocol_version", connection.getNfsVersion().getValue()); } conParams.putIfNotEmpty("timeout", connection.getNfsTimeo()); conParams.putIfNotEmpty("retrans", connection.getNfsRetrans()); } break; } return conParams; }
Source:
<code><START> public void removePath(String path) <END> { paths.remove(PathUtils.validatePath(path)); }</code><technical_language>return a String boolean confirm a path removed</technical_language>

Target:
public boolean removePath(String path) { return paths.remove(PathUtils.validatePath(path)); }
Source:
<code>private void setClasspaths(IProgressMonitor monitor) throws JavaModelException { <START> SubMonitor subMonitor = SubMonitor.convert(monitor, "", fProjectClasspaths.size()); END> Enumeration<IProject> keys = fProjectClasspaths.keys(); while (keys.hasMoreElements()) { IProject project = keys.nextElement(); IClasspathEntry[] classpath = fProjectClasspaths.get(project); subMonitor.subTask(project.getName()); JavaCore.create(project).setRawClasspath(classpath, subMonitor.newChild(1)); } }</code><technical_language>2-argument constructor</technical_language>

Target:
private void setClasspaths(IProgressMonitor monitor) throws JavaModelException { SubMonitor subMonitor = SubMonitor.convert(monitor, fProjectClasspaths.size()); Enumeration<IProject> keys = fProjectClasspaths.keys(); while (keys.hasMoreElements()) { IProject project = keys.nextElement(); IClasspathEntry[] classpath = fProjectClasspaths.get(project); subMonitor.subTask(project.getName()); JavaCore.create(project).setRawClasspath(classpath, subMonitor.newChild(1)); } }
Source:
<code>private KernelServices buildKernelServices(ModelTestControllerVersion controllerVersion, ModelVersion version, String... mavenResourceURLs) throws Exception { <START> String xmlName = String.format("eap-%s-transformer.xml", controllerVersion.getRealVersionName()); <END> String xml = readResource(xmlName); return this.buildKernelServices(xml, controllerVersion, version, mavenResourceURLs); }</code><technical_language>test fails is eap-7.0.0-transformer.xml eap-7.1.0-transformer.xml files. I understand @ctomc renamed io-${subsystem-version}-transformer.xml eap-${eap-version}-transformer.xml in PR :)</technical_language>

Target:
private KernelServices buildKernelServices(ModelTestControllerVersion controllerVersion, ModelVersion version, String... mavenResourceURLs) throws Exception { return this.buildKernelServices(this.getSubsystemXml(), controllerVersion, version, mavenResourceURLs); }
Source:
<code>public Comparator<Entry<?, ?>> resolve(KeyValueQuery<?> query) { if (query == null || query.getSort() == Sort.unsorted()) { return null; } Comparator hazelcastPropertyComparator = null; for (Order order : query.getSort()) { if (order.getProperty().indexOf('.') > -1) { throw new UnsupportedOperationException("Embedded fields not implemented: " + order); } if (order.isIgnoreCase()) { throw new UnsupportedOperationException("Ignore case not implemented: " + order); } if (NullHandling.NATIVE != order.getNullHandling()) { throw new UnsupportedOperationException("Null handling not implemented: " + order); } if (hazelcastPropertyComparator == null) { hazelcastPropertyComparator = new HazelcastPropertyComparator(order.getProperty(), order.isAscending()); } else { <START> hazelcastPropertyComparator.thenComparing(new HazelcastPropertyComparator(order.getProperty(), <END> order.isAscending())); } } return hazelcastPropertyComparator; }</code><technical_language>prepare a test case covers this? thenComparing method modify state of comparator returns a new instead making this line a dead code</technical_language>

Target:
public Comparator<Entry<?, ?>> resolve(KeyValueQuery<?> query) { if (query == null || query.getSort() == Sort.unsorted()) { return null; } Comparator hazelcastPropertyComparator = null; for (Order order : query.getSort()) { if (order.getProperty().indexOf('.') > -1) { throw new UnsupportedOperationException("Embedded fields not implemented: " + order); } if (order.isIgnoreCase()) { throw new UnsupportedOperationException("Ignore case not implemented: " + order); } if (NullHandling.NATIVE != order.getNullHandling()) { throw new UnsupportedOperationException("Null handling not implemented: " + order); } if (hazelcastPropertyComparator == null) { hazelcastPropertyComparator = new HazelcastPropertyComparator(order.getProperty(), order.isAscending()); } else { hazelcastPropertyComparator = hazelcastPropertyComparator.thenComparing( new HazelcastPropertyComparator(order.getProperty(), order.isAscending())); } } return hazelcastPropertyComparator; }
Source:
<code>private List<File> createFoundModules(final File pomFile) { try { List<File> result = new ArrayList<>(); if (log.isLoggable(Level.FINE)) { log.fine("Processing " + pomFile.getAbsolutePath() + " for classpath module resolution"); } Xpp3Dom dom = null; try (FileReader reader = new FileReader(pomFile)) { dom = Xpp3DomBuilder.build(reader); } Xpp3Dom modules = dom.getChild("modules"); if (modules != null) { for (Xpp3Dom module : modules.getChildren()) { result.add(new File(pomFile.getParent(), module.getValue())); } } if (result.isEmpty()) { Xpp3Dom parent = dom.getChild("parent"); if (parent != null) { Xpp3Dom relativePathNode = parent.getChild("relativePath"); if ( relativePathNode != null && !(relativePathNode.getValue() == null) ) { <START> String relativePath = (relativePathNode == null) ? "../pom.xml" : relativePathNode.getValue(); <END> File parentPom = pomFile.getParentFile().toPath().resolve(relativePath).toFile(); if (parentPom.isFile()) result = createFoundModules(parentPom); } } } return result; } catch (final Exception e) { throw new RuntimeException("Could not parse pom.xml: " + pomFile, e); } }</code><technical_language>relativePathNode null in</technical_language>

Target:
private List<File> createFoundModules(final File pomFile) { try { List<File> result = new ArrayList<>(); if (log.isLoggable(Level.FINE)) { log.fine("Processing " + pomFile.getAbsolutePath() + " for classpath module resolution"); } Xpp3Dom dom = null; try (FileReader reader = new FileReader(pomFile)) { dom = Xpp3DomBuilder.build(reader); } Xpp3Dom modules = dom.getChild("modules"); if (modules != null) { for (Xpp3Dom module : modules.getChildren()) { result.add(new File(pomFile.getParent(), module.getValue())); } } if (result.isEmpty()) { Xpp3Dom parent = dom.getChild("parent"); if (parent != null) { Xpp3Dom relativePathNode = parent.getChild("relativePath"); String relativePath = (relativePathNode == null) ? "../pom.xml" : relativePathNode.getValue(); if (relativePath != null) { File parentPom = pomFile.getParentFile().toPath().resolve(relativePath).toFile(); if (parentPom.isFile()) result = createFoundModules(parentPom); } } } return result; } catch (final Exception e) { throw new RuntimeException("Could not parse pom.xml: " + pomFile, e); } }
Source:
<code>protected void build(UnitVmModel model, VmBase vm) { vm.setMigrationSupport(model.getMigrationMode().getSelectedItem()); vm.setMigrationDowntime(model.getSelectedMigrationDowntime()); <START> if (model.getOverrideMigrationPolicy().getEntity()) { vm.setMigrationPolicyId(model.getMigrationPolicies().getSelectedItem().getId()); } else { vm.setMigrationPolicyId(null); } <END> }</code><technical_language>plese move this code UnitVmModel is case downtime getSelectedMigrationDowntime(). In case end getSelectedMigrationPolicy()</technical_language>

Target:
protected void build(UnitVmModel model, VmBase vm) { vm.setMigrationSupport(model.getMigrationMode().getSelectedItem()); vm.setMigrationDowntime(model.getSelectedMigrationDowntime()); vm.setMigrationPolicyId(model.getSelectedMigrationPolicy()); }
Source:
<code>public void sendMailBySendCloud(String toAddress, String title, String content, SendCloudType type) throws UnsupportedEncodingException { try { <START> if(SEND_MAIL_COUNT <= 0){ <END> return; } SEND_MAIL_COUNT --; Session mailSession = getMailSession(); SMTPTransport transport = null; transport = (SMTPTransport) mailSession.getTransport("smtp"); MimeMessage message = new MimeMessage(mailSession); message.setFrom(new InternetAddress(sendCloudFrom, "拓天速贷", "UTF-8")); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); message.setSubject(title, "UTF-8"); Multipart multipart = new MimeMultipart("alternative"); BodyPart contentPart = new MimeBodyPart(); contentPart.setHeader("Content-Type", "text/html;charset=UTF-8"); contentPart.setHeader("Content-Transfer-Encoding", "base64"); if (SendCloudType.TEXT.equals(type)) { contentPart.setText(content); } else { contentPart.setContent(content, "text/html;charset=UTF-8"); } multipart.addBodyPart(contentPart); message.setContent(multipart); transport.connect(); transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO)); transport.close(); }catch (MessagingException e){ logger.error(e.getLocalizedMessage(),e); this.sendMailBySendCloud(toAddress,title,content,type); } }</code><technical_language>SEND_MAIL_TRY_TIMES</technical_language>

Target:
public void sendMailBySendCloud(String toAddress, String title, String content, SendCloudType type) throws UnsupportedEncodingException { for (int i = 0; i < 3; i++) { try { Session mailSession = getMailSession(); SMTPTransport transport = null; transport = (SMTPTransport) mailSession.getTransport("smtp"); MimeMessage message = new MimeMessage(mailSession); message.setFrom(new InternetAddress(sendCloudFrom, "拓天速贷", "UTF-8")); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); message.setSubject(title, "UTF-8"); Multipart multipart = new MimeMultipart("alternative"); BodyPart contentPart = new MimeBodyPart(); contentPart.setHeader("Content-Type", "text/html;charset=UTF-8"); contentPart.setHeader("Content-Transfer-Encoding", "base64"); if (SendCloudType.TEXT.equals(type)) { contentPart.setText(content); } else { contentPart.setContent(content, "text/html;charset=UTF-8"); } multipart.addBodyPart(contentPart); message.setContent(multipart); transport.connect(); transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO)); transport.close(); break; } catch (MessagingException e) { logger.debug("send cloud is fail by" + e.getMessage()); } } }
Source:
<code>public void handleAction(Map<String, Object> parameters) throws IOException, ClassNotFoundException, ParserConfigurationException, SAXException { String templateName = (String) parameters.get(Constants.TEMPLATE_NAME_PARAM); String recipientName = (String) parameters.get(Constants.RECIPIENT_NAME_PARAM); CdaTemplate cdaTemplate = iheTemplateDataService.findByName(templateName); if (cdaTemplate == null) { LOGGER.error("Cannot find template", templateName); throw new TemplateNotFoundException(templateName); } HL7Recipient hl7Recipient = hl7RecipientsService.getRecipientbyName(recipientName); if (hl7Recipient == null) { LOGGER.error("Cannot find recipient", recipientName); throw new RecipientNotFoundException(templateName); } Byte[] templateData = (Byte[]) iheTemplateDataService.getDetachedField(cdaTemplate, TEMPLATE_DATA_FIELD_NAME); StreamingTemplateEngine streamingTemplateEngine = new StreamingTemplateEngine(); Template template = streamingTemplateEngine.createTemplate(new String(ArrayUtils.toPrimitive(templateData))); Writable writable = template.make(parameters); String result = writable.toString(); <START> Pattern regex = Pattern.compile("(?s)<!--.*?-->", Pattern.DOTALL); <END> Matcher regexMatcher = regex.matcher(result); result = regexMatcher.replaceAll(""); result.replaceAll("(?s)<!--.*?-->", ""); LOGGER.info("Template with name {}:\n{}", cdaTemplate.getTemplateName(), result); iheTemplateService.sendTemplateToRecipientUrl(hl7Recipient.getRecipientUrl(), result); }</code><technical_language>this a performance suicide large templates are? more sense handle this save</technical_language>

Target:
public void handleAction(Map<String, Object> parameters) throws IOException, ClassNotFoundException, ParserConfigurationException, SAXException { String templateName = (String) parameters.get(Constants.TEMPLATE_NAME_PARAM); String recipientName = (String) parameters.get(Constants.RECIPIENT_NAME_PARAM); CdaTemplate cdaTemplate = iheTemplateDataService.findByName(templateName); if (cdaTemplate == null) { LOGGER.error("Cannot find template", templateName); throw new TemplateNotFoundException(templateName); } HL7Recipient hl7Recipient = hl7RecipientsService.getRecipientbyName(recipientName); if (hl7Recipient == null) { LOGGER.error("Cannot find recipient", recipientName); throw new RecipientNotFoundException(templateName); } Byte[] templateData = (Byte[]) iheTemplateDataService.getDetachedField(cdaTemplate, TEMPLATE_DATA_FIELD_NAME); StreamingTemplateEngine streamingTemplateEngine = new StreamingTemplateEngine(); Template template = streamingTemplateEngine.createTemplate(new String(ArrayUtils.toPrimitive(templateData))); Writable writable = template.make(parameters); LOGGER.info("Template with name {}:\n{}", cdaTemplate.getTemplateName(), writable.toString()); iheTemplateService.sendTemplateToRecipientUrl(hl7Recipient.getRecipientUrl(), writable.toString()); }
Source:
<code>private void processPendingPartitions() { final List<PendingPartition> pendingCopy; final int size; synchronized (pendingPartitions) { pendingCopy = new ArrayList<>(pendingPartitions); size = pendingSize; pendingPartitions.clear(); pendingSize = 0; pendingPartitions.notifyAll(); } if (partitions != null) { <START> synchronized (partitions) { <END> final StringBuilder addedContent = new StringBuilder(size); IOConsolePartition lastPartition = getPartitionByIndex(partitions.size() - 1); int nextOffset = document.getLength(); for (PendingPartition pendingPartition : pendingCopy) { if (lastPartition == null || lastPartition.getOutputStream() != pendingPartition.stream) { lastPartition = new IOConsolePartition(nextOffset, pendingPartition.stream); partitions.add(lastPartition); } final int pendingLength = pendingPartition.text.length(); lastPartition.setLength(lastPartition.getLength() + pendingLength); nextOffset += pendingLength; addedContent.append(pendingPartition.text); } try { updateType = DocUpdateType.OUTPUT; document.replace(document.getLength(), 0, addedContent.toString()); } catch (BadLocationException e) { log(e); } } } checkBufferSize(); checkFinished(); }</code><technical_language>check synchronized block do match. If assume partitions null (and in MT environment), sync right null check set null get NPE</technical_language>

Target:
private void processPendingPartitions() { final List<PendingPartition> pendingCopy; final int size; synchronized (pendingPartitions) { pendingCopy = new ArrayList<>(pendingPartitions); size = pendingSize; pendingPartitions.clear(); pendingSize = 0; pendingPartitions.notifyAll(); } synchronized (partitions) { final StringBuilder addedContent = new StringBuilder(size); IOConsolePartition lastPartition = getPartitionByIndex(partitions.size() - 1); int nextOffset = document.getLength(); for (PendingPartition pendingPartition : pendingCopy) { if (lastPartition == null || lastPartition.getOutputStream() != pendingPartition.stream) { lastPartition = new IOConsolePartition(nextOffset, pendingPartition.stream); partitions.add(lastPartition); } final int pendingLength = pendingPartition.text.length(); lastPartition.setLength(lastPartition.getLength() + pendingLength); nextOffset += pendingLength; addedContent.append(pendingPartition.text); } try { updateType = DocUpdateType.OUTPUT; document.replace(document.getLength(), 0, addedContent.toString()); } catch (BadLocationException e) { log(e); } } checkBufferSize(); checkFinished(); }
Source:
<code>String[] getColumnValues(final ObservationUnitRow row, final List<MeasurementVariable> subObservationSetColumns) { final List<String> values = new LinkedList<>(); for (final MeasurementVariable column : subObservationSetColumns) { if (row.getEnvironmentVariables().containsKey(column.getName()) && ( column.getVariableType().getId() == VariableType.ENVIRONMENT_DETAIL.getId() <START> || column.getVariableType().getId() == VariableType.STUDY_CONDITION.getId())) { <END> values.add(row.getEnvironmentVariables().get(column.getName()).getValue()); } else { values.add(row.getVariables().get(column.getName()).getValue()); } } return values.toArray(new String[] {}); }</code><technical_language>Create static list of variable types for readability</technical_language>

Target:
String[] getColumnValues(final ObservationUnitRow row, final List<MeasurementVariable> subObservationSetColumns) { final List<String> values = new LinkedList<>(); for (final MeasurementVariable column : subObservationSetColumns) { if (row.getEnvironmentVariables().containsKey(column.getName()) && ENVIRONMENT_VARIABLES_VARIABLE_TYPES .contains(column.getVariableType())) { values.add(row.getEnvironmentVariables().get(column.getName()).getValue()); } else { values.add(row.getVariables().get(column.getName()).getValue()); } } return values.toArray(new String[] {}); }
Source:
<code>public static String getResourceOnClasspath(ClassLoader classLoader, String path) { return CACHE.computeIfAbsent(classLoader, x -> Collections.synchronizedMap(new HashMap<>())) <START> .computeIfAbsent(path, x -> readResource(classLoader, path)); <END> }</code><technical_language>a ConcurrentHashMap instead of synchronized map</technical_language>

Target:
public static String getResourceOnClasspath(ClassLoader classLoader, String path) { return CACHE.computeIfAbsent(classLoader, x -> new ConcurrentHashMap<>()) .computeIfAbsent(path, x -> readResource(classLoader, path)); }
Source:
<code>public ClusterFeatures list() { ClusterFeatures features = new ClusterFeatures(); Set<AdditionalFeature> addlFeatures = BackendClusterFeatureHelper.getClusterFeatures(this, version); addlFeatures.forEach(clusterFeature -> { org.ovirt.engine.api.model.ClusterFeature feature = <START> addLinks(ClusterFeaturesMapper.map(clusterFeature, <END> null)); features.getClusterFeatures().add(feature); }); return features; }</code><technical_language>"map" here, is defined in base class</technical_language>

Target:
public ClusterFeatures list() { ClusterFeatures features = new ClusterFeatures(); Set<AdditionalFeature> addlFeatures = BackendClusterFeatureHelper.getClusterFeatures(this, version); addlFeatures.forEach(clusterFeature -> { org.ovirt.engine.api.model.ClusterFeature feature = addLinks(map(clusterFeature, null)); features.getClusterFeatures().add(feature); }); return features; }
Source:
<code>public ServerContext(Map<String, Object> serverConfig) { this.serverConfig = serverConfig; this.dataStore = new DataStore(serverConfig, this::dataStoreFileCleanup); if (serverConfig.get("--node-id") != null) { UUID serverId = UuidUtils.fromBase64(getServerConfig(String.class, "--node-id")); generateNodeId(serverId); } else { <START> generateNodeId(); <END> } this.failureHandlerPolicy = new ConservativeFailureHandlerPolicy(); final boolean providedEventLoops = getChannelImplementation().equals(ChannelImplementation.LOCAL); if (providedEventLoops) { clientGroup = getServerConfig(EventLoopGroup.class, "client"); workerGroup = getServerConfig(EventLoopGroup.class, "worker"); bossGroup = getServerConfig(EventLoopGroup.class, "boss"); } else { clientGroup = getNewClientGroup(); workerGroup = getNewWorkerGroup(); bossGroup = getNewBossGroup(); } nodeLocator = NodeLocator .parseString(serverConfig.get("--address") + ":" + serverConfig.get("<port>")); localEndpoint = nodeLocator.toEndpointUrl(); if (!isMetricsReportingSetUp(metrics)) { MetricsUtils.metricsReportingSetup(metrics); } }</code><technical_language>put if condition generateNodeId() function</technical_language>

Target:
public ServerContext(Map<String, Object> serverConfig) { this.serverConfig = serverConfig; this.dataStore = new DataStore(serverConfig, this::dataStoreFileCleanup); generateNodeId(); this.failureHandlerPolicy = new ConservativeFailureHandlerPolicy(); final boolean providedEventLoops = getChannelImplementation().equals(ChannelImplementation.LOCAL); if (providedEventLoops) { clientGroup = getServerConfig(EventLoopGroup.class, "client"); workerGroup = getServerConfig(EventLoopGroup.class, "worker"); bossGroup = getServerConfig(EventLoopGroup.class, "boss"); } else { clientGroup = getNewClientGroup(); workerGroup = getNewWorkerGroup(); bossGroup = getNewBossGroup(); } nodeLocator = NodeLocator .parseString(serverConfig.get("--address") + ":" + serverConfig.get("<port>")); localEndpoint = nodeLocator.toEndpointUrl(); if (!isMetricsReportingSetUp(metrics)) { MetricsUtils.metricsReportingSetup(metrics); } }
Source:
<code>protected void run(final String[] argv) { try { if (!installConsole()) { AwtAuthenticator.install(); AwtCredentialsProvider.install(); } configureHttpProxy(); execute(argv); } catch (Die err) { System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } catch (Exception err) { if (!showStackTrace && err.getCause() != null && err instanceof TransportException) System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage())); if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } err.printStackTrace(); System.exit(1); } if (System.out.checkError()) { <START> System.err.println("An unknown I/O error occurs on stdout"); <END> System.exit(1); } if (System.err.checkError()) { System.exit(1); } }</code><technical_language>s/occurs/occurred/. this a translated string in CLIText</technical_language>

Target:
protected void run(final String[] argv) { try { if (!installConsole()) { AwtAuthenticator.install(); AwtCredentialsProvider.install(); } configureHttpProxy(); execute(argv); } catch (Die err) { System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } catch (Exception err) { if (!showStackTrace && err.getCause() != null && err instanceof TransportException) System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage())); if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } err.printStackTrace(); System.exit(1); } if (System.out.checkError()) { System.err.println(CLIText.get().unknownIoErrorStdout); System.exit(1); } if (System.err.checkError()) { System.exit(1); } }