auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); String result = null; switch (requestCode) { case BARCODE_CAPTURE: if (resultCode == Activity.RESULT_OK) { lastInstallMode = INSTALL_MODE_BARCODE; result = data.getStringExtra("SCAN_RESULT"); } break; case OFFLINE_INSTALL: <START> if (resultCode == Activity.RESULT_OK) { <END> lastInstallMode = INSTALL_MODE_OFFLINE; result = data.getStringExtra(InstallArchiveActivity.ARCHIVE_JR_REFERENCE); } break; case GET_APPS_FROM_HQ: if (resultCode == Activity.RESULT_OK) { lastInstallMode = INSTALL_MODE_FROM_LIST; result = data.getStringExtra(InstallFromListActivity.PROFILE_REF); } break; case MULTIPLE_APPS_LIMIT: setResult(RESULT_CANCELED); finish(); return; } if (result == null) { return; } if (lastInstallMode == INSTALL_MODE_FROM_LIST) { GoogleAnalyticsUtils.reportFeatureUsage(GoogleAnalyticsFields.ACTION_INSTALL_FROM_LIST); } setReadyToInstall(result); }</code><technical_language>This output is _quite_ helpful in,</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); String result = null; switch (requestCode) { case BARCODE_CAPTURE: if (resultCode == Activity.RESULT_OK) { lastInstallMode = INSTALL_MODE_BARCODE; result = data.getStringExtra("SCAN_RESULT"); Log.i(TAG, "Got url from barcode scanner: " + result); } break; case OFFLINE_INSTALL: if (resultCode == Activity.RESULT_OK) { lastInstallMode = INSTALL_MODE_OFFLINE; result = data.getStringExtra(InstallArchiveActivity.ARCHIVE_JR_REFERENCE); } break; case GET_APPS_FROM_HQ: if (resultCode == Activity.RESULT_OK) { lastInstallMode = INSTALL_MODE_FROM_LIST; result = data.getStringExtra(InstallFromListActivity.PROFILE_REF); } break; case MULTIPLE_APPS_LIMIT: setResult(RESULT_CANCELED); finish(); return; } if (result == null) { return; } if (lastInstallMode == INSTALL_MODE_FROM_LIST) { FirebaseAnalyticsUtil.reportFeatureUsage(AnalyticsParamValue.FEATURE_INSTALL_FROM_LIST); } setReadyToInstall(result); }
Source:
<code><START> public CppCharStream(JavaccTokenDocument document) { <END> super(document); }</code><technical_language>internalize *CharStream impls master,</technical_language>

Target:
CppCharStream(JavaccTokenDocument document) { super(document); }
Source:
<code>public void sendSync(long userId, Event event, Position position) { final User user = Context.getPermissionsManager().getUser(userId); if (user.getAttributes().containsKey("notificationTokens")) { Message message = new Message(); message.tokens = user.getString("notificationTokens").split("[, ]"); message.data = NotificationFormatter.buildData(userId, event, position); String body = NotificationFormatter.formatShortMessage(userId, event, position).trim(); if (isFormatDataOnly) { <START> message.data.put("body", body); <END> } else { Notification notification = new Notification(); notification.body = body; message.notification = notification; } ClientBuilder.newClient().target(URL).request() .header("Authorization", "key=" + key) .async().post(Entity.json(message), new InvocationCallback<Object>() { @Override public void completed(Object o) { LOGGER.info("Firebase notification sent to user: {}", userId); } @Override public void failed(Throwable throwable) { LOGGER.warn("Firebase notification error", throwable); } }); } }</code><technical_language>do need send formatted data? I a good idea</technical_language>

Target:
public void sendSync(long userId, Event event, Position position) { final User user = Context.getPermissionsManager().getUser(userId); if (user.getAttributes().containsKey("notificationTokens")) { Message message = new Message(); message.tokens = user.getString("notificationTokens").split("[, ]"); message.data = NotificationFormatter.buildData(userId, event, position); String body = NotificationFormatter.formatShortMessage(userId, event, position).trim(); if (formatDataOnly) { message.data.put("body", body); } else { Notification notification = new Notification(); notification.body = body; message.notification = notification; } client.target(URL).request() .header("Authorization", "key=" + key) .async().post(Entity.json(message), new InvocationCallback<Object>() { @Override public void completed(Object o) { LOGGER.debug("Firebase notification sent to user: {}", userId); } @Override public void failed(Throwable throwable) { LOGGER.warn("Firebase notification error", throwable); } }); } }
Source:
<code><START> public JSONObject convertEntityIdValueToJson(EntityIdValue value){ <END> JSONObject result = new JSONObject(); JSONObject valueResult = new JSONObject(); result.put(KEY_TYP, "wikibase-entityid"); switch (value.getEntityType()) { case EntityIdValue.ET_ITEM: valueResult = visit((ItemIdValue) value); break; case EntityIdValue.ET_PROPERTY: valueResult = visit((PropertyIdValue) value); break; default: throw new JSONException("Unknown EntityType: " + value.getEntityType()); } result.put(KEY_VALUE, valueResult); return result; }</code><technical_language>Helper methods part of interface public. In general, is a good idea public (because public methods part of public API others rely on, for provide compatibility in future)</technical_language>

Target:
JSONObject convertEntityIdValueToJson(EntityIdValue value) { JSONObject result = new JSONObject(); JSONObject valueResult = new JSONObject(); result.put(KEY_TYPE, "wikibase-entityid"); switch (value.getEntityType()) { case EntityIdValue.ET_ITEM: valueResult = visit((ItemIdValue) value); break; case EntityIdValue.ET_PROPERTY: valueResult = visit((PropertyIdValue) value); break; default: throw new JSONException("Unknown EntityType: " + value.getEntityType()); } result.put(KEY_VALUE, valueResult); return result; }
Source:
<code>public void plus_binary_expression() throws Exception { execute("x = a + b"); assertSingleValueInStackWithConstraint(Constraint.NUMBER.or(Constraint.STRING)); execute("x = a + 'str'"); assertSingleValueInStackWithConstraint(Constraint.STRING); execute("x = a + 1"); <START> assertSingleValueInStackWithConstraint(Constraint.NUMBER); <END> execute("x = 'str' + 1"); assertSingleValueInStackWithConstraint(Constraint.STRING); execute("x = 'str' + true"); assertSingleValueInStackWithConstraint(Constraint.STRING); execute("x = a + true"); assertSingleValueInStackWithConstraint(Constraint.NUMBER); }</code><technical_language>@vilchik-elena This is wrong a is a string</technical_language>

Target:
public void plus_binary_expression() throws Exception { Constraint numberOrString = Constraint.NUMBER.or(Constraint.STRING); execute("x = a + b"); assertSingleValueInStackWithConstraint(numberOrString); execute("x = a + 'str'"); assertSingleValueInStackWithConstraint(Constraint.STRING); execute("x = a + 1"); assertSingleValueInStackWithConstraint(numberOrString); execute("x = 'str' + 1"); assertSingleValueInStackWithConstraint(Constraint.STRING); execute("x = 'str' + true"); assertSingleValueInStackWithConstraint(Constraint.STRING); execute("x = a + true"); assertSingleValueInStackWithConstraint(numberOrString); }
Source:
<code><START> protected void ExecuteVdsBrokerCommand() { <END> List<String> vmIds = ((FullListVDSCommandParameters) getParameters()).getVmIds(); String[] vmIdsArray = vmIds.toArray(new String[vmIds.size()]); fullVmListReturn = getBroker().list("true", vmIdsArray); ProceedProxyReturnValue(); XmlRpcStruct[] struct = fullVmListReturn.mVmList; setReturnValue(struct); }</code><technical_language>applied changing class signature, this casting avoided. Update done in VdsUpdateRunTimeInfo.getVmInfo creating command instance</technical_language>

Target:
protected void ExecuteVdsBrokerCommand() { List<String> vmIds = getParameters().getVmIds(); String[] vmIdsArray = vmIds.toArray(new String[vmIds.size()]); fullVmListReturn = getBroker().list(Boolean.TRUE.toString(), vmIdsArray); ProceedProxyReturnValue(); XmlRpcStruct[] struct = fullVmListReturn.mVmList; setReturnValue(struct); }
Source:
<code>public void start() { super.start(); if (apiKey == null) { throw new IllegalStateException("apiKey required"); } <START> client = new Client(apiKey); <END> }</code><technical_language>Hi, I currently evaluating exception aggregation tools bugsnag promising for needs. Especially a logback extension, is I pull request. this line consider making initialization of UncaughtExceptionHandler, is implicitly done constructor, configurable. In use-case for example I running a centralised logging server is reading log events sockets writing files exception aggregation tool. In this context a global exception handler wanted/needed</technical_language>

Target:
public void start() { super.start(); if (installHandler && Thread.getDefaultUncaughtExceptionHandler() == null) { Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { System.err.printf("Exception in thread \"%s\" ", t.getName()); e.printStackTrace(System.err); } }); } client = new Client(apiKey, installHandler); client.setReleaseStage(releaseStage); client.setUseSSL(true); }
Source:
<code>UndeleteOperationTracker(RouterConfig routerConfig, PartitionId partitionId, String originatingDcName) { super(routerConfig, RouterOperation.UndeleteOperation, partitionId, originatingDcName, false); List<? extends ReplicaId> replicas = partitionId.getReplicaIds(); for (ReplicaId replica : replicas) { String dcName = replica.getDataNodeId().getDatacenterName(); numReplicasInDcs.put(dcName, numReplicasInDcs.getOrDefault(dcName, 0) + 1); } Map<String, Integer> numEligibleReplicasInDcs = new HashMap<>(); for (ReplicaId replica : replicaPool) { String dcName = replica.getDataNodeId().getDatacenterName(); numEligibleReplicasInDcs.put(dcName, numEligibleReplicasInDcs.getOrDefault(dcName, 0) + 1); } if (!hasReachedGlobalQuorum(numReplicasInDcs, numEligibleReplicasInDcs)) { throw new IllegalArgumentException( "Eligible replicas are not sufficient for undelete operation for partition " + partitionId); } for (String dcName : numReplicasInDcs.keySet()) { int totalNum = numReplicasInDcs.get(dcName); if (numEligibleReplicasInDcs.containsKey(dcName)) { int eligibleNum = numEligibleReplicasInDcs.get(dcName); <START> if (eligibleNum != totalNum) { <END> numFailureInDcs.put(dcName, totalNum - eligibleNum); } } } }</code><technical_language>Is this if required? removed</technical_language>

Target:
UndeleteOperationTracker(RouterConfig routerConfig, PartitionId partitionId, String originatingDcName) { super(routerConfig, RouterOperation.UndeleteOperation, partitionId, originatingDcName, false); List<? extends ReplicaId> replicas = partitionId.getReplicaIds(); for (ReplicaId replica : replicas) { String dcName = replica.getDataNodeId().getDatacenterName(); numReplicasInDcs.put(dcName, numReplicasInDcs.getOrDefault(dcName, 0) + 1); } Map<String, Integer> numEligibleReplicasInDcs = new HashMap<>(); for (ReplicaId replica : replicaPool) { String dcName = replica.getDataNodeId().getDatacenterName(); numEligibleReplicasInDcs.put(dcName, numEligibleReplicasInDcs.getOrDefault(dcName, 0) + 1); } if (!hasReachedGlobalQuorum(numReplicasInDcs, numEligibleReplicasInDcs)) { throw new IllegalArgumentException( "Eligible replicas are not sufficient for undelete operation for partition " + partitionId); } for (String dcName : numReplicasInDcs.keySet()) { int totalNum = numReplicasInDcs.get(dcName); int eligibleNum = numEligibleReplicasInDcs.getOrDefault(dcName, 0); numFailureInDcs.put(dcName, totalNum - eligibleNum); } }
Source:
<code>public final Date getExtendedExpiresOn() { <START> return this.mExtendedExpiresOn; <END> }</code><technical_language>this [](start = 15, length = 4) this. please</technical_language>

Target:
public final Date getExtendedExpiresOn() { return mExtendedExpiresOn; }
Source:
<code>public void setConf(Configuration conf) { <START> this.conf = conf; <END> }</code><technical_language>This throw IllegalArgumentException if is provided a conf object is of type StatefulMongoDBRdfConfiguration code work if is case. Throwing exception easier hunt bug</technical_language>

Target:
public void setConf(Configuration conf) { Preconditions.checkNotNull(conf); Preconditions.checkArgument(conf instanceof StatefulMongoDBRdfConfiguration, "Expected an instance of %s; received %s", StatefulMongoDBRdfConfiguration.class.getName(), conf.getClass().getName()); this.conf = (StatefulMongoDBRdfConfiguration) conf; }
Source:
<code>private void logContext(RelationshipOp operation, Environment environment) { List<Field> children = environment.field.getSelectionSet() != null ? (List) environment.field.getSelectionSet().getChildren() : new ArrayList<>(); String requestedFields = environment.field.getName() + (children.size() > 0 ? "(" + children.stream().map(Field::getName).collect(Collectors.toList()) + ")" : ""); GraphQLType parent = environment.parentType; <START> log.debug("{} fields for with parent {}<{}>", <END> operation, requestedFields, environment.source, parent.getClass().getSimpleName(), parent.getName()); }</code><technical_language>need log source, parent details. thing</technical_language>

Target:
private void logContext(RelationshipOp operation, Environment environment) { List<Field> children = environment.field.getSelectionSet() != null ? (List) environment.field.getSelectionSet().getChildren() : new ArrayList<>(); String requestedFields = environment.field.getName() + (children.size() > 0 ? "(" + children.stream().map(Field::getName).collect(Collectors.toList()) + ")" : ""); GraphQLType parent = environment.parentType; log.debug("{} fields with parent {}<{}>", operation, requestedFields, parent.getClass().getSimpleName(), parent.getName()); }
Source:
<code>private boolean checkEventType(EventMessage event) { <START> boolean result = <END> (eventTypeUrl == null) || event.typeUrl() .equals(eventTypeUrl); return result; }</code><technical_language>reverse part: boolean result = (eventTypeUrl == null) || eventTypeUrl.equals(event.typeUrl());</technical_language>

Target:
private boolean checkEventType(EventMessage event) { boolean result = (eventTypeUrl == null) || eventTypeUrl.equals(event.typeUrl()); return result; }
Source:
<code><START> public boolean isAlphabeticallySortActive() { <END> return alphabeticallySort; }</code><technical_language>need public</technical_language>

Target:
private boolean isAlphabeticallySortActive() { return alphabeticallySort; }
Source:
<code>public static File findLatestAndroidPlatformFolder(File platformsFolder) { File[] platformVersions = platformsFolder.listFiles(new FileFilter() { @Override public boolean accept(File file) { <START> return file.getName().matches("android-\\d+$"); <END> } }); if (platformVersions == null || platformVersions.length == 0) { throw new SelendroidException("No valid Android platform folder found in " + platformsFolder.getName()); } Arrays.sort( platformVersions, new Comparator<File>() { @Override public int compare(File f1, File f2) { int v1 = Integer.parseInt(f1.getName().split("-")[1]); int v2 = Integer.parseInt(f2.getName().split("-")[1]); return Integer.compare(v1, v2); } }); return platformVersions[platformVersions.length - 1].getAbsoluteFile(); }</code><technical_language>inclination this regular expression a local variable, add a capture group for integer, reuse lines 142 get version. Relying a regular expression split create problems in future if updates this in place</technical_language>

Target:
public static File findLatestAndroidPlatformFolder(File platformsFolder) { File[] platformVersions = platformsFolder.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().matches(PLATFORM_VERSION_REGEX); } }); if (platformVersions == null || platformVersions.length == 0) { throw new SelendroidException("No valid Android platform folder found in " + platformsFolder.getName()); } Pattern pattern = Pattern.compile(PLATFORM_VERSION_REGEX); Arrays.sort( platformVersions, new Comparator<File>() { @Override public int compare(File f1, File f2) { Matcher m1 = pattern.matcher(f1.getName()); Matcher m2 = pattern.matcher(f2.getName()); m1.find(); m2.find(); return Integer.compare( Integer.parseInt(m1.group(1)), Integer.parseInt(m2.group(1))); } }); return platformVersions[platformVersions.length - 1].getAbsoluteFile(); }
Source:
<code>public void onCreate() { JDBCConfiguration jdbcConfiguration = asJDBCConfiguration(configurationService.getConfiguration()); validate(jdbcConfiguration); <START> if (dataSource == null) { <END> dataSource = new BasicDataSource(); dataSource.setDriverClassName(jdbcConfiguration.getDriver()); dataSource.setUrl(jdbcConfiguration.getJdbcUrl()); dataSource.setUsername(jdbcConfiguration.getUsername()); dataSource.setPassword(jdbcConfiguration.getPassword()); dataSource.setMinIdle(5); dataSource.setMaxIdle(10); dataSource.setMaxOpenPreparedStatements(100); } }</code><technical_language>onCreate() is called time start null. If onCreate called time bug fixed. end if is redundant</technical_language>

Target:
public void onCreate() { try { JDBCConfiguration jdbcConfiguration = asJDBCConfiguration(configurationService.getConfiguration()); validate(jdbcConfiguration); dataSource = new BasicDataSource(); dataSource.setDriverClassName(jdbcConfiguration.getDriver()); dataSource.setUrl(jdbcConfiguration.getJdbcUrl()); dataSource.setUsername(jdbcConfiguration.getUsername()); dataSource.setPassword(jdbcConfiguration.getPassword()); dataSource.setMinIdle(5); dataSource.setMaxIdle(10); dataSource.setMaxOpenPreparedStatements(100); } catch (Exception e) { LOG.error("Error in creating jdbc connection.", e); throw new RuntimeException(e); } }
Source:
<code>private void verify(MatchableInvocation wanted, List<Invocation> invocations) { if (invocations.isEmpty()) { return; } try { Location location = invocations.get(0).getLocation(); Field stackTraceHolderField = getStackTraceHolderField(location); <START> for (Invocation invocation : invocations) { <END> if (wanted.matches(invocation) && getStackTraceElements(stackTraceHolderField, invocation) .noneMatch(this::isDoPrivilegedCall)) { throw new MockitoAssertionError(wanted + " not called in a doPrivileged block"); } } } catch (NoSuchFieldException | IllegalAccessException e) { throw new MockitoAssertionError( "Failed to verify that " + wanted + " was called in a doPrivileged block, most likely because Mockito's" + " internal implementation has changed."); } }</code><technical_language>This is extremely pedantic, java invocations .stream() .filter() read a cleaner me. want extract catch clause a named function, argue improves readability</technical_language>

Target:
private void verify(MatchableInvocation wanted, List<Invocation> invocations) { if (invocations.isEmpty()) { return; } Location location = invocations.get(0).getLocation(); Field stackTraceHolderField = getStackTraceHolderField(wanted, location); if (invocations .stream() .filter(wanted::matches) .flatMap(i -> getStackTraceElements(stackTraceHolderField, wanted, i)) .noneMatch(this::isDoPrivilegedCall)) { throw new MockitoAssertionError(wanted + " not called in a doPrivileged block"); } }
Source:
<code>public static Expression toPredicate(TupleDomain<Symbol> tupleDomain) { if (tupleDomain.isNone()) { return FALSE_LITERAL; } Map<Symbol, Domain> domains = tupleDomain.getDomains().get(); return domains.keySet().stream() .sorted(comparing(Symbol::getName)) .map(symbol -> toPredicate(domains.get(symbol), symbol.toSymbolReference())) <START> .collect(combineConjuncts()); <END> }</code><technical_language>DomainTranslator#toPredicate deterministic sufficient sort tupleDomain.getDomains().get().entrySet() [.stream()]</technical_language>

Target:
public static Expression toPredicate(TupleDomain<Symbol> tupleDomain) { if (tupleDomain.isNone()) { return FALSE_LITERAL; } Map<Symbol, Domain> domains = tupleDomain.getDomains().get(); return domains.entrySet().stream() .sorted(comparing(entry -> entry.getKey().getName())) .map(entry -> toPredicate(entry.getValue(), entry.getKey().toSymbolReference())) .collect(collectingAndThen(toImmutableList(), ExpressionUtils::combineConjuncts)); }
Source:
<code>private void run(CommandInterpreter interpreter) { String groovyScriptFile = interpreter.nextArgument(); if (groovyScriptFile == null || groovyScriptFile.length() == 0) { interpreter.println(getHelp()); return; } try { final String script = Files.lines(Paths.get(groovyScriptFile)).collect(Collectors.joining(System.getProperty("line.separator"))); <START> final ClassLoader classLoader = ApplicationContext.getServiceForClass(ExtensionBasedRepositoryClassLoaderProviderRegistry.class).getClassLoader(); <END> ScriptEngine.run("groovy", classLoader, script, Collections.emptyMap()); } catch (Exception e) { interpreter.printStackTrace(e); } }</code><technical_language>This throw a NPE, interface fix it</technical_language>

Target:
private void run(CommandInterpreter interpreter) { String groovyScriptFile = interpreter.nextArgument(); if (groovyScriptFile == null || groovyScriptFile.length() == 0) { interpreter.println(getHelp()); return; } try { final String script = Files.lines(Paths.get(groovyScriptFile)).collect(Collectors.joining(System.getProperty("line.separator"))); final ClassLoader classLoader = ApplicationContext.getServiceForClass(RepositoryClassLoaderProviderRegistry.class).getClassLoader(); ScriptEngine.run("groovy", classLoader, script, Collections.emptyMap()); } catch (Exception e) { interpreter.printStackTrace(e); } }
Source:
<code>private void performRename(RenameRefactoringSession session) { final LinkedRenameRefactoringApply dto = createLinkedRenameRefactoringApplyDto(newName, session.getSessionId()); Promise<RefactoringResult> applyModelPromise = refactoringServiceClient.applyLinkedModeRename(dto); applyModelPromise.then(new Operation<RefactoringResult>() { @Override public void apply(RefactoringResult result) throws OperationException { switch (result.getSeverity()) { case OK: case INFO: RefactorInfo refactorInfo = RefactorInfo.of(RefactoredItemType.JAVA_ELEMENT, null); refactoringUpdater.updateAfterRefactoring(refactorInfo, result.getChanges()); refactoringServiceClient.reindexProject(textEditor.getDocument().getFile().getProject().getProjectConfig().getPath()); break; case WARNING: case ERROR: enableAutoSave(); undoChanges(); showWarningDialog(); break; case FATAL: undoChanges(); notificationManager.notify(locale.failedToRename(), result.getEntries().get(0).getMessage(), FAIL, FLOAT_MODE); break; default: break; } <START> } <END> }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { enableAutoSave(); undoChanges(); notificationManager.notify(locale.failedToRename(), arg.getMessage(), FAIL, FLOAT_MODE); } }); }</code><technical_language>} moved</technical_language>

Target:
private void performRename(RenameRefactoringSession session) { final LinkedRenameRefactoringApply dto = createLinkedRenameRefactoringApplyDto(newName, session.getSessionId()); Promise<RefactoringResult> applyModelPromise = refactoringServiceClient.applyLinkedModeRename(dto); applyModelPromise.then(new Operation<RefactoringResult>() { @Override public void apply(RefactoringResult result) throws OperationException { switch (result.getSeverity()) { case OK: case INFO: RefactorInfo refactorInfo = RefactorInfo.of(RefactoredItemType.JAVA_ELEMENT, null); refactoringUpdater.updateAfterRefactoring(refactorInfo, result.getChanges()); String projectPath = textEditor.getDocument().getFile().getProject().getProjectConfig().getPath(); refactoringServiceClient.reindexProject(projectPath); break; case WARNING: case ERROR: enableAutoSave(); undoChanges(); showWarningDialog(); break; case FATAL: undoChanges(); notificationManager.notify(locale.failedToRename(), result.getEntries().get(0).getMessage(), FAIL, FLOAT_MODE); break; default: break; } } }).catchError(new Operation<PromiseError>() { @Override public void apply(PromiseError arg) throws OperationException { enableAutoSave(); undoChanges(); notificationManager.notify(locale.failedToRename(), arg.getMessage(), FAIL, FLOAT_MODE); } }); }
Source:
<code>public final void validationFailsOnCommandersMismatch() throws Exception { final String architect = "Yegor2048"; final Profile master = new Profile.Fixed( new XMLDocument( String.format( ProfilesTest.PROFILE, architect, "Yegor32", "do_something2" ) ) ); final Profile merged = new Profile.Fixed( new XMLDocument( String.format( ProfilesTest.PROFILE, architect, "Bob", "do_another2" ) ) ); try { <START> new Profiles().validated(master, merged); <END> } catch (final Profile.ConfigException exception) { MatcherAssert.assertThat( exception.getMessage(), Matchers.is( String.format( ProfilesTest.MESSAGE, "commander" ) ) ); } }</code><technical_language>@xupyprmv need Assert.fail</technical_language>

Target:
public final void validationFailsOnCommandersMismatch() throws Exception { final String architect = "Yegor2048"; final String commander = "Yegor4096"; final Profile master = new Profile.Fixed( new XMLDocument( String.format( ProfilesTest.PROFILE, architect, "Yegor32", "do_something2", "Yegor16", commander ) ) ); final Profile merged = new Profile.Fixed( new XMLDocument( String.format( ProfilesTest.PROFILE, architect, "Bob", "do_another2", "Marley", commander ) ) ); try { new Profiles().validated(master, merged); Assert.fail("Method above must throw an exception"); } catch (final Profile.ConfigException exception) { MatcherAssert.assertThat( exception.getMessage(), Matchers.is( String.format( ProfilesTest.MESSAGE, ProfilesTest.MERGE_COMMANDERS ) ) ); } }
Source:
<code>public VmSnapshotListViewItem(String name, Snapshot snapshot, VmSnapshotListModel listModel, SnapshotModel snapshotModel) { super(name, snapshot); <START> if (listModel == null) { <END> return; } Container generalInfoContainer = createGeneralItemContainerPanel(snapshot, listModel); generalExpand.setDetails(generalInfoContainer); listGroupItem.add(generalInfoContainer); updateValues(snapshotModel); }</code><technical_language>simply call constructor if primary source of information is null? get empty list view item now. add null check in PatternflyListView, in updateInfoPanel method. calls creator.createListViewItem(item). wrap 'item' in a null check</technical_language>

Target:
public VmSnapshotListViewItem(String name, Snapshot snapshot, VmSnapshotListModel listModel, SnapshotModel snapshotModel) { super(name, snapshot); Container generalInfoContainer = createGeneralItemContainerPanel(snapshot, listModel); generalExpand.setDetails(generalInfoContainer); listGroupItem.add(generalInfoContainer); updateValues(snapshotModel); }
Source:
<code>public void invalidateVisualState() { <START> super.invalidateVisualState(); <END> invalidateInputVisuals(); invalidateOutputVisuals(); }</code><technical_language>Super call nothing</technical_language>

Target:
public void invalidateVisualState() { super.invalidateVisualState(); argumentSpace.invalidateInputContent(); argumentSpace.invalidateOutputContent(); }
Source:
<code>private void addFeatureAsyncDelete(Features features) { Feature feature = new Feature(); feature.setName("Async Delete"); feature.setDescription("Ability to specify that DELETE request will be performed asynchronously, using the 'async' url parameter."); <START> features.getFeature().add(feature); <END> }</code><technical_language>please describe for other url params</technical_language>

Target:
private void addFeatureAsyncDelete(Features features) { Feature feature = new Feature(); feature.setName("Async Delete"); feature.setDescription("Ability to specify that DELETE request will be performed asynchronously, using the 'async' url parameter."); Parameter async = new Parameter(); async.setName("async"); async.setValue("true|false"); async.setType("boolean"); async.setContext("matrix"); feature.setUrl(new Url()); feature.getUrl().getParametersSets().add(new ParametersSet()); feature.getUrl().getParametersSets().get(0).getParameters().add(async); features.getFeature().add(feature); }
Source:
<code>public boolean insert(Set<DatasetEntry<E, A, V>> entries) { <START> for (DatasetEntry<E, A, V> entry : entries) { <END> if(!insert(entry)) { return false; } } return true; }</code><technical_language>Is this supposed atomic entries get added all? For example, happen if I 10 entires, 4th exists</technical_language>

Target:
public int insert(Set<DatasetEntry<E, A, V>> entries) { int count = 0; for (DatasetEntry<E, A, V> entry : entries) { if(insert(entry)) { count++; } } return count; }
Source:
<code>public String toString() { <START> String fromState = this.fromState.isPresent() ? this.fromState.get() : "_"; <END> String toState = this.toState.isPresent() ? this.toState.get() : "_"; return fromState+"->"+toState; }</code><technical_language>Optional.getOrElse() here. E.g. String fromState = this.fromState.getOrElse("_")</technical_language>

Target:
public String toString() { String fromState = this.fromState.orElse("_"); String toState = this.toState.orElse("_"); return String.format("%s->%s", fromState, toState); }
Source:
<code>private void privateRunJUnit(XmlTest xmlTest) { final ClassInfoMap cim = new ClassInfoMap(m_testClassesFromXml, false); final Set<Class<?>> classes = cim.getClasses(); final List<ITestNGMethod> runMethods = Lists.newArrayList(); List<IWorker<ITestNGMethod>> workers = Lists.newArrayList(); workers.add(new IWorker<ITestNGMethod>() { @Override public long getTimeOut() { return 0; } @Override public void run() { for(Class<?> tc: classes) { List<XmlInclude> includedMethods = cim.getXmlClass(tc).getIncludedMethods(); List<String> methods = Lists.newArrayList(); for (XmlInclude inc: includedMethods) { methods.add(inc.getName()); } IJUnitTestRunner tr= ClassHelper.createTestRunner(TestRunner.this); tr.setInvokedMethodListeners(m_invokedMethodListeners); try { tr.run(tc, methods.toArray(new String[methods.size()])); } catch(Exception ex) { ex.printStackTrace(); } finally { runMethods.addAll(tr.getTestMethods()); } } } @Override public List<ITestNGMethod> getTasks() { throw new TestNGException("JUnit not supported"); } @Override public int getPriority() { if (m_allTestMethods.length == 1) { return m_allTestMethods[0].getPriority(); } else { return 0; } } @Override public int compareTo(IWorker<ITestNGMethod> other) { return getPriority() - other.getPriority(); } }); <START> runWorkers(workers); <END> m_allTestMethods= runMethods.toArray(new ITestNGMethod[runMethods.size()]); }</code><technical_language>Yes, I "junit" somewhere</technical_language>

Target:
private void privateRunJUnit(XmlTest xmlTest) { final ClassInfoMap cim = new ClassInfoMap(m_testClassesFromXml, false); final Set<Class<?>> classes = cim.getClasses(); final List<ITestNGMethod> runMethods = Lists.newArrayList(); List<IWorker<ITestNGMethod>> workers = Lists.newArrayList(); workers.add(new IWorker<ITestNGMethod>() { @Override public long getTimeOut() { return 0; } @Override public void run() { for(Class<?> tc: classes) { List<XmlInclude> includedMethods = cim.getXmlClass(tc).getIncludedMethods(); List<String> methods = Lists.newArrayList(); for (XmlInclude inc: includedMethods) { methods.add(inc.getName()); } IJUnitTestRunner tr= ClassHelper.createTestRunner(TestRunner.this); tr.setInvokedMethodListeners(m_invokedMethodListeners); try { tr.run(tc, methods.toArray(new String[methods.size()])); } catch(Exception ex) { ex.printStackTrace(); } finally { runMethods.addAll(tr.getTestMethods()); } } } @Override public List<ITestNGMethod> getTasks() { throw new TestNGException("JUnit not supported"); } @Override public int getPriority() { if (m_allTestMethods.length == 1) { return m_allTestMethods[0].getPriority(); } else { return 0; } } @Override public int compareTo(IWorker<ITestNGMethod> other) { return getPriority() - other.getPriority(); } }); runJUnitWorkers(workers); m_allTestMethods= runMethods.toArray(new ITestNGMethod[runMethods.size()]); }
Source:
<code>public String description() { <START> return "browser contains text"; <END> }</code><technical_language>add "text" parameter user</technical_language>

Target:
public String description() { return "browser contains text: " + this.text; }
Source:
<code>private RelyingPartyRegistration asRegistration(String id, Registration properties) { boolean signRequest = properties.getIdentityprovider().getSinglesignon().isSignRequest(); validateSigningCredentials(properties, signRequest); RelyingPartyRegistration.Builder builder = RelyingPartyRegistration.withRegistrationId(id); builder.assertionConsumerServiceUrlTemplate( "{baseUrl}" + Saml2WebSsoAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI); builder.providerDetails( (details) -> details.webSsoUrl(properties.getIdentityprovider().getSinglesignon().getUrl())); builder.providerDetails((details) -> details.entityId(properties.getIdentityprovider().getEntityId())); builder.providerDetails( (details) -> details.binding(properties.getIdentityprovider().getSinglesignon().getBinding())); builder.providerDetails((details) -> details.signAuthNRequest(signRequest)); builder.credentials((credentials) -> credentials.addAll(asCredentials(properties))); <START> Optional.ofNullable(properties.getLocalEntityIdTemplate()) <END> .ifPresent((template) -> builder.localEntityIdTemplate(template)); return builder.build(); }</code><technical_language>If give property a default proposed above, this applied checking if null</technical_language>

Target:
private RelyingPartyRegistration asRegistration(String id, Registration properties) { boolean signRequest = properties.getIdentityprovider().getSinglesignon().isSignRequest(); validateSigningCredentials(properties, signRequest); RelyingPartyRegistration.Builder builder = RelyingPartyRegistration.withRegistrationId(id); builder.assertionConsumerServiceUrlTemplate( "{baseUrl}" + Saml2WebSsoAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI); builder.providerDetails( (details) -> details.webSsoUrl(properties.getIdentityprovider().getSinglesignon().getUrl())); builder.providerDetails((details) -> details.entityId(properties.getIdentityprovider().getEntityId())); builder.providerDetails( (details) -> details.binding(properties.getIdentityprovider().getSinglesignon().getBinding())); builder.providerDetails((details) -> details.signAuthNRequest(signRequest)); builder.credentials((credentials) -> credentials.addAll(asCredentials(properties))); builder.entityId(properties.getRelyingPartyEntityId()); return builder.build(); }
Source:
<code>public int getProjectId(String projectName) throws MLHttpClientException { CloseableHttpResponse response; try { response = doHttpGet("/api/projects/" + projectName); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); JSONObject responseJson = new JSONObject(bufferedReader.readLine()); bufferedReader.close(); response.close(); return responseJson.getInt("id"); } catch (MLHttpClientException e) { throw new MLHttpClientException("Faile to get ID of project: " + projectName, e); } catch (IOException e) { throw new MLHttpClientException("Faile to get ID of project: " + projectName, e); } catch (JSONException e) { <START> throw new MLHttpClientException("Faile to get ID of project: " + projectName, e); <END> } }</code><technical_language>returning exception message right? Hence, catch Exception catching exceptions? a typo in message. /s/Faile/Failed</technical_language>

Target:
public int getProjectId(String projectName) throws MLHttpClientException { CloseableHttpResponse response; try { response = doHttpGet("/api/projects/" + projectName); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); JSONObject responseJson = new JSONObject(bufferedReader.readLine()); bufferedReader.close(); response.close(); return responseJson.getInt("id"); } catch (Exception e) { throw new MLHttpClientException("Failed to get ID of project: " + projectName, e); } }
Source:
<code>public static VmInitNetwork map(GuestNicConfiguration model, VmInitNetwork template) { VmInitNetwork entity = template != null ? template : new VmInitNetwork(); if (model.isSetName()) { entity.setName(model.getName()); } if (model.isOnBoot()) { entity.setStartOnBoot(model.isOnBoot()); } if (model.isSetBootProtocol()) { entity.setBootProtocol(BootProtocolMapper.map(BootProtocol.fromValue(model.getBootProtocol()), NetworkBootProtocol.NONE)); } if (model.isSetIp()) { <START> if (!model.isSetBootProtocol()) { <END> entity.setBootProtocol(NetworkBootProtocol.STATIC_IP); } if (model.getIp().isSetAddress()) { entity.setIp(model.getIp().getAddress()); } if (model.getIp().isSetNetmask()) { entity.setNetmask(model.getIp().getNetmask()); } if (model.getIp().isSetGateway()) { entity.setGateway(model.getIp().getGateway()); } } return entity; }</code><technical_language>@Shahar: acceptable if is supplied</technical_language>

Target:
public static VmInitNetwork map(GuestNicConfiguration model, VmInitNetwork template) { VmInitNetwork entity = template != null ? template : new VmInitNetwork(); if (model.isSetName()) { entity.setName(model.getName()); } if (model.isOnBoot()) { entity.setStartOnBoot(model.isOnBoot()); } if (model.isSetBootProtocol()) { entity.setBootProtocol(BootProtocolMapper.map(BootProtocol.fromValue(model.getBootProtocol()), NetworkBootProtocol.NONE)); } if (model.isSetIp()) { if (model.getIp().isSetAddress()) { entity.setIp(model.getIp().getAddress()); } if (model.getIp().isSetNetmask()) { entity.setNetmask(model.getIp().getNetmask()); } if (model.getIp().isSetGateway()) { entity.setGateway(model.getIp().getGateway()); } } return entity; }
Source:
<code>public void testAllOutputsReferenced() throws Exception { tester().assertThat(new PruneFilterColumns()) <START> .on(p -> buildProjectedFilter(p, Predicates.alwaysTrue())) <END> .doesNotFire(); }</code><technical_language>static import</technical_language>

Target:
public void testAllOutputsReferenced() throws Exception { tester().assertThat(new PruneFilterColumns()) .on(p -> buildProjectedFilter(p, alwaysTrue())) .doesNotFire(); }
Source:
<code>public boolean connection(DbSession dbSession, String hostId, byte[] arg0, <START> boolean isSsl) <END> throws Reply530Exception, Reply421Exception { DbHostAuth auth = null; try { auth = new DbHostAuth(hostId); } catch (WaarpDatabaseException e) { logger.error("Cannot find authentication for " + hostId); setIsIdentified(false); currentAuth = null; throw new Reply530Exception("HostId not allowed"); } if (auth.isSsl() != isSsl) { if (auth.isSsl()) { logger.error("Hostid must use SSL", hostId); } else { logger.error("Hostid cannot use SSL", hostId); } setIsIdentified(false); currentAuth = null; throw new Reply530Exception("HostId not allowed"); } currentAuth = auth; role.clear(); if (currentAuth.isKeyValid(arg0)) { setIsIdentified(true); user = hostId; setRootFromAuth(); getSession().getDir().initAfterIdentification(); isAdmin = currentAuth.isAdminrole(); if (Configuration.configuration.getRoles().isEmpty()) { if (isAdmin) { role.setRole(ROLE.FULLADMIN); } else { role.setRole(ROLE.PARTNER); } } else { RoleDefault configRole = Configuration.configuration.getRoles().get(hostId); if (configRole == null) { role.setRole(ROLE.PARTNER); } else { role.setRoleDefault(configRole); if (this.role.isContaining(ROLE.FULLADMIN)) { isAdmin = true; } } if (isAdmin) { role.setRole(ROLE.FULLADMIN); } } logger.debug(this.role.toString()); return true; } throw new Reply530Exception("Key is not valid for this HostId"); }</code><technical_language>If I understand correctly, DbSession is more used. keeping it</technical_language>

Target:
public boolean connection(DbSession dbSession, String hostId, byte[] arg0, boolean isSsl) throws Reply530Exception, Reply421Exception { return connection(hostId, arg0, isSsl); }
Source:
<code>private void addStep(final Task task, Map<String, Task> config) { steps.add(task); project.getTasks().getByName("release").dependsOn(task); if (previousStep != null) { if (project.hasProperty("singleStep")) { } else { task.dependsOn(previousStep); } } previousStep = task; for (final Callable<Boolean> allower : allowers) { task.onlyIf(new SpecAdapter(allower)); } StepConfiguration stepConfig = new StepConfiguration(config); if (stepConfig.isEmpty()) { return; } Task rollback = stepConfig.getRollback(); if (rollback != null) { <START> if (!project.hasProperty("dryRun")) { END> rollback.setEnabled(false); } } else { rollback = stepConfig.getCleanup(); } rollbacks.add(rollback); rollback.mustRunAfter(steps); if (previousRollback != null) { previousRollback.mustRunAfter(rollback); } previousRollback = rollback; task.finalizedBy(rollback); rollback.onlyIf(new Spec<Task>() { public boolean isSatisfiedBy(Task t) { return task.getState().getFailure() == null; } }); for (Callable<Boolean> allower : allowers) { rollback.onlyIf(new SpecAdapter(allower)); } }</code><technical_language>Same, some constant class / interface somewhere, instead of searching strings</technical_language>

Target:
private void addStep(final Task task, Map<String, Task> config) { steps.add(task); project.getTasks().getByName("release").dependsOn(task); if (previousStep != null) { if (project.hasProperty("singleStep")) { } else { task.dependsOn(previousStep); } } previousStep = task; for (final Callable<Boolean> allower : allowers) { task.onlyIf(new SpecAdapter(allower)); } StepConfiguration stepConfig = new StepConfiguration(config); if (stepConfig.isEmpty()) { return; } Task postStep = stepConfig.getRollback(); if (postStep != null) { if (!project.hasProperty("dryRun")) { postStep.setEnabled(false); } } else { postStep = stepConfig.getCleanup(); } postSteps.add(postStep); postStep.mustRunAfter(steps); if (previousPostStep != null) { previousPostStep.mustRunAfter(postStep); } previousPostStep = postStep; task.finalizedBy(postStep); postStep.onlyIf(new Spec<Task>() { public boolean isSatisfiedBy(Task t) { return task.getState().getFailure() == null; } }); for (Callable<Boolean> allower : allowers) { postStep.onlyIf(new SpecAdapter(allower)); } }
Source:
<code>public Point2D transform(VisualizationServer<N, E> vv, Point2D p) { MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer(); MutableTransformer viewTransformer = multiLayerTransformer.getTransformer(Layer.VIEW); MutableTransformer layoutTransformer = multiLayerTransformer.getTransformer(Layer.LAYOUT); VisualizationModel<N, E, Point2D> model = vv.getModel(); <START> if (viewTransformer instanceof LensTransformer) { <END> p = multiLayerTransformer.transform(p); } else if (layoutTransformer instanceof LensTransformer) { LayoutModel<N, Point2D> layoutModel = model.getLayoutModel(); Dimension d = new Dimension(layoutModel.getWidth(), layoutModel.getHeight()); HyperbolicShapeTransformer shapeChanger = new HyperbolicShapeTransformer(d, viewTransformer); LensTransformer lensTransformer = (LensTransformer) layoutTransformer; shapeChanger.getLens().setLensShape(lensTransformer.getLens().getLensShape()); MutableTransformer layoutDelegate = ((MutableTransformerDecorator) layoutTransformer).getDelegate(); p = shapeChanger.transform(layoutDelegate.transform(p)); } else { p = multiLayerTransformer.transform(Layer.LAYOUT, p); } return p; }</code><technical_language>this if-else if-else block (and for Shape) is similarly confusing: considering questions (is view transformer a LensTransformer? is layout transformer a LensTransformer?) separately, assuming default is a basic transformation layout layer</technical_language>

Target:
public Point2D transform(VisualizationServer<N, E> vv, Point2D p) { MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer(); MutableTransformer viewTransformer = multiLayerTransformer.getTransformer(Layer.VIEW); MutableTransformer layoutTransformer = multiLayerTransformer.getTransformer(Layer.LAYOUT); VisualizationModel<N, E> model = vv.getModel(); if (viewTransformer instanceof LensTransformer) { p = multiLayerTransformer.transform(p); } else if (layoutTransformer instanceof LensTransformer) { LayoutModel<N> layoutModel = model.getLayoutModel(); Dimension d = new Dimension(layoutModel.getWidth(), layoutModel.getHeight()); HyperbolicShapeTransformer shapeChanger = new HyperbolicShapeTransformer(d, viewTransformer); LensTransformer lensTransformer = (LensTransformer) layoutTransformer; shapeChanger.getLens().setLensShape(lensTransformer.getLens().getLensShape()); MutableTransformer layoutDelegate = ((MutableTransformerDecorator) layoutTransformer).getDelegate(); p = shapeChanger.transform(layoutDelegate.transform(p)); } else { p = multiLayerTransformer.transform(Layer.LAYOUT, p); } return p; }
Source:
<code>public TemplateScheduledPushPayload build() { Preconditions.checkArgument( <START> audience != null && deviceTypes != null && mergeData != null, <END> "audience, deviceTypes, and mergeData cannot be null." ); return new TemplateScheduledPushPayload(this); }</code><technical_language>Schedule is required <LINK_0> check null update messaging "... schedule null"</technical_language>

Target:
public TemplateScheduledPushPayload build() { Preconditions.checkArgument( audience != null && deviceTypes != null && mergeData != null && schedule != null, "audience, deviceTypes, mergeData and schedule cannot be null." ); return new TemplateScheduledPushPayload(this); }
Source:
<code>public static Slice stCentroid(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_Centroid", geometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); <START> GeometryType typeName = GeometryUtils.valueOf(geometry.geometryType()); <END> if (typeName == POINT) { return input; } int pointCount = ((MultiVertexGeometry) geometry.getEsriGeometry()).getPointCount(); if (pointCount == 0) { return serialize(createFromEsriGeometry(new Point(), geometry.getEsriSpatialReference())); } Point centroid; switch (typeName) { case MULTI_POINT: centroid = computePointsCentroid((MultiVertexGeometry) geometry.getEsriGeometry()); break; case LINE_STRING: case MULTI_LINE_STRING: centroid = computeLineCentroid((Polyline) geometry.getEsriGeometry()); break; case POLYGON: centroid = computePolygonCentroid((Polygon) geometry.getEsriGeometry()); break; case MULTI_POLYGON: centroid = computeMultiPolygonCentroid((OGCMultiPolygon) geometry); break; default: throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid typeName: " + typeName); } return serialize(createFromEsriGeometry(centroid, geometry.getEsriSpatialReference())); }</code><technical_language>perhaps, rename typeName geometryType</technical_language>

Target:
public static Slice stCentroid(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); validateType("ST_Centroid", geometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); GeometryType geometryType = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (geometryType == POINT) { return input; } int pointCount = ((MultiVertexGeometry) geometry.getEsriGeometry()).getPointCount(); if (pointCount == 0) { return serialize(createFromEsriGeometry(new Point(), geometry.getEsriSpatialReference())); } Point centroid; switch (geometryType) { case MULTI_POINT: centroid = computePointsCentroid((MultiVertexGeometry) geometry.getEsriGeometry()); break; case LINE_STRING: case MULTI_LINE_STRING: centroid = computeLineCentroid((Polyline) geometry.getEsriGeometry()); break; case POLYGON: centroid = computePolygonCentroid((Polygon) geometry.getEsriGeometry()); break; case MULTI_POLYGON: centroid = computeMultiPolygonCentroid((OGCMultiPolygon) geometry); break; default: throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Unexpected geometry type: " + geometryType); } return serialize(createFromEsriGeometry(centroid, geometry.getEsriSpatialReference())); }