auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void receiveToNeighbor(Iterator<PathMergeMessage> msgIterator) { VertexValueWritable value = getVertexValue(); if (verbose) LOG.fine("Iteration " + getSuperstep() + "\r\n" + "before update from dead vertex: " + value); while (msgIterator.hasNext()) { PathMergeMessage incomingMsg = msgIterator.next(); EDGETYPE deleteToMe = EDGETYPE.fromByte(incomingMsg.getFlag()); EDGETYPE aliveToMe = EDGETYPE.fromByte((short) (incomingMsg.getFlag() >> 9)); VKmer deletedKmer = incomingMsg.getSourceVertexId(); if (value.getEdges(deleteToMe).contains(deletedKmer)) { value.getEdges(deleteToMe).remove(deletedKmer); <START> if (!value.getEdges(aliveToMe).contains(incomingMsg.getInternalKmer())) <END> value.getEdges(aliveToMe).append(incomingMsg.getInternalKmer()); } voteToHalt(); } if (verbose) LOG.fine("after update from dead vertex: " + value); }</code><technical_language>otherwise, throw exception</technical_language>

Target:
public void receiveToNeighbor(Iterator<PathMergeMessage> msgIterator) { VertexValueWritable value = getVertexValue(); if (verbose) LOG.fine("Iteration " + getSuperstep() + "\r\n" + "before update from dead vertex: " + value); while (msgIterator.hasNext()) { PathMergeMessage incomingMsg = msgIterator.next(); EDGETYPE deleteToMe = EDGETYPE.fromByte(incomingMsg.getFlag()); EDGETYPE aliveToMe = EDGETYPE.fromByte((short) (incomingMsg.getFlag() >> 9)); VKmer deletedKmer = incomingMsg.getSourceVertexId(); if (value.getEdges(deleteToMe).contains(deletedKmer)) { value.getEdges(deleteToMe).remove(deletedKmer); if (!value.getEdges(aliveToMe).contains(incomingMsg.getInternalKmer())) value.getEdges(aliveToMe).append(incomingMsg.getInternalKmer()); } else { throw new IllegalStateException("Couldn't find the requested edge to delete! I am " + value.toString() + "; incomingMsg was " + incomingMsg.toString()); } voteToHalt(); } if (verbose) LOG.fine("after update from dead vertex: " + value); }
Source:
<code>public void doCommentAddedHook(final Change change, final Account account, final String comment, final Map<String, Short> approvals) { if (commentAddedHook != null && commentAddedHook.exists()) { final List<String> args = new ArrayList<String>(); args.add(commentAddedHook.getAbsolutePath()); args.add(change.getId().toString()); args.add(change.getProject().get()); args.add(change.getDest().getShortName()); <START> args.add(account.getFullName()); END> args.add(comment); for (Map.Entry<String, Short> approval : approvals.entrySet()) { args.add("--" + approval.getKey()); args.add(Short.toString(approval.getValue())); } runHook(getRepo(change), args); } }</code><technical_language>name email here? Also, name null. call "Anonymous Coward" in web UI. null do in middle of list pass this ProcessBuilder? crash a NPE</technical_language>

Target:
public void doCommentAddedHook(final Change change, final Account account, final String comment, final Map<String, Short> approvals) { final List<String> args = new ArrayList<String>(); args.add(commentAddedHook.getAbsolutePath()); args.add("--change"); args.add(change.getKey().get()); args.add("--project"); args.add(change.getProject().get()); args.add("--branch"); args.add(change.getDest().getShortName()); args.add("--author"); args.add(getDisplayName(account)); args.add("--comment"); args.add(comment == null ? "" : comment); for (Map.Entry<String, Short> approval : approvals.entrySet()) { args.add("--" + approval.getKey()); args.add(Short.toString(approval.getValue())); } runHook(getRepo(change), args); }
Source:
<code>private Transaction getRunningTx() { try { Transaction transaction = tm.getTransaction(); <START> if (transaction == null && config.invocationBatching().enabled()) { <END> transaction = batchContainer.getBatchTransaction(); } return transaction; } catch (SystemException e) { throw new CacheException(e); } }</code><technical_language>Assuming batching is enabled, runningTX batchContainer if is a transaction defined</technical_language>

Target:
private Transaction getRunningTx() { try { Transaction transaction = null; if (batchingEnabled) { transaction = batchContainer.getBatchTransaction(); } if (transaction == null) { transaction = tm.getTransaction(); } return transaction; } catch (SystemException e) { throw new CacheException(e); } }
Source:
<code>public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (hasImages) { return getSucceeded() ? AuditLogType.USER_REMOVE_VM : AuditLogType.USER_FAILED_REMOVE_VM; } else { return getSucceeded() ? AuditLogType.USER_REMOVE_VM_FINISHED : AuditLogType.USER_FAILED_REMOVE_VM; } case END_FAILURE: case END_SUCCESS: <START> default: <END> return imagesLeftInVm ? AuditLogType.USER_FAILED_REMOVE_VM : AuditLogType.USER_REMOVE_VM_FINISHED; } }</code><technical_language>Wrong message, removing vm DB</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (hasImages) { return getSucceeded() ? AuditLogType.USER_REMOVE_VM : AuditLogType.USER_FAILED_REMOVE_VM; } else { return getSucceeded() ? AuditLogType.USER_REMOVE_VM_FINISHED : AuditLogType.USER_FAILED_REMOVE_VM; } case END_FAILURE: case END_SUCCESS: default: return DisksLeftInVm.isEmpty() ? AuditLogType.USER_REMOVE_VM_FINISHED : AuditLogType.USER_REMOVE_VM_FINISHED_WITH_ILLEGAL_DISKS; } }
Source:
<code>void setSchemaVersion(int version) { try (Connection connection = dataSource.getConnection()) { try (Statement statement = connection.createStatement()) { String updateVersionSql = "UPDATE \"Version\" SET \"id\"=" + version; <START> statement.execute(updateVersionSql); <END> } } catch (SQLException e) { throw new RuntimeException(e); } }</code><technical_language>![CRITICAL](<LINK_1> 'Severity: CRITICAL') a variable binding mechanism construct this query instead of concatenation. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
void setSchemaVersion(int version) { try (Connection connection = dataSource.getConnection()) { try (Statement statement = connection.createStatement()) { String updateVersionSql = "UPDATE \"Version\" SET \"id\"=" + version; statement.execute(updateVersionSql); } } catch (SQLException e) { throw new UncheckedSqlException(e); } }
Source:
<code>public void testOutPrefixWithZeros() throws IOException { final String tmpDir = IOUtil.getDefaultTmpDir().getAbsolutePath(); <START> final String[] args = new String[]{ <END> "INPUT=" + PAIRED_FILE, "SPLIT_TO_N_READS=5", "OUTPUT=" + tmpDir, "OUT_PREFIX=Sample01" }; runPicardCommandLine(args); final File out1 = new File(tmpDir, "Sample01_0001.bam"); out1.deleteOnExit(); VALIDATE_SAM_TESTER.assertSamValid(out1); }</code><technical_language>new String[] is unnecessary initializing array</technical_language>

Target:
public void testOutPrefixWithZeros() throws IOException { final File tmpDir = Files.createTempDirectory(TMP_DIR_NAME).toFile(); final String[] args = { "INPUT=" + PAIRED_FILE, "SPLIT_TO_N_READS=5", "OUTPUT=" + tmpDir, "OUT_PREFIX=Sample01" }; runPicardCommandLine(args); final File out1 = new File(tmpDir, "Sample01_0001.bam"); out1.deleteOnExit(); VALIDATE_SAM_TESTER.assertSamValid(out1); final File out2 = new File(tmpDir, "Sample01_0002.bam"); out2.deleteOnExit(); VALIDATE_SAM_TESTER.assertSamValid(out2); }
Source:
<code>public RocksStateKeysAndNamespaceIterator( @Nonnull RocksIteratorWrapper iterator, @Nonnull String state, @Nonnull TypeSerializer<K> keySerializer, <START> @Nonnull TypeSerializer<N> namespaceSerializer, int keyGroupPrefixBytes, <END> boolean ambiguousKeyPossible) { this.iterator = iterator; this.state = state; this.keySerializer = keySerializer; this.namespaceSerializer = namespaceSerializer; this.keyGroupPrefixBytes = keyGroupPrefixBytes; this.nextKey = null; this.ambiguousKeyPossible = ambiguousKeyPossible; this.byteArrayDataInputView = new DataInputDeserializer(); }</code><technical_language>This line separated</technical_language>

Target:
public RocksStateKeysAndNamespaceIterator( @Nonnull RocksIteratorWrapper iterator, @Nonnull String state, @Nonnull TypeSerializer<K> keySerializer, @Nonnull TypeSerializer<N> namespaceSerializer, int keyGroupPrefixBytes, boolean ambiguousKeyPossible) { super(iterator, state, keySerializer, keyGroupPrefixBytes, ambiguousKeyPossible); this.namespaceSerializer = namespaceSerializer; this.nextKey = null; }
Source:
<code><START> String getProviderNameReplacement() { <END> return String.format(PROVIDER_NAME_REPLACEMENT, provider.getName()); }</code><technical_language>if create replacement here, new test in patches, this method private seems, this is of this class</technical_language>

Target:
private String getProviderNameReplacement() { return ReplacementUtils.getVariableAssignmentString(EngineMessage.NETWORK_ATTACHMENT_NOT_EXISTS, provider.getName()); }
Source:
<code>public void addListener(String key, String group, ConfigurationListener listener) { NacosConfigListener nacosConfigListener = watchListenerMap.computeIfAbsent(generateKey(key, group), k -> createTargetListener(key, group)); String keyInNacos = rootPath + PROPERTIES_CHAR_SEPERATOR + key; nacosConfigListener.addListener(listener); try { <START> configService.addListener(keyInNacos, null, nacosConfigListener); <END> } catch (NacosException e) { logger.error(e.getMessage()); } }</code><technical_language>configService.addListener(keyInNacos, group, nacosConfigListener)</technical_language>

Target:
public void addListener(String key, String group, ConfigurationListener listener) { String[] keyAndGroup = getKeyAndGroup(key); if (keyAndGroup[1] != null) { group = keyAndGroup[1]; } String finalGroup = group; NacosConfigListener nacosConfigListener = watchListenerMap.computeIfAbsent(generateKey(key, group), k -> createTargetListener(key, finalGroup)); String keyInNacos = rootPath + PROPERTIES_CHAR_SEPERATOR + key; nacosConfigListener.addListener(listener); try { configService.addListener(keyInNacos, group, nacosConfigListener); System.out.println("1"); } catch (NacosException e) { logger.error(e.getMessage()); } }
Source:
<code>public MachineImpl create(final RecipeMachineCreationMetadata machineCreationMetadata) throws MachineException, NotFoundException { final InstanceProvider instanceProvider = machineInstanceProviders.getProvider(machineCreationMetadata.getType()); final String recipeType = machineCreationMetadata.getRecipeDescriptor().getType(); <START> final Recipe recipe = RecipeImpl.fromDescriptor(machineCreationMetadata.getRecipeDescriptor()); <END> if (instanceProvider.getRecipeTypes().contains(recipeType)) { return createMachine(machineCreationMetadata.getType(), recipe, machineCreationMetadata.getWorkspaceId(), machineCreationMetadata.isBindWorkspace(), machineCreationMetadata.getDisplayName(), machineCreationMetadata.getOutputChannel(), machineCreationMetadata.getMemorySize(), new InstanceCreator() { @Override public Instance createInstance(String machineId, int machineMemSizeMB, String creator, String workspaceId, boolean isBindWorkspace, String displayName, LineConsumer machineLogger) throws MachineException { return instanceProvider.createInstance(recipe, machineId, creator, workspaceId, isBindWorkspace, displayName, machineMemSizeMB, machineLogger); } }); } else { throw new UnsupportedRecipeException(String.format("Recipe of type '%s' is not supported", recipeType)); } }</code><technical_language>Please replace RecipeDescriptor in RecipeMachineCreationMetadata MachineRecipe. allows avoid this code</technical_language>

Target:
public MachineImpl create(final RecipeMachineCreationMetadata machineCreationMetadata) throws MachineException, NotFoundException { final MachineRecipe machineRecipe = machineCreationMetadata.getRecipe(); final InstanceProvider instanceProvider = machineInstanceProviders.getProvider(machineCreationMetadata.getType()); final String recipeType = machineRecipe.getType(); if (instanceProvider.getRecipeTypes().contains(recipeType)) { return createMachine(machineCreationMetadata.getType(), machineRecipe, machineCreationMetadata.getWorkspaceId(), machineCreationMetadata.isBindWorkspace(), machineCreationMetadata.getDisplayName(), machineCreationMetadata.getOutputChannel(), machineCreationMetadata.getMemorySize(), new InstanceCreator() { @Override public Instance createInstance(String machineId, int machineMemSizeMB, String creator, String workspaceId, boolean isBindWorkspace, String displayName, LineConsumer machineLogger) throws MachineException { return instanceProvider.createInstance(machineRecipe, machineId, creator, workspaceId, isBindWorkspace, displayName, machineMemSizeMB, machineLogger); } }); } else { throw new UnsupportedRecipeException(String.format("Recipe of type '%s' is not supported", recipeType)); } }
Source:
<code>public void startAnimating() { <START> if (isAnimating_) <END> return; isAnimating_ = true; animate(); Scheduler.get().scheduleFixedPeriod(() -> { return animate(); }, FRAME_RATE_MS); }</code><technical_language>Nit: avoid starting animation if requestStopAnimating_ is set</technical_language>

Target:
public void startAnimating() { if (isAnimating_ || requestStopAnimating_) return; isAnimating_ = true; animate(); Scheduler.get().scheduleFixedPeriod(() -> { return animate(); }, FRAME_RATE_MS); }
Source:
<code>public void execute() throws MojoExecutionException, MojoFailureException { if (!generateP2Metadata) { return; } try { if (getUpdateSiteLocation().isDirectory()) { generateMetadata(); } else { <START> getLog().debug(getUpdateSiteLocation().getAbsolutePath() + " does not exist or is not a directory"); <END> } } catch (MojoFailureException e) { throw e; } catch (Exception e) { throw new MojoExecutionException("Cannot generate P2 metadata", e); } }</code><technical_language>This suppress warning for update site category mojos, I warning is justified</technical_language>

Target:
public void execute() throws MojoExecutionException, MojoFailureException { if (!generateP2Metadata) { return; } try { if (getUpdateSiteLocation().isDirectory()) { generateMetadata(); } else { logUpdateSiteLocationNotFound(); } } catch (MojoFailureException e) { throw e; } catch (Exception e) { throw new MojoExecutionException("Cannot generate P2 metadata", e); } }
Source:
<code>public void runApplication(StreamApplication streamApplication, String appName, Config overriddenConfigs) { Map<String, String> configs = new HashMap<>(); configs.put("job.factory.class", "org.apache.samza.job.local.ThreadJobFactory"); configs.put("job.name", appName); configs.put("app.class", streamApplication.getClass().getCanonicalName()); configs.put("serializers.registry.json.class", "org.apache.samza.serializers.JsonSerdeFactory"); configs.put("serializers.registry.string.class", "org.apache.samza.serializers.StringSerdeFactory"); configs.put("systems.kafka.samza.factory", "org.apache.samza.system.kafka.KafkaSystemFactory"); configs.put("systems.kafka.consumer.zookeeper.connect", zkConnect()); configs.put("systems.kafka.producer.bootstrap.servers", bootstrapUrl()); configs.put("systems.kafka.samza.key.serde", "string"); configs.put("systems.kafka.samza.msg.serde", "string"); configs.put("systems.kafka.samza.offset.default", "oldest"); configs.put("job.coordinator.system", "kafka"); configs.put("job.default.system", "kafka"); configs.put("job.coordinator.replication.factor", "1"); configs.put("task.window.ms", "1000"); <START> configs.put("task.shutdown.ms", "100"); <END> if (overriddenConfigs != null) { configs.putAll(overriddenConfigs); } app = streamApplication; runner = ApplicationRunner.fromConfig(new MapConfig(configs)); runner.run(streamApplication); }</code><technical_language>simply set 1 then</technical_language>

Target:
public void runApplication(StreamApplication streamApplication, String appName, Config overriddenConfigs) { Map<String, String> configs = new HashMap<>(); configs.put("job.factory.class", "org.apache.samza.job.local.ThreadJobFactory"); configs.put("job.name", appName); configs.put("app.class", streamApplication.getClass().getCanonicalName()); configs.put("serializers.registry.json.class", "org.apache.samza.serializers.JsonSerdeFactory"); configs.put("serializers.registry.string.class", "org.apache.samza.serializers.StringSerdeFactory"); configs.put("systems.kafka.samza.factory", "org.apache.samza.system.kafka.KafkaSystemFactory"); configs.put("systems.kafka.consumer.zookeeper.connect", zkConnect()); configs.put("systems.kafka.producer.bootstrap.servers", bootstrapUrl()); configs.put("systems.kafka.samza.key.serde", "string"); configs.put("systems.kafka.samza.msg.serde", "string"); configs.put("systems.kafka.samza.offset.default", "oldest"); configs.put("job.coordinator.system", "kafka"); configs.put("job.default.system", "kafka"); configs.put("job.coordinator.replication.factor", "1"); configs.put("task.window.ms", "1000"); configs.put("task.shutdown.ms", "1"); if (overriddenConfigs != null) { configs.putAll(overriddenConfigs); } app = streamApplication; runner = ApplicationRunner.fromConfig(new MapConfig(configs)); runner.run(streamApplication); }
Source:
<code>static PageStore create(AlluxioConfiguration conf) throws IOException { PageStoreOptions options; PageStoreType storeType = conf.getEnum( PropertyKey.USER_CLIENT_CACHE_STORE_TYPE, PageStoreType.class); switch (storeType) { case LOCAL: options = new LocalPageStoreOptions(); break; case ROCKS: options = new RocksPageStoreOptions(); break; default: throw new IllegalArgumentException(String.format("Unrecognized store type %s", storeType.name())); } String rootDir = conf.get(PropertyKey.USER_CLIENT_CACHE_DIR); initialize(rootDir, storeType); <START> Path storePath = Paths.get(conf.get(PropertyKey.USER_CLIENT_CACHE_DIR), storeType.name()); <END> options.setRootDir(storePath.toString()); options.setPageSize(conf.getBytes(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE)); options.setCacheSize(conf.getBytes(PropertyKey.USER_CLIENT_CACHE_SIZE)); options.setAlluxioVersion(conf.get(PropertyKey.VERSION)); return create(options); }</code><technical_language>line 86 102 a helper method in this is easier maintain change this logic in future</technical_language>

Target:
static PageStore create(AlluxioConfiguration conf) throws IOException { PageStoreOptions options; PageStoreType storeType = conf.getEnum( PropertyKey.USER_CLIENT_CACHE_STORE_TYPE, PageStoreType.class); switch (storeType) { case LOCAL: options = new LocalPageStoreOptions(); break; case ROCKS: options = new RocksPageStoreOptions(); break; default: throw new IllegalArgumentException(String.format("Unrecognized store type %s", storeType.name())); } String rootDir = conf.get(PropertyKey.USER_CLIENT_CACHE_DIR); initialize(rootDir, storeType); Path storePath = getStorePath(storeType, rootDir); options.setRootDir(storePath.toString()); options.setPageSize(conf.getBytes(PropertyKey.USER_CLIENT_CACHE_PAGE_SIZE)); options.setCacheSize(conf.getBytes(PropertyKey.USER_CLIENT_CACHE_SIZE)); options.setAlluxioVersion(conf.get(PropertyKey.VERSION)); return create(options); }
Source:
<code>public void testShouldGiveNoErrorMessage() { Source source = new Source(); source.getSourceElements().add( new SourceElement( 1, "jim" ) ); source.getSourceElements().add( new SourceElement( 2, "alice" ) ); Target target = new Target(); TargetElement bob = new TargetElement( 1, "bob" ); target.addTargetElement( bob ); TargetElement louise = new TargetElement( 3, "louise" ); target.addTargetElement( louise ); Issue1719Mapper.INSTANCE.map( source, target ); assertThat( target.getTargetElements() ).hasSize( 3 ); <START> assertThat( target.getTargetElements() ).containsOnly( <END> new TargetElement( 1, "bob" ), new TargetElement( 2, "alice" ), new TargetElement( 3, "louise" ) ).usingFieldByFieldElementComparator(); }</code><technical_language>This test field field comparator. I change test assertThat( target.getTargetElements() ) .extracting( TargetElement:getId(), TargetElement::getName() ) .containsOnly( tuple(1, "bob"), tuple(2, "alice"), tuple(3, "louis") );</technical_language>

Target:
public void testShouldGiveNoErrorMessage() { Source source = new Source(); source.getSourceElements().add( new SourceElement( 1, "jim" ) ); source.getSourceElements().add( new SourceElement( 2, "alice" ) ); Target target = new Target(); TargetElement bob = new TargetElement( 1, "bob" ); target.addTargetElement( bob ); TargetElement louise = new TargetElement( 3, "louise" ); target.addTargetElement( louise ); Issue1719Mapper.INSTANCE.map( source, target ); assertThat( target.getTargetElements() ).hasSize( 3 ); assertThat( target.getTargetElements() ) .extracting( TargetElement::getId, TargetElement::getName ) .containsOnly( tuple( 1, "bob" ), tuple( 2, "alice" ), tuple( 3, "louise" ) ); }
Source:
<code>private boolean processResult(boolean result) { if (result == false) { if (allFilters) { <START> int nthArray = filterContainer[filterIdx]; <END> for (int i = filterIdx + 1; i < numFilters; i++) { if (filterContainer[i] != nthArray) { break; } failNext++; } } else { int nthArray = filterContainer[filterOrder[filterIdx]]; for (int i = filterIdx + 1; i < numFilters; i++) { if (filterContainer[filterOrder[i]] != nthArray) { break; } failNext++; } } } return result; }</code><technical_language>rename nthArray inputNumber fold if (filterContainer[i] != nthArray) check for loop so: if (scanAllPositions) { int inputNumber = inputNumbers[filterIndex]; for (int i = filterIndex + 1; i < numPositions && inputNumbers[i] == inputNumber; i++) { numNextPositionsToFail++; } } else { int inputNumber = inputNumbers[selectedPositionIndexes[filterIndex]]; for (int i = filterIndex + 1; i < numSelectedPositions && inputNumbers[selectedPositionIndexes[i]] == inputNumber; i++) { numNextPositionsToFail++; } }</technical_language>

Target:
private boolean processResult(boolean result) { if (result == false) { if (scanAllPositions) { int inputNumber = inputNumbers[filterIndex]; for (int i = filterIndex + 1; i < numSelectedPositions; i++) { if (inputNumbers[i] != inputNumber) { break; } numNextPositionsToFail++; } } else { int inputNumber = inputNumbers[selectedPositionIndexes[filterIndex]]; for (int i = filterIndex + 1; i < numSelectedPositions; i++) { if (inputNumbers[selectedPositionIndexes[i]] != inputNumber) { break; } numNextPositionsToFail++; } } } return result; }
Source:
<code>protected void doExecute(WordsObject object, WordsEnvironment environment) throws WordsProgramException { <START> if (messageExpression != null) { <END> ASTValue value; try { value = messageExpression.eval(environment).tryCoerceTo(ASTValue.ValueType.STRING); } catch (WordsRuntimeException e) { throw new WordsProgramException(messageExpression, e); } if (value.type != ASTValue.ValueType.STRING) { throw new WordsProgramException(messageExpression, new WordsInvalidTypeException(value.type.toString(), ASTValue.ValueType.STRING.toString())); } messageValue = value.stringValue; messageExpression = null; } object.setMessage(messageValue); }</code><technical_language>above, I this changed construct is expression, in case this check necessary (but assertion for it)</technical_language>

Target:
protected void doExecute(WordsObject object, WordsEnvironment environment) throws WordsProgramException { assert message != null : "Say message is null"; ASTValue value; try { value = message.eval(environment).tryCoerceTo(ASTValue.ValueType.STRING); } catch (WordsRuntimeException e) { throw new WordsProgramException(message, e); } if (value.type != ASTValue.ValueType.STRING) { throw new WordsProgramException(message, new WordsInvalidTypeException(ASTValue.ValueType.STRING.toString(), value.type.toString())); } object.setMessage(value.stringValue); }
Source:
<code>public Field getField(ColumnIdent path, Operation operation) throws UnsupportedOperationException { if (operation != Operation.READ) { throw new UnsupportedOperationException( "getField on MultiSourceSelect is only supported for READ operations"); } Field field = fields.get(path); if (field == null && !path.isTopLevel()) { for (AnalyzedRelation value : sources.values()) { <START> try { <END> Field childField = value.getField(path, operation); if (childField != null) { return new Field(this, path, childField); } } catch (ColumnUnknownException ignored) { } } return Relations.resolveSubscriptOnAliasedField(path, fields, p -> getField(p, operation)); } return field; }</code><technical_language>missing ambigous column name handling here</technical_language>

Target:
public Field getField(ColumnIdent path, Operation operation) throws UnsupportedOperationException { if (operation != Operation.READ) { throw new UnsupportedOperationException( "getField on MultiSourceSelect is only supported for READ operations"); } Field field = fields.get(path); if (field == null && !path.isTopLevel()) { for (AnalyzedRelation value : sources.values()) { Field childField = null; try { childField = value.getField(path, operation); } catch (ColumnUnknownException ignored) { } if (childField != null) { if (field != null) { throw new AmbiguousColumnException(path, field); } field = new Field(this, path, childField); } } if (field == null) { return Relations.resolveSubscriptOnAliasedField(path, fields, operation); } } return field; }
Source:
<code>public void startUse(GlowPlayer player, ItemStack item) { findArrow: for (ItemStack itemStack : player.getInventory().getContents()) { switch (itemStack.getType()) { case ARROW: if (currentArrow == null) { <START> currentArrow = itemStack; <END> } break; case SPECTRAL_ARROW: case TIPPED_ARROW: currentArrow = itemStack; break findArrow; default: } } if (currentArrow != null) { player.setUsageItem(item); player.setUsageTime(TICKS_TO_FULLY_CHARGE); } }</code><technical_language>I this is implemented. arrow lookup done in endUse: startUse check if *is* arrow somewhere. Suppose player stacks of arrows in inventory. This function determine stack is used, stored in currentArrow. If stack is dropped removed bow pulling (by a plugin whatever), endUse function able find stack this current system. This search done endUse. endUse function find arrow get slot index for stack. Then, summon arrow remove one/delete update slot (inventory.setItem(slot, arrowStack))</technical_language>

Target:
public void startUse(GlowPlayer player, ItemStack item) { if (player.getGameMode() == GameMode.CREATIVE || findArrow(player).isPresent()) { player.setUsageItem(item); player.setUsageTime(TICKS_TO_FULLY_CHARGE); } }
Source:
<code>protected void testExecute() throws Exception { ______TS("Invalid intend, should fail"); <START> String[] invalidIntendParams = generateParameters(firstSessionInCourse1, 1, Intent.FULL_DETAIL, <END> "", "", ""); verifyHttpParameterFailure(invalidIntendParams); testDifferentRecipientTypes(); testModeratedAndPreviewPersonToGetRecipients(); }</code><technical_language>break line high level. suggestion String[] invalidIntendParams = generateParameters(firstSessionInCourse1, 1, Intent.FULL_DETAIL, "", "", "");</technical_language>

Target:
protected void testExecute() throws Exception { }
Source:
<code>public void logout() { <START> mLogoutUseCase.execute(new LogoutUseCase.Callback() { <END> @Override public void onLogoutSuccess() { showLogin(); } @Override public void onLogoutError(String message) { Log.d(TAG, message); } }); }</code><technical_language>Remove this code user do logout, push execute for ever? I logout cancel push process</technical_language>

Target:
public void logout() { AlarmPushReceiver.cancelPushAlarm(mBaseActivity); mLogoutUseCase.execute(new LogoutUseCase.Callback() { @Override public void onLogoutSuccess() { showLogin(); } @Override public void onLogoutError(String message) { Log.d(TAG, message); } }); }
Source:
<code>public static JaxrsMetamodel get(final IProject project) throws CoreException { if (project == null || !project.isOpen()) { return null; } <START> return get(JavaCore.create(project), false); <END> }</code><technical_language>reason this method require IJavaProject</technical_language>

Target:
public static JaxrsMetamodel get(final IProject project) throws CoreException { if (project == null) { return null; } if (!project.isOpen()) { Logger.debug("*** Returning a null Metamodel because the given project is closed (or not opened yet) ***"); return null; } return get(JavaCore.create(project), false); }
Source:
<code><START> public void syncEntitiesForUser(User user) { <END> List<Token> githubByUserId = tokenDAO.findGithubByUserId(user.getId()); if (githubByUserId.isEmpty()) { String msg = "The user does not have a GitHub token, please create one"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); } else { syncEntities(user, githubByUserId.get(0)); } }</code><technical_language>able get protected</technical_language>

Target:
protected void syncEntitiesForUser(User user) { List<Token> githubByUserId = tokenDAO.findGithubByUserId(user.getId()); if (githubByUserId.isEmpty()) { String msg = "The user does not have a GitHub token, please create one"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); } else { syncEntities(user, githubByUserId.get(0)); } }
Source:
<code>protected void setValuesFromAlignment(final SAMRecord rec, final SAMRecord alignment) { for (final SAMRecord.SAMTagAndValue attr : alignment.getAttributes()) { if ((!isReservedTag(attr.tag) || this.attributesToRetain.contains(attr.tag)) && !this.attributesToRemove.contains(attr.tag)) { rec.setAttribute(attr.tag, attr.value); } } rec.setReadUnmappedFlag(alignment.getReadUnmappedFlag()); rec.setReferenceName(alignment.getReferenceName()); rec.setAlignmentStart(alignment.getAlignmentStart()); rec.setReadNegativeStrandFlag(alignment.getReadNegativeStrandFlag()); rec.setNotPrimaryAlignmentFlag(alignment.getNotPrimaryAlignmentFlag()); rec.setSupplementaryAlignmentFlag(alignment.getSupplementaryAlignmentFlag()); if (!alignment.getReadUnmappedFlag()) { rec.setCigar(alignment.getCigar()); rec.setMappingQuality(alignment.getMappingQuality()); } if (rec.getReadPairedFlag()) { rec.setProperPairFlag(alignment.getProperPairFlag()); } if (rec.getReadNegativeStrandFlag()) { <START> rec.reverseComplement(); <END> } }</code><technical_language>default changed, in order for rec.reverseComplement() remain in-place operation (instead of making a copy), this rec.reverseComplement(true); though, planning changing this in #663, behavior currently is in this PR. a usage of SamRecordUtil.reverseComplement in RevertSam. update rec.reverseComplement(true)</technical_language>

Target:
protected void setValuesFromAlignment(final SAMRecord rec, final SAMRecord alignment) { for (final SAMRecord.SAMTagAndValue attr : alignment.getAttributes()) { if ((!isReservedTag(attr.tag) || this.attributesToRetain.contains(attr.tag)) && !this.attributesToRemove.contains(attr.tag)) { rec.setAttribute(attr.tag, attr.value); } } rec.setReadUnmappedFlag(alignment.getReadUnmappedFlag()); rec.setReferenceName(alignment.getReferenceName()); rec.setAlignmentStart(alignment.getAlignmentStart()); rec.setReadNegativeStrandFlag(alignment.getReadNegativeStrandFlag()); rec.setNotPrimaryAlignmentFlag(alignment.getNotPrimaryAlignmentFlag()); rec.setSupplementaryAlignmentFlag(alignment.getSupplementaryAlignmentFlag()); if (!alignment.getReadUnmappedFlag()) { rec.setCigar(alignment.getCigar()); rec.setMappingQuality(alignment.getMappingQuality()); } if (rec.getReadPairedFlag()) { rec.setProperPairFlag(alignment.getProperPairFlag()); } if (rec.getReadNegativeStrandFlag()) { rec.reverseComplement(true); } }
Source:
<code>public Mono<T> doWith(@Nullable Document document) { if (document == null) { return Mono.empty(); } <START> T materializedEntity = reader.read(type, document); <END> return maybeCallAfterConvert(materializedEntity, document, index); }</code><technical_language>entity</technical_language>

Target:
public Mono<T> doWith(@Nullable Document document) { if (document == null) { return Mono.empty(); } T entity = reader.read(type, document); return maybeCallAfterConvert(entity, document, index); }
Source:
<code>private void writeServiceProviderMetadataToResource(final String tempMetadata) throws Exception { final WritableResource metadataResource = configuration.getServiceProviderMetadataResource(); if (metadataResource != null && CommonHelper.isNotBlank(tempMetadata)) { if (metadataResource.exists() && !configuration.isForceServiceProviderMetadataGeneration()) { <START> logger.info("Metadata file already exists at {}.", metadataResource.getFilename()); <END> } else { logger.info("Writing sp metadata to {}", metadataResource.getFilename()); File resourceFile; try { resourceFile = metadataResource.getFile(); if (resourceFile != null) { final File parent = resourceFile.getParentFile(); if (parent != null) { logger.info("Attempting to create directory structure for: {}", parent.getCanonicalPath()); if (!parent.exists() && !parent.mkdirs()) { logger.warn("Could not construct the directory structure for SP metadata: {}", parent.getCanonicalPath()); } } } } catch (UnsupportedOperationException e) { logger.warn("no filesystem", e); } final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{<LINK_0>}indent-amount", "4"); final StreamResult result = new StreamResult(new StringWriter()); final StreamSource source = new StreamSource(new StringReader(tempMetadata)); transformer.transform(source, result); try (final OutputStream spMetadataOutputStream = metadataResource.getOutputStream()) { spMetadataOutputStream.write(result.getWriter().toString().getBytes(StandardCharsets.UTF_8)); } } } }</code><technical_language>Log resource, file name. writeable-resource implementations in fact a filename, I suspect throw exception. please adjust log message. resource a file message says</technical_language>

Target:
private void writeServiceProviderMetadataToResource(final String tempMetadata) throws Exception { final WritableResource metadataResource = configuration.getServiceProviderMetadataResource(); if (metadataResource != null && CommonHelper.isNotBlank(tempMetadata)) { if (metadataResource.exists() && !configuration.isForceServiceProviderMetadataGeneration()) { logger.info("Metadata resource already exists at {}.", metadataResource); } else { logger.info("Writing sp metadata to {}", metadataResource); configuration.getMetadataResolverFactory().getInstance(metadataResource).createParentDirectories(); final Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{<LINK_0>}indent-amount", "4"); final StreamResult result = new StreamResult(new StringWriter()); final StreamSource source = new StreamSource(new StringReader(tempMetadata)); transformer.transform(source, result); try (final OutputStream spMetadataOutputStream = metadataResource.getOutputStream()) { spMetadataOutputStream.write(result.getWriter().toString().getBytes(StandardCharsets.UTF_8)); } } } }
Source:
<code>public Fork create( @NotNull(message = "organization can't be NULL") final String organization) { <START> return new Fork() { <END> @Override public JsonObject json() throws IOException { return RtForks.this.request.method(Request.POST) .body().set( Json.createObjectBuilder() .add("organization", organization) .build() ) .back().fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_ACCEPTED) .as(JsonResponse.class).json().readObject(); } }; }</code><technical_language>a good idea anonymous class here, I leave is in nearest future Forks refactored (because Fork is Repo)</technical_language>

Target:
public Fork create( @NotNull(message = "organization can't be NULL") final String organization) { return new Fork() { @Override public JsonObject json() throws IOException { return RtForks.this.request.method(Request.POST) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_ACCEPTED) .as(JsonResponse.class).json().readObject(); } @Override public int number() { throw new UnsupportedOperationException(""); } @Override public void patch(final JsonObject json) throws IOException { throw new UnsupportedOperationException(""); } }; }
Source:
<code>public void bCreateClaimAndUpdateStandaloneTask() { String authenticatedUserId = securityManager.getAuthenticatedUserId(); Task standaloneTask = taskRuntime.create(TaskPayloadBuilder.create() .withName("test task update") .withDescription("test task update description") .withDueDate(new Date()) .withPriority(50) .build()); assertThat(RuntimeTestConfiguration.createdTasks).contains(standaloneTask.getId()); Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 50)); assertThat(tasks.getTotalItems()).isEqualTo(2); assertThat(tasks.getContent()) .extracting("status", "id") .contains(tuple(Task.TaskStatus.CREATED, standaloneTask.getId())); final UpdateTaskPayload updateTaskPayload = TaskPayloadBuilder.update() .withTaskId(standaloneTask.getId()) .withName(standaloneTask.getName() + " [UPDATED]") .withPriority(60) .withDueDate(new Date()) .withDescription(standaloneTask.getDescription() + " [UPDATED]") .build(); Throwable thrown = catchThrowable(() -> taskRuntime.update(updateTaskPayload)); assertThat(thrown).isInstanceOf(IllegalStateException.class).hasMessage("You cannot update a task where you are not the assignee"); taskRuntime.claim(TaskPayloadBuilder.claim().withTaskId(standaloneTask.getId()).build()); final Task updatedTask = taskRuntime.update(updateTaskPayload); tasks = taskRuntime.tasks(Pageable.of(0, 50)); assertThat(RuntimeTestConfiguration.updatedTasks).contains(updatedTask.getId()); <START> assertThat(tasks.getTotalItems()).isEqualTo(2); <END> assertThat(tasks.getContent()) .extracting("status", "id") .contains(tuple(Task.TaskStatus.ASSIGNED, standaloneTask.getId())); }</code><technical_language>here, I need check total elements</technical_language>

Target:
public void bCreateClaimAndUpdateStandaloneTask() { Task standaloneTask = taskRuntime.create(TaskPayloadBuilder.create() .withName("test task update") .withDescription("test task update description") .withDueDate(new Date()) .withPriority(50) .build()); assertThat(RuntimeTestConfiguration.createdTasks).contains(standaloneTask.getId()); Page<Task> tasks = taskRuntime.tasks(Pageable.of(0, 50)); assertThat(tasks.getTotalItems()).isEqualTo(2); assertThat(tasks.getContent()) .extracting("status", "id") .contains(tuple(Task.TaskStatus.CREATED, standaloneTask.getId())); final UpdateTaskPayload updateTaskPayload = TaskPayloadBuilder.update() .withTaskId(standaloneTask.getId()) .withName(standaloneTask.getName() + " [UPDATED]") .withPriority(60) .withDueDate(new Date()) .withDescription(standaloneTask.getDescription() + " [UPDATED]") .build(); Throwable thrown = catchThrowable(() -> taskRuntime.update(updateTaskPayload)); assertThat(thrown).isInstanceOf(IllegalStateException.class).hasMessage("You cannot update a task where you are not the assignee"); taskRuntime.claim(TaskPayloadBuilder.claim().withTaskId(standaloneTask.getId()).build()); final Task updatedTask = taskRuntime.update(updateTaskPayload); tasks = taskRuntime.tasks(Pageable.of(0, 50)); assertThat(RuntimeTestConfiguration.updatedTasks).contains(updatedTask.getId()); assertThat(tasks.getContent()) .extracting("status", "id") .contains(tuple(Task.TaskStatus.ASSIGNED, standaloneTask.getId())); }
Source:
<code>private void executeLocalOperation(final DataOperation operation) { final DataOpType operationType = operation.getOperationType(); final String dataType = operation.getDataType(); final long key = operation.getDataKey(); final Object value = operation.getDataValue(); final boolean result; Object outputData = null; readWriteLock.writeLock().lock(); try { <START> if (operationType == DataOpType.PUT) { <END> if (!dataMap.containsKey(dataType)) { dataMap.put(dataType, new TreeMap<Long, Object>()); } dataMap.get(dataType).put(key, value); result = true; } else if (operationType == DataOpType.GET) { result = dataMap.containsKey(dataType); outputData = result ? dataMap.get(dataType).get(key) : null; } else if (operationType == DataOpType.REMOVE) { if (!dataMap.containsKey(dataType)) { result = false; } else { result = dataMap.get(dataType).remove(key) != null; } } else { throw new RuntimeException("Undefined operation"); } } finally { readWriteLock.writeLock().unlock(); } resultHandler.handleLocalResult(operation, result, outputData); }</code><technical_language>Please replace this if-else switch statement</technical_language>

Target:
private void executeLocalOperation(final DataOperation operation) { final DataOpType operationType = operation.getOperationType(); final String dataType = operation.getDataType(); final long key = operation.getDataKey(); final Object value = operation.getDataValue().get(); final boolean result; final Object outputData; switch (operationType) { case PUT: readWriteLock.writeLock().lock(); try { if (!dataMap.containsKey(dataType)) { dataMap.put(dataType, new TreeMap<Long, Object>()); } dataMap.get(dataType).put(key, value); result = true; outputData = null; } finally { readWriteLock.writeLock().unlock(); } break; case GET: readWriteLock.readLock().lock(); try { result = dataMap.containsKey(dataType); outputData = result ? dataMap.get(dataType).get(key) : null; } finally { readWriteLock.readLock().unlock(); } break; case REMOVE: readWriteLock.writeLock().lock(); try { if (!dataMap.containsKey(dataType)) { result = false; outputData = null; } else { outputData = dataMap.get(dataType).remove(key); result = outputData != null; } } finally { readWriteLock.writeLock().unlock(); } break; default: throw new RuntimeException("Undefined operation"); } resultHandler.handleLocalResult(operation, result, outputData); }
Source:
<code>public String disableEffectsAsString() { StringBuilder disableEffectsBuffer = new <START> StringBuilder(""); <END> int countdown = getWanDisableEffects().size(); for (ConsoleOptions.WanDisableEffects disabledEffect : getWanDisableEffects()) { disableEffectsBuffer.append(disabledEffect.asString()); if (countdown != 1) { disableEffectsBuffer.append(", "); } countdown--; } return disableEffectsBuffer.toString(); }</code><technical_language>if it, i advantage of initializing builder empty string. This affect default c'tor instead</technical_language>

Target:
public String disableEffectsAsString() { StringBuilder disableEffectsBuffer = new StringBuilder(); int countdown = getWanDisableEffects().size(); for (ConsoleOptions.WanDisableEffects disabledEffect : getWanDisableEffects()) { disableEffectsBuffer.append(disabledEffect.asString()); if (countdown != 1) { disableEffectsBuffer.append(", "); } countdown--; } return disableEffectsBuffer.toString(); }
Source:
<code><START> protected AggregateStateId fromString(String s) { <END> checkNotNull(s); final int typeUrlEndIndex = s.indexOf(DIVIDER); checkArgument(typeUrlEndIndex > 0, "Passed string does not contain a type URL."); final String typeUrlString = s.substring(0, typeUrlEndIndex); final TypeUrl typeUrl = TypeUrl.parse(typeUrlString); final int idTypeStartIndex = typeUrlEndIndex + 1; final int idTypeEndIndex = s.indexOf(DIVIDER, idTypeStartIndex); checkArgument(typeUrlEndIndex > 0, "Passed string does not contain the ID type."); final String idTypeString = s.substring(idTypeStartIndex, idTypeEndIndex); final Class idType = idTypeFromString(idTypeString); final String idStringValue = s.substring(idTypeEndIndex + 1); final Object genericId = Stringifiers.fromString(idStringValue, idType); final AggregateStateId result = AggregateStateId.of(genericId, typeUrl); return result; }</code><technical_language>of negative cases tested. Please re-check</technical_language>

Target:
protected AggregateStateId fromString(String s) { checkNotNull(s); final int typeUrlEndIndex = s.indexOf(DIVIDER); checkArgument(typeUrlEndIndex > 0, "Passed string does not contain a type URL."); final String typeUrlString = s.substring(0, typeUrlEndIndex); final TypeUrl typeUrl = TypeUrl.parse(typeUrlString); final int idTypeStartIndex = typeUrlEndIndex + 1; final int idTypeEndIndex = s.indexOf(DIVIDER, idTypeStartIndex); checkArgument(idTypeEndIndex > 0, "Passed string does not contain the ID type."); final String idTypeString = s.substring(idTypeStartIndex, idTypeEndIndex); final Class idType = idTypeFromString(idTypeString); final String idStringValue = s.substring(idTypeEndIndex + 1); final Object genericId = Stringifiers.fromString(idStringValue, idType); final AggregateStateId result = AggregateStateId.of(genericId, typeUrl); return result; }
Source:
<code>public List<String> getGroupsForUser(String userId) { List<String> groups = groupStore.get(userId); if( groups == null ) { groups = new ArrayList<String>(0); } <START> return new java.util.ArrayList<String>(groups); <END> }</code><technical_language>remove package name is in import statements</technical_language>

Target:
public List<String> getGroupsForUser(String userId) { List<String> groups = groupStore.get(userId); if( groups == null ) { groups = new ArrayList<String>(0); } return new ArrayList<String>(groups); }
Source:
<code>static Set<String> dataStreamsUsingTemplate(final ClusterState state, final String templateName) { <START> final Set<String> dataStreams = state.metadata().dataStreams().keySet(); <END> final ComposableIndexTemplate template = state.metadata().templatesV2().get(templateName); if (template == null) { return Collections.emptySet(); } Set<String> matches = new HashSet<>(); template.indexPatterns().forEach(indexPattern -> matches.addAll(dataStreams.stream().filter(stream -> Regex.simpleMatch(indexPattern, stream)).collect(Collectors.toList()))); return matches; }</code><technical_language>pico-optimization: dataStreams needed templateName is confirmed exist</technical_language>

Target:
static Set<String> dataStreamsUsingTemplate(final ClusterState state, final String templateName) { final ComposableIndexTemplate template = state.metadata().templatesV2().get(templateName); if (template == null) { return Collections.emptySet(); } final Set<String> dataStreams = state.metadata().dataStreams().keySet(); Set<String> matches = new HashSet<>(); template.indexPatterns().forEach(indexPattern -> matches.addAll(dataStreams.stream().filter(stream -> Regex.simpleMatch(indexPattern, stream)).collect(Collectors.toList()))); return matches; }
Source:
<code>public void testKeepTagsOnTrash() { DocumentModel file = session.createDocumentModel("/", "foo", "File"); file.setPropertyValue("dc:title", "File1"); file = session.createDocument(file); String file1Id = file.getId(); tagService.tag(session, file1Id, "mytag"); Set<String> tags = tagService.getTags(session, file1Id); assertEquals(Collections.singleton("mytag"), tags); Framework.getService(TrashService.class).trashDocument(file); txFeature.nextTransaction(); <START> file = session.getDocument(file.getRef()); <END> assertTrue(file.isTrashed()); tags = tagService.getTags(session, file1Id); assertEquals(Collections.singleton("mytag"), tags); }</code><technical_language>I a copy/paste of similar code above, note do file.refresh() instead</technical_language>

Target:
public void testKeepTagsOnTrash() { DocumentModel file = session.createDocumentModel("/", "foo", "File"); file.setPropertyValue("dc:title", "File1"); file = session.createDocument(file); String file1Id = file.getId(); tagService.tag(session, file1Id, "mytag"); Set<String> tags = tagService.getTags(session, file1Id); assertEquals(Collections.singleton("mytag"), tags); Framework.getService(TrashService.class).trashDocument(file); txFeature.nextTransaction(); file.refresh(); assertTrue(file.isTrashed()); tags = tagService.getTags(session, file1Id); assertEquals(Collections.singleton("mytag"), tags); }