auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Observable<User> update(final UserSpec spec) { <START> Timber.e("Calling update"); <END> Observable<User> me = getMe(); me = me.map(new Func1<User, User>() { @Override public User call(User user) { Timber.e("getMe map"); String firstName = spec.user().getData().attributes().getFirstName(); String lastName = spec.user().getData().attributes().getLastName(); user.getData().attributes() .firstName(firstName) .lastName(lastName); return user; } }); me = me.flatMap(new Func1<User, Observable<User>>() { @Override public Observable<User> call(User user) { Timber.e("getMe flatmap"); CreateUserRequest request = spec.getCreateUserRequest() .withAttributes(user.getData().attributes()); return update(request); } }); Timber.e("Calling update finished"); return me; }</code><technical_language>Timber.v</technical_language>

Target:
public Observable<User> update(final UserSpec spec) { Timber.v("Calling update"); Observable<User> me = getMe() .flatMap(new Func1<User, Observable<User>>() { @Override public Observable<User> call(User user) { Timber.v("getMe flatmap"); String firstName = spec.user().getData().attributes().getFirstName(); String lastName = spec.user().getData().attributes().getLastName(); user.getData().attributes() .firstName(firstName) .lastName(lastName); CreateUserRequest request = spec.getCreateUserRequest() .withAttributes(user.getData().attributes()); return update(request); } }); Timber.v("Calling update finished"); return me; }
Source:
<code>public PDataType getDataType() { <START> return PDataType.BINARY; <END> }</code><technical_language>I missed this before, want to: - PDataType.BINARY if child expressions data type is fixed width, PDataType.VARBINARY. - implement getByteSize() getMaxLength() return getExpression().getByteSize(). PDataType.BINARY is for fixed width data, expression impl Phoenix fixed width is methods</technical_language>

Target:
public PDataType getDataType() { return PDataType.VARBINARY; }
Source:
<code>private void handleGetProduct(RoutingContext routingContext) { String productID = routingContext.request().getParam("productID"); HttpServerResponse response = routingContext.response(); if (productID == null) { sendError(400, response); } else { <START> client.getConnection(res -> { <END> if (res.failed()) { sendError(500, response); } else { res.result().queryWithParams("SELECT id, name, price, weight FROM products where id = ?", new JsonArray().add(Integer.parseInt(productID)), query -> { if (query.failed()) { sendError(500, response); } else { if (query.result().getNumRows() == 0) { sendError(404, response); } else { response.putHeader("content-type", "application/json").end(query.result().getRows().get(0).encode()); } } }); } }); } }</code><technical_language>Instead of duplicating client.getConnection() in method nice a single method connection pass lambda action</technical_language>

Target:
private void handleGetProduct(RoutingContext routingContext) { String productID = routingContext.request().getParam("productID"); HttpServerResponse response = routingContext.response(); if (productID == null) { sendError(400, response); } else { SQLConnection conn = routingContext.get("conn"); conn.queryWithParams("SELECT id, name, price, weight FROM products where id = ?", new JsonArray().add(Integer.parseInt(productID)), query -> { if (query.failed()) { sendError(500, response); } else { if (query.result().getNumRows() == 0) { sendError(404, response); } else { response.putHeader("content-type", "application/json").end(query.result().getRows().get(0).encode()); } } }); } }
Source:
<code>protected void fireHandlerChanged(final HandlerEvent handlerEvent) { if (handlerEvent == null) { throw new NullPointerException(); } final Object[] listeners = getListeners(); for (Object <START> listener2 : <END> listeners) { final IHandlerListener listener = (IHandlerListener) listener2; listener.handlerChanged(handlerEvent); } }</code><technical_language>rename</technical_language>

Target:
protected void fireHandlerChanged(final HandlerEvent handlerEvent) { if (handlerEvent == null) { throw new NullPointerException(); } final Object[] listeners = getListeners(); for (Object listener : listeners) { final IHandlerListener handlerListener = (IHandlerListener) listener; handlerListener.handlerChanged(handlerEvent); } }
Source:
<code>public void InteractiveMaps_041_VerifyBlockedUsersCannotCreateCustomMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameBlockedAccount, credentials.passwordBlockedAccount, wikiURL); InteractiveMapsPageObject specialMaps = base.openSpecialInteractiveMaps(wikiURL); CreateAMapComponentObject createMap = specialMaps.clickCreateAMap(); CreateACustomMapComponentObject customMap = createMap.clickCustomMap(); String selectedImageName = customMap.getSelectedTemplateImageName(InteractiveMapsContent.selectedTemplateIndex); TemplateComponentObject template = customMap.selectTemplate(InteractiveMapsContent.selectedTemplateIndex); template.verifyTemplateImage(selectedImageName); template.typeMapName(InteractiveMapsContent.mapName); CreatePinTypesComponentObject pinDialog = template.clickNext(); <START> template.verifyErrorExist(); <END> }</code><technical_language>typo, change method name 'verifyErrorExists'</technical_language>

Target:
public void InteractiveMaps_041_VerifyBlockedUsersCannotCreateCustomMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameBlockedAccount, credentials.passwordBlockedAccount, wikiURL); InteractiveMapsPageObject specialMaps = base.openSpecialInteractiveMaps(wikiURL); CreateAMapComponentObject createMap = specialMaps.clickCreateAMap(); CreateACustomMapComponentObject customMap = createMap.clickCustomMap(); String selectedImageName = customMap.getSelectedTemplateImageName(InteractiveMapsContent.selectedTemplateIndex); TemplateComponentObject template = customMap.selectTemplate(InteractiveMapsContent.selectedTemplateIndex); template.verifyTemplateImage(selectedImageName); template.typeMapName(InteractiveMapsContent.mapName); CreatePinTypesComponentObject pinDialog = template.clickNext(); template.verifyErrorExists(); }
Source:
<code>public LayeredConnectionSocketFactory buildSSLSocketFactory(ConnectorDetails connectorDetails) { if (connectorDetails.isVerifySsl()) { return SSLConnectionSocketFactory.getSocketFactory(); <START> } else { <END> try { SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, TRUST_ALL_STRATEGY).build(); return new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE); } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { log.error("Error building SSL socket factory", e); throw new IllegalStateException(e); } } }</code><technical_language>Else is needed</technical_language>

Target:
public LayeredConnectionSocketFactory buildSSLSocketFactory(ConnectorDetails connectorDetails) { if (connectorDetails.isVerifySsl()) { return SSLConnectionSocketFactory.getSocketFactory(); } try { SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, TRUST_ALL_STRATEGY).build(); return new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE); } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { log.error("Error building SSL socket factory", e); throw new IllegalStateException(e); } }
Source:
<code>public void doSetup(ManagementClient managementClient, String containerId) throws Exception { List<ModelNode> operations = new ArrayList<>(); ModelNode addEjbDomain = createOpNode("subsystem=ejb3/application-security-domain=other", ADD); addEjbDomain.get("security-domain").set("ApplicationDomain"); operations.add(addEjbDomain); ModelNode updateRemotingConnector = createOpNode("subsystem=remoting/http-connector=http-remoting-connector", WRITE_ATTRIBUTE_OPERATION); updateRemotingConnector.get(ClientConstants.NAME).set("sasl-authentication-factory"); updateRemotingConnector.get(ClientConstants.VALUE).set("application-sasl-authentication"); operations.add(updateRemotingConnector); ModelNode updateOp = Operations.createCompositeOperation(operations); updateOp.get(OPERATION_HEADERS, ROLLBACK_ON_RUNTIME_FAILURE).set(false); updateOp.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true); CoreUtils.applyUpdate(updateOp, managementClient.getControllerClient()); <START> ServerReload.reloadIfRequired(managementClient.getControllerClient()); <END> }</code><technical_language>Please ServerReload.reloadIfRequired(managementClient);</technical_language>

Target:
public void doSetup(ManagementClient managementClient, String containerId) throws Exception { List<ModelNode> operations = new ArrayList<>(); ModelNode addEjbDomain = createOpNode("subsystem=ejb3/application-security-domain=other", ADD); addEjbDomain.get("security-domain").set("ApplicationDomain"); operations.add(addEjbDomain); ModelNode updateRemotingConnector = createOpNode("subsystem=remoting/http-connector=http-remoting-connector", WRITE_ATTRIBUTE_OPERATION); updateRemotingConnector.get(ClientConstants.NAME).set("sasl-authentication-factory"); updateRemotingConnector.get(ClientConstants.VALUE).set("application-sasl-authentication"); operations.add(updateRemotingConnector); ModelNode updateOp = Operations.createCompositeOperation(operations); updateOp.get(OPERATION_HEADERS, ROLLBACK_ON_RUNTIME_FAILURE).set(false); updateOp.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).set(true); CoreUtils.applyUpdate(updateOp, managementClient.getControllerClient()); ServerReload.reloadIfRequired(managementClient); }
Source:
<code>Mono<Void> send(Flux<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); <START> } else if (options.getPartitionId() == null && this.isIdempotentPartitionPublishing) { <END> return monoError(logger, new IllegalArgumentException("Please set the partition id in `options` " + "because this producer client is an idempotent producer")); } return sendInternal(events, options).publishOn(scheduler); }</code><technical_language>Consistent of this</technical_language>

Target:
Mono<Void> send(Flux<EventData> events, SendOptions options) { if (events == null) { return monoError(logger, new NullPointerException("'events' cannot be null.")); } else if (options == null) { return monoError(logger, new NullPointerException("'options' cannot be null.")); } else if (options.getPartitionId() == null && isIdempotentPartitionPublishing) { return monoError(logger, new IllegalArgumentException("Please set the partition id in `options` " + "because this producer client is an idempotent producer")); } return sendInternal(events, options).publishOn(scheduler); }
Source:
<code>public void searchItem(Actor actor, @Switch(name = 'b', desc = "Only search for blocks") boolean blocksOnly, @Switch(name = 'i', desc = "Only search for items") boolean itemsOnly, @ArgFlag(name = 'p', desc = "Page of results to return", def = "1") int page, @Arg(desc = "Search query", variable = true) List<String> query) { String search = String.join(" ", query); if (search.length() <= 2) { actor.printError(TranslatableComponent.of("worldedit.searchitem.too-short")); return; } if (blocksOnly && itemsOnly) { <START> actor.printError(TranslatableComponent.of("worldedit.searchitem.b-and-i")); <END> return; } WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page), TranslatableComponent.of("worldedit.searchitem.searching")); }</code><technical_language>I feel translation key .no-block-and-item-flags, more verbose</technical_language>

Target:
public void searchItem(Actor actor, @Switch(name = 'b', desc = "Only search for blocks") boolean blocksOnly, @Switch(name = 'i', desc = "Only search for items") boolean itemsOnly, @ArgFlag(name = 'p', desc = "Page of results to return", def = "1") int page, @Arg(desc = "Search query", variable = true) List<String> query) { String search = String.join(" ", query); if (search.length() <= 2) { actor.printError(TranslatableComponent.of("worldedit.searchitem.too-short")); return; } if (blocksOnly && itemsOnly) { actor.printError(TranslatableComponent.of("worldedit.searchitem.either-b-or-i")); return; } WorldEditAsyncCommandBuilder.createAndSendMessage(actor, new ItemSearcher(search, blocksOnly, itemsOnly, page), TranslatableComponent.of("worldedit.searchitem.searching")); }
Source:
<code>public void removeUnusedBackupTables(TransactionController tc) throws StandardException { SchemaDescriptor sd = getSystemSchemaDescriptor(); TableDescriptor td = getTableDescriptor("SYSBACKUPFILESET", sd, tc); if (td != null) { <START> dropTableDescriptor(td, sd, tc); <END> } td = getTableDescriptor("SYSBACKUPJOBS", sd, tc); if (td != null) { dropTableDescriptor(td, sd, tc); } }</code><technical_language>Is enough drop table descriptor if want remove unused backup tables? columns of tables, conglomerate index conglomerates tables? DropTableConstantOperation.executeConstantAction(), dropping a user table more do. Is similar for dictionary table? Thanks</technical_language>

Target:
public void removeUnusedBackupTables(TransactionController tc) throws StandardException { dropUnusedBackupTable("SYSBACKUPFILESET", tc); dropUnusedBackupTable("SYSBACKUPJOBS", tc); }
Source:
<code>private int processCurrentGroupStructureSynchronizationThreads() { int timeout = BeansUtils.getCoreConfig().getGroupStructureSynchronizationTimeout(); int numberOfNewlyRemovedThreads = 0; Iterator<GroupStructureSynchronizerThread> threadIterator = groupStructureSynchronizerThreads.iterator(); while(threadIterator.hasNext()) { GroupStructureSynchronizerThread thread = threadIterator.next(); <START> long threadStart = thread.getStartTime(); <END> if(threadStart == 0) continue; long timeDiff = System.currentTimeMillis() - threadStart; if (thread.isInterrupted()) { numberOfNewlyRemovedThreads++; threadIterator.remove(); } else if(timeDiff/1000/60 > timeout) { log.error("One of threads was interrupted because of timeout!"); thread.interrupt(); threadIterator.remove(); numberOfNewlyRemovedThreads++; } } return numberOfNewlyRemovedThreads; }</code><technical_language>I lines merged</technical_language>

Target:
private int processCurrentGroupStructureSynchronizationThreads() { int timeoutMinutes = BeansUtils.getCoreConfig().getGroupStructureSynchronizationTimeout(); int numberOfNewlyRemovedThreads = 0; Iterator<GroupStructureSynchronizerThread> threadIterator = groupStructureSynchronizerThreads.iterator(); while(threadIterator.hasNext()) { GroupStructureSynchronizerThread thread = threadIterator.next(); long threadStart = thread.getStartTime(); if (threadStart == 0) continue; long timeDiff = System.currentTimeMillis() - threadStart; if (thread.isInterrupted()) { numberOfNewlyRemovedThreads++; threadIterator.remove(); } else if(timeDiff/1000/60 > timeoutMinutes) { log.error("One of threads was interrupted because of timeout!"); thread.interrupt(); threadIterator.remove(); numberOfNewlyRemovedThreads++; } } return numberOfNewlyRemovedThreads; }
Source:
<code><START> private boolean containsChangeOrCommit(String newRef, List<String> refs) { <END> String compareStr = newRef.replaceFirst("/heads/", "/for/"); for (String ref : refs) { if(compareStr.equals(ref.replaceFirst("/heads/", "/for/"))) { return true; } } return false; }</code><technical_language>Needs name. Static</technical_language>

Target:
private static boolean containsChangeOrCommit(String newRef, List<String> refs) { String compareStr = newRef.replaceFirst("/heads/", "/for/"); for (String ref : refs) { if (compareStr.equals(ref.replaceFirst("/heads/", "/for/"))) { return true; } } return false; }
Source:
<code>KafkaSpoutConfig<String, String> createSpoutConfig() { return SingleTopicKafkaSpoutConfiguration.setCommonSpoutConfig( KafkaSpoutConfig.builder("127.0.0.1:" + kafkaUnitRule.getKafkaUnit().getKafkaPort(), Pattern.compile(SingleTopicKafkaSpoutConfiguration.TOPIC))) .setOffsetCommitPeriodMs(commitOffsetPeriodMs) <START> .setRetry(new KafkaSpoutRetryExponentialBackoff(KafkaSpoutRetryExponentialBackoff.TimeInterval.seconds(0), KafkaSpoutRetryExponentialBackoff.TimeInterval.seconds(0), <END> maxRetries, KafkaSpoutRetryExponentialBackoff.TimeInterval.seconds(0))) .setFirstPollOffsetStrategy(KafkaSpoutConfig.FirstPollOffsetStrategy.EARLIEST) .setProp(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, maxPollRecords) .build(); }</code><technical_language>unnecessary</technical_language>

Target:
KafkaSpoutConfig<String, String> createSpoutConfig() { return SingleTopicKafkaSpoutConfiguration.setCommonSpoutConfig( KafkaSpoutConfig.builder("127.0.0.1:" + kafkaUnitRule.getKafkaUnit().getKafkaPort(), Pattern.compile(SingleTopicKafkaSpoutConfiguration.TOPIC))) .setOffsetCommitPeriodMs(commitOffsetPeriodMs) .setFirstPollOffsetStrategy(KafkaSpoutConfig.FirstPollOffsetStrategy.EARLIEST) .build(); }
Source:
<code>private void deleteProject(URIish replicateURI) { if (!replicateURI.isRemote()) { deleteLocally(replicateURI); } else if (isSSH(replicateURI)) { deleteRemoteSsh(replicateURI); } else { log.warn(String.format("Cannot delete project on remote site %s." + " Only local paths and SSH URLs are supported" <START> + " for remote repository creation", replicateURI)); <END> } }</code><technical_language>s/creation/deletion</technical_language>

Target:
private void deleteProject(URIish replicateURI) { if (!replicateURI.isRemote()) { deleteLocally(replicateURI); } else if (isSSH(replicateURI)) { deleteRemoteSsh(replicateURI); } else { log.warn(String.format("Cannot delete project on remote site %s." + " Only local paths and SSH URLs are supported" + " for remote repository deletion", replicateURI)); } }
Source:
<code>static InboxSignalId newSignalId(Object targetId, String uuid) { checkNotNull(targetId); checkNotNull(uuid); <START> String rawValue = uuid + " @" + Stringifiers.toString(targetId); <END> InboxSignalId result = InboxSignalId.newBuilder() .setValue(rawValue) .build(); return result; }</code><technical_language>Is space @ intentional? Some third-party systems allow for replace spaces some other characters</technical_language>

Target:
static InboxSignalId newSignalId(Object targetId, String uuid) { checkNotNull(targetId); checkNotNull(uuid); String rawValue = uuid + '@' + Stringifiers.toString(targetId); InboxSignalId result = InboxSignalId.newBuilder() .setValue(rawValue) .build(); return result; }
Source:
<code>public Indexer(Config config, Deduper deduper) { this.config = config; this.deduper = deduper; this.localDatabase = new SqlDatabase(config); try { <START> localDatabase.getConnection().setReadOnly(true); <END> } catch (SQLException e) { e.printStackTrace(); } this.eventBus = LocalEventBus.getInstance(); }</code><technical_language>try/catch block in a constructor e.printStackTrace()? this SqlDatabase.createReadOnly(config); something</technical_language>

Target:
public Indexer(Config config, Deduper deduper) { this.config = config; this.deduper = deduper; this.localDatabase = new SqlDatabase(config, true); this.eventBus = LocalEventBus.getInstance(); }
Source:
<code>public void runTask(final int protectionTime, final int waitTime, final Player player) { this.task = new BukkitRunnable() { @Override public void run() { ArrowBlocker.this.livingTime++; isActive = true; if (protectionTime > 0 && ArrowBlocker.this.livingTime == protectionTime) { player.sendMessage(ChatWriter.pluginMessage(Main._l("ingame.specials.arrow-blocker.end"))); isActive = false; } if (ArrowBlocker.this.livingTime >= waitTime && ArrowBlocker.this.livingTime >= protectionTime) { ArrowBlocker.this.game.removeRunningTask(this); ArrowBlocker.this.game.removeSpecialItem(ArrowBlocker.this); ArrowBlocker.this.task = null; isActive = false; this.cancel(); return; } } <START> }.runTaskTimer(Main.getInstance(), 20L, 20L); <END> this.game.addRunningTask(this.task); }</code><technical_language>Delay needed. removed myself</technical_language>

Target:
public void runTask(final int protectionTime, final int waitTime, final Player player) { this.task = new BukkitRunnable() { @Override public void run() { ArrowBlocker.this.livingTime++; if (protectionTime > 0 && ArrowBlocker.this.livingTime == protectionTime) { player.sendMessage(ChatWriter.pluginMessage(Main._l("ingame.specials.arrow-blocker.end"))); isActive = false; } if (ArrowBlocker.this.livingTime >= waitTime && ArrowBlocker.this.livingTime >= protectionTime) { ArrowBlocker.this.game.removeRunningTask(this); ArrowBlocker.this.game.removeSpecialItem(ArrowBlocker.this); ArrowBlocker.this.task = null; isActive = false; this.cancel(); return; } } }.runTaskTimer(Main.getInstance(), 0, 20L); this.game.addRunningTask(this.task); }
Source:
<code>private Map<String, byte[]> getAttributeContent(Mail mail) throws MailetException { Serializable attributeContent = mail.getAttribute(attribute); if (! (attributeContent instanceof Map)) { LOGGER.debug("Invalid attribute found into attribute " + "{} class Map expected but " <START> + "{} found.", attribute, attributeContent.getClass()); <END> return ImmutableMap.of(); } return (Map<String, byte[]>) attributeContent; }</code><technical_language>inline string is concatenation anymore</technical_language>

Target:
private Map<String, byte[]> getAttributeContent(Mail mail) throws MailetException { Serializable attributeContent = mail.getAttribute(attribute); if (! (attributeContent instanceof Map)) { LOGGER.debug("Invalid attribute found into attribute class Map expected but found.", attribute, attributeContent.getClass()); return ImmutableMap.of(); } return (Map<String, byte[]>) attributeContent; }
Source:
<code>public static String tokenizerToJson(Tokenizer tokenizer) { Map<String, String> settingsMap = new HashMap<String, String>(); if (tokenizer != null) { settingsMap.put(TOKENIZE, tokenizer.tokenizerName); settingsMap.put(TOKENIZE_ARGS, tokenizer.tokenizerArguments); } <START> return new String(JSONUtils.serializeAsBytes(settingsMap), Charset.forName("UTF-8")); <END> }</code><technical_language>reason simpler JSONUtils.serializeAsString(Map)</technical_language>

Target:
public static String tokenizerToJson(Tokenizer tokenizer) { Map<String, String> settingsMap = new HashMap<String, String>(); if (tokenizer != null) { settingsMap.put(TOKENIZE, tokenizer.tokenizerName); settingsMap.put(TOKENIZE_ARGS, tokenizer.tokenizerArguments); } return JSONUtils.serializeAsString(settingsMap); }
Source:
<code><START> public void dropTable(String tableName) throws UndefinedTableException, InsufficientPrivilegeException { <END> String[] splitted = CatalogUtil.splitFQTableName(tableName); final String databaseName = splitted[0]; final String simpleName = splitted[1]; try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, simpleName); final ReturnState state = stub.dropTable(null, request); throwsIfThisError(state, UndefinedTableException.class); throwsIfThisError(state, InsufficientPrivilegeException.class); ensureOk(state); } catch (ServiceException e) { throw new RuntimeException(e); } }</code><technical_language>UndefinedDatabaseException handled</technical_language>

Target:
public void dropTable(String tableName) throws UndefinedDatabaseException, UndefinedTableException, InsufficientPrivilegeException { String[] splitted = CatalogUtil.splitFQTableName(tableName); final String databaseName = splitted[0]; final String simpleName = splitted[1]; try { final BlockingInterface stub = getStub(); final TableIdentifierProto request = buildTableIdentifier(databaseName, simpleName); final ReturnState state = stub.dropTable(null, request); throwsIfThisError(state, UndefinedDatabaseException.class); throwsIfThisError(state, UndefinedTableException.class); throwsIfThisError(state, InsufficientPrivilegeException.class); ensureOk(state); } catch (ServiceException e) { throw new RuntimeException(e); } }
Source:
<code>public Object clone() throws CloneNotSupportedException { CreateTable createTable = (CreateTable) super.clone(); createTable.external = external; createTable.tableName = tableName; if (tableElements != null) { <START> createTable.tableElements = new ColumnDefinition[tableElements.length]; <END> } createTable.storageType = storageType; createTable.location = location; createTable.subquery = subquery; createTable.params = new HashMap<String, String>(params); createTable.partition = (PartitionMethodDescExpr) partition.clone(); createTable.ifNotExists = ifNotExists; return createTable; }</code><technical_language>table elements cloned</technical_language>

Target:
public Object clone() throws CloneNotSupportedException { CreateTable createTable = (CreateTable) super.clone(); createTable.external = external; createTable.tableName = tableName; if (tableElements != null) { createTable.tableElements = new ColumnDefinition[tableElements.length]; for (int i = 0; i < tableElements.length; i++) { createTable.tableElements[i] = (ColumnDefinition) tableElements[i].clone(); } } createTable.storageType = storageType; createTable.location = location; createTable.subquery = subquery; createTable.params = new HashMap<String, String>(params); createTable.partition = (PartitionMethodDescExpr) partition.clone(); createTable.ifNotExists = ifNotExists; return createTable; }
Source:
<code>public WindowAggProjection(StreamInput in) throws IOException { windowDefinition = new WindowDefinition(in); <START> startFrameOffset = in.readGenericValue(); <END> endFrameOffset = in.readGenericValue(); standaloneWithInputs = Symbols.listFromStream(in); int functionsCount = in.readVInt(); functionsWithInputs = new LinkedHashMap<>(functionsCount, 1f); for (int i = 0; i < functionsCount; i++) { WindowFunction function = (WindowFunction) Symbols.fromStream(in); List<Symbol> inputs = Symbols.listFromStream(in); functionsWithInputs.put(function, inputs); } outputs = new ArrayList<>(functionsWithInputs.keySet()); }</code><technical_language>a typed streamer based windowDefinition symbols/value type? if sense / is worth it</technical_language>

Target:
public WindowAggProjection(StreamInput in) throws IOException { windowDefinition = new WindowDefinition(in); if (in.getVersion().onOrAfter(Version.V_4_1_0)) { startFrameOffset = in.readGenericValue(); endFrameOffset = in.readGenericValue(); } standaloneWithInputs = Symbols.listFromStream(in); int functionsCount = in.readVInt(); functionsWithInputs = new LinkedHashMap<>(functionsCount, 1f); for (int i = 0; i < functionsCount; i++) { WindowFunction function = (WindowFunction) Symbols.fromStream(in); List<Symbol> inputs = Symbols.listFromStream(in); functionsWithInputs.put(function, inputs); } outputs = new ArrayList<>(functionsWithInputs.keySet()); }
Source:
<code>public int getStatus() { <START> return status; <END> }</code><technical_language>return ExitCode instead</technical_language>

Target:
public ExitCode getStatus() { return status; }
Source:
<code>private void initCommitsMap() { commitsMap = new HashMap<String, PlotCommit>(); <START> for (PlotCommit commit : allCommits) { <END> commitsMap.put(commit.getId().name(), commit); } }</code><technical_language>please remove brackets brackets for single line statements</technical_language>

Target:
private void initCommitsMap() { commitsMap = new HashMap<String, PlotCommit>(); for (PlotCommit commit : allCommits) commitsMap.put(commit.getId().name(), commit); }
Source:
<code>protected void sanityCheckTableMetadata(TableReference tableRef, byte[] tableMetadata) { if (tableMetadata == null || Arrays.equals(tableMetadata, AtlasDbConstants.EMPTY_TABLE_METADATA)) { throw new IllegalArgumentException( String.format( <START> "Passing in empty table metadata for table '%s' does not make sense, and is disallowed.", <END> tableRef)); } }</code><technical_language>This message snarky :) recommend AtlasDbConstants.GENERIC_TABLE_METADATA</technical_language>

Target:
protected static void sanityCheckTableMetadata(TableReference tableRef, byte[] tableMetadata) { if (tableMetadata == null || Arrays.equals(tableMetadata, AtlasDbConstants.EMPTY_TABLE_METADATA)) { throw new IllegalArgumentException( String.format( "Passing in empty table metadata for table '%s' is disallowed," + " as reasoning about such tables is hard. Consider using" + " AtlasDbConstants.GENERIC_TABLE_METADATA instead.", tableRef)); } }
Source:
<code>public void testBackLogout() { final CasConfiguration configuration = new CasConfiguration(); configuration.setLoginUrl(LOGIN_URL); final CasClient casClient = new CasClient(configuration); casClient.setCallbackUrl(CALLBACK_URL); casClient.init(null); final MockWebContext context = MockWebContext.create().addRequestParameter(CasConfiguration.LOGOUT_REQUEST_PARAMETER, LOGOUT_MESSAGE) .setRequestMethod("POST"); TestsHelper.expectException(() -> casClient.getCredentials(context), HttpAction.class, "back logout request: no credential returned"); <START> assertEquals(204, context.getResponseStatus()); <END> }</code><technical_language>HTTP_NO_CONTENT is a safe add CAS ask: 204? change logout endpoint produces a 204? for CAS</technical_language>

Target:
public void testBackLogout() { final CasConfiguration configuration = new CasConfiguration(); configuration.setLoginUrl(LOGIN_URL); final CasClient casClient = new CasClient(configuration); casClient.setCallbackUrl(CALLBACK_URL); casClient.init(null); final MockWebContext context = MockWebContext.create().addRequestParameter(CasConfiguration.LOGOUT_REQUEST_PARAMETER, LOGOUT_MESSAGE) .setRequestMethod("POST"); TestsHelper.expectException(() -> casClient.getCredentials(context), HttpAction.class, "back logout request: no credential returned"); assertEquals(200, context.getResponseStatus()); }
Source:
<code>public void setTaskStatus(final JobId jobId, final TaskStatus status) throws InterruptedException { log.debug("setting task status: {}", status); taskStatuses.put(jobId.toString(), status.toJsonBytes()); if (historyWriter != null) { try { historyWriter.saveHistoryItem(status); } catch (Exception e) { log.error("Error saving task status to ZooKeeper: {}", status, e); } } final TaskStatusEvent event = new TaskStatusEvent(status, System.currentTimeMillis(), agent); final byte[] message = event.toJsonBytes(); for (final EventSender sender : eventSenders) { <START> sender.send(TaskStatusEvent.KAFKA_TOPIC, message); <END> } }</code><technical_language>rename this constant TASK_STATUS_EVENT_TOPIC kafka specific anymore. DEPLOYMENT_GROUP_EVENTS_KAFKA_TOPIC</technical_language>

Target:
public void setTaskStatus(final JobId jobId, final TaskStatus status) throws InterruptedException { log.debug("setting task status: {}", status); taskStatuses.put(jobId.toString(), status.toJsonBytes()); if (historyWriter != null) { try { historyWriter.saveHistoryItem(status); } catch (Exception e) { log.error("Error saving task status to ZooKeeper: {}", status, e); } } final TaskStatusEvent event = new TaskStatusEvent(status, System.currentTimeMillis(), agent); final byte[] message = event.toJsonBytes(); for (final EventSender sender : eventSenders) { sender.send(TaskStatusEvent.TASK_STATUS_EVENT_TOPIC, message); } }
Source:
<code>protected void executeCommand() { <START> handleVmLease(); <END> TransactionSupport.executeInNewTransaction(() -> { initImportClonedTemplateDisks(); addVmTemplateToDb(); addPermissionsToDB(); updateOriginalTemplateNameOnDerivedVms(); addVmInterfaces(); getCompensationContext().stateChanged(); vmHandler.addVmInitToDB(getVmTemplate().getVmInit()); return null; }); boolean doesVmTemplateContainImages = !getImages().isEmpty(); if (doesVmTemplateContainImages && !getParameters().isImagesExistOnTargetStorageDomain()) { moveOrCopyAllImageGroups(getVmTemplateId(), getImages()); } getVmDeviceUtils().addImportedDevices(getVmTemplate(), getParameters().isImportAsNewEntity(), false); if (!doesVmTemplateContainImages || getParameters().isImagesExistOnTargetStorageDomain()) { endMoveOrCopyCommand(); } discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmTemplateId()); checkTrustedService(); incrementDbGeneration(); setSucceeded(true); }</code><technical_language>is of transaction</technical_language>

Target:
protected void executeCommand() { TransactionSupport.executeInNewTransaction(() -> { handleVmLease(); initImportClonedTemplateDisks(); addVmTemplateToDb(); addPermissionsToDB(); updateOriginalTemplateNameOnDerivedVms(); addVmInterfaces(); getCompensationContext().stateChanged(); vmHandler.addVmInitToDB(getVmTemplate().getVmInit()); return null; }); boolean doesVmTemplateContainImages = !getImages().isEmpty(); if (doesVmTemplateContainImages && !getParameters().isImagesExistOnTargetStorageDomain()) { moveOrCopyAllImageGroups(getVmTemplateId(), getImages()); } getVmDeviceUtils().addImportedDevices(getVmTemplate(), getParameters().isImportAsNewEntity(), false); if (!doesVmTemplateContainImages || getParameters().isImagesExistOnTargetStorageDomain()) { endMoveOrCopyCommand(); } discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmTemplateId()); checkTrustedService(); incrementDbGeneration(); setSucceeded(true); }
Source:
<code>public void destroyFolderTest() { PID folderObjPid = objsToDestroy.get(0); initializeJob(Arrays.asList(folderObjPid)); FolderObject folderObj = repoObjLoader.getFolderObject(folderObjPid); <START> WorkObject workObj = repoObjLoader.getWorkObject(folderObj.getMembers().get(0).getPid()); <END> FileObject fileObj = repoObjLoader.getFileObject(workObj.getMembers().get(0).getPid()); job.run(); verify(spyProxyService).destroyProxy(folderObjPid); assertTrue(fileObj.getModel().contains(fileObj.getResource(), RDF.type, Cdr.Tombstone)); assertTrue(workObj.getModel().contains(workObj.getResource(), RDF.type, Cdr.Tombstone)); assertTrue(folderObj.getModel().contains(folderObj.getResource(), RDF.type, Cdr.Tombstone)); }</code><technical_language>cast member instead of re-retrieving it? WorkObject workObj = (WorkObject) folderObj.getMembers().get(0);</technical_language>

Target:
public void destroyFolderTest() { PID folderObjPid = objsToDestroy.get(0); initializeJob(Arrays.asList(folderObjPid)); FolderObject folderObj = repoObjLoader.getFolderObject(folderObjPid); WorkObject workObj = (WorkObject) folderObj.getMembers().get(0); FileObject fileObj = (FileObject) workObj.getMembers().get(0); job.run(); verify(spyProxyService).destroyProxy(folderObjPid); assertTrue(fileObj.getModel().contains(fileObj.getResource(), RDF.type, Cdr.Tombstone)); assertTrue(workObj.getModel().contains(workObj.getResource(), RDF.type, Cdr.Tombstone)); assertTrue(folderObj.getModel().contains(folderObj.getResource(), RDF.type, Cdr.Tombstone)); }
Source:
<code>protected List<String> getChildren(final String path, final boolean watch) { long startT = System.currentTimeMillis(); final int[] connectionLossRetryCount = {0}; try { List<String> children = retryUntilConnected(new Callable<List<String>>() { @Override public List<String> call() throws Exception { try { return getConnection().getChildren(path, watch); } catch (ConnectionLossException e) { ++connectionLossRetryCount[0]; if (connectionLossRetryCount[0] >= 3) { Stat stat = getStat(path); if (stat != null && stat.getNumChildren() > NUM_CHILDREN_LIMIT) { LOG.error("Failed to get children for path because number of children " + "exceeds limit {}, aborting retry.", path, stat.getNumChildren(), NUM_CHILDREN_LIMIT); <START> throw new KeeperException.MarshallingErrorException(); <END> } } throw e; } } }); record(path, null, startT, ZkClientMonitor.AccessType.READ); return children; } catch (ZkNoNodeException e) { record(path, null, startT, ZkClientMonitor.AccessType.READ); throw e; } catch (Exception e) { recordFailure(path, ZkClientMonitor.AccessType.READ); throw e; } finally { long endT = System.currentTimeMillis(); if (LOG.isTraceEnabled()) { LOG.trace("getChildren, path: " + path + ", time: " + (endT - startT) + " ms"); } } }</code><technical_language>If is existing exception reflect real failure here, extend a new ZookeeperException here</technical_language>

Target:
protected List<String> getChildren(final String path, final boolean watch) { long startT = System.currentTimeMillis(); try { List<String> children = retryUntilConnected(new Callable<List<String>>() { private int connectionLossRetryCount = 0; @Override public List<String> call() throws Exception { try { return getConnection().getChildren(path, watch); } catch (ConnectionLossException e) { ++connectionLossRetryCount; if (connectionLossRetryCount >= 3) { checkNumChildrenLimit(path); connectionLossRetryCount = 0; } throw e; } } }); record(path, null, startT, ZkClientMonitor.AccessType.READ); return children; } catch (ZkNoNodeException e) { record(path, null, startT, ZkClientMonitor.AccessType.READ); throw e; } catch (Exception e) { recordFailure(path, ZkClientMonitor.AccessType.READ); throw e; } finally { long endT = System.currentTimeMillis(); if (LOG.isTraceEnabled()) { LOG.trace("getChildren, path: " + path + ", time: " + (endT - startT) + " ms"); } } }
Source:
<code>boolean isAssignmentValid(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { Map<String, Integer> nodeCurrentCapacity = node.getCurrentCapacity(); Map<String, Integer> repCurrentCapacity = replica.getCapacity(); for (String key : repCurrentCapacity.keySet()) { if (nodeCurrentCapacity.containsKey(key)) { if (nodeCurrentCapacity.get(key) < repCurrentCapacity.get(key)) { <START> return false; <END> } } } return true; }</code><technical_language>Simplify boolean? return condition</technical_language>

Target:
boolean isAssignmentValid(AssignableNode node, AssignableReplica replica, ClusterContext clusterContext) { Map<String, Integer> nodeCapacity = node.getCurrentCapacity(); Map<String, Integer> replicaCapacity = replica.getCapacity(); for (String key : replicaCapacity.keySet()) { if (nodeCapacity.containsKey(key)) { if (nodeCapacity.get(key) < replicaCapacity.get(key)) { return false; } } } return true; }
Source:
<code>private static boolean containsDisallowedWords(String str, String[] keywords) { <START> return Arrays.stream(keywords).parallel().anyMatch(str.toUpperCase(Locale.ENGLISH)::contains); <END> }</code><technical_language>faster parallel here. talking a dozen keywords a small set of tables</technical_language>

Target:
private static boolean containsDisallowedWords(String str, String[] keywords) { return Arrays.stream(keywords).anyMatch(str.toUpperCase(Locale.ENGLISH)::contains); }
Source:
<code>public boolean isCheckPointCompleted(){ boolean checkPointCompleted = <START> this.status != GeoRepSessionStatus.FAULTY; <END> for (GlusterGeoRepSessionDetails details : getSessionDetails()) { if (details.getStatus() == GeoRepSessionStatus.ACTIVE && !details.getCheckPointStatus().equals("COMPLETED")) { checkPointCompleted = false; } } return checkPointCompleted; }</code><technical_language>Is this.status == Active sessions in FAULTY state?. If is wrongly mark checkPointCompleted true</technical_language>

Target:
public boolean isCheckPointCompleted(){ boolean checkPointCompleted = this.status != GeoRepSessionStatus.FAULTY; for (GlusterGeoRepSessionDetails details : getSessionDetails()) { if (details.getStatus() == GeoRepSessionStatus.ACTIVE && !details.isCheckpointCompleted()) { checkPointCompleted = false; } } return checkPointCompleted; }
Source:
<code>public void processProduct(ProductSummary product) throws Exception { super.processProduct(product); ExtentSummary extent = new ExtentSummary(product); if (extent.isValid()) { LOGGER.log(Level.FINE, "[" + getName() + "] adding product " <START> + product.getIndexId() <END> + " to extent table"); ((ExtentIndex) productIndex).addExtentSummary(extent); } else { LOGGER.log(Level.FINE, "[" + getName() + "] product " + product.getIndexId() + " has no extent information; won't add to extent table"); } setLastIndexId(product.getIndexId()); }</code><technical_language>Is product id available, instead of index id..</technical_language>

Target:
public void processProduct(ProductSummary product) throws Exception { super.processProduct(product); ExtentSummary extent = new ExtentSummary(product); if (extent.isValid()) { LOGGER.log(Level.FINE, "[" + getName() + "] adding product " + product.getId().toString() + " to extent table"); ((ExtentIndex) productIndex).addExtentSummary(extent); } else { LOGGER.log(Level.FINE, "[" + getName() + "] product " + product.getId().toString() + " has no extent information; won't add to extent table"); } setLastIndexId(product.getIndexId()); }
Source:
<code>private <T> T applyOnNodeChannel(UUID nodeId, Function<ClientChannel, T> function) { ClientChannelHolder hld = null; ClientChannel channel = null; try { hld = nodeChannels.get(nodeId); <START> channel = Optional <END> .ofNullable(hld) .map(ClientChannelHolder::getOrCreateChannel) .orElse(null); if (channel != null) return function.apply(channel); } catch (ClientConnectionException e) { onChannelFailure(hld, channel); } return null; }</code><technical_language>clever, verbose, memory-hungry. channel = hld == null ? null : hld.getOrCreateChannel();</technical_language>

Target:
private <T> T applyOnNodeChannel(UUID nodeId, Function<ClientChannel, T> function) { ClientChannelHolder hld = null; ClientChannel channel = null; try { hld = nodeChannels.get(nodeId); channel = hld != null ? hld.getOrCreateChannel() : null; if (channel != null) return function.apply(channel); } catch (ClientConnectionException e) { onChannelFailure(hld, channel); } return null; }
Source:
<code>public FSLeafQueue getQueue() { <START> return (FSLeafQueue)super.getQueue(); <END> }</code><technical_language>this more defensive, i.e. check for type casting</technical_language>

Target:
public FSLeafQueue getQueue() { Queue queue = super.getQueue(); assert queue instanceof FSLeafQueue; return (FSLeafQueue) queue; }
Source:
<code>private SpillableArrayListImpl<V> getHelper(@Nullable K key) { SpillableArrayListImpl<V> spillableArrayList = cache.get(key); <START> <END> if (spillableArrayList == null) { Slice keyPrefix = serdeKey.serialize(key); Integer size = map.get(SliceUtils.concatenate(keyPrefix, SIZE_KEY_SUFFIX)); if (size == null) { return null; } spillableArrayList = new SpillableArrayListImpl<V>(bucket, keyPrefix.buffer, store, serdeValue); spillableArrayList.setSize(size); cache.put(key, spillableArrayList); } return spillableArrayList; }</code><technical_language>get for keys expired in cache</technical_language>

Target:
private SpillableArrayListImpl<V> getHelper(@Nullable K key) { SpillableArrayListImpl<V> spillableArrayList = cache.get(key); if (spillableArrayList == null) { Slice keySlice = serdeKey.serialize(key); Integer size = map.get(SliceUtils.concatenate(keySlice, SIZE_KEY_SUFFIX).toByteArray()); if (size == null) { return null; } Slice keyPrefix = SliceUtils.concatenate(identifier, keySlice); spillableArrayList = new SpillableArrayListImpl<V>(bucket, keyPrefix.toByteArray(), store, serdeValue); spillableArrayList.setSize(size); } cache.put(key, spillableArrayList); return spillableArrayList; }
Source:
<code>public boolean matches(long numberOfRows, Map<ColumnDescriptor, Statistics<?>> statistics, ParquetDataSourceId id, boolean failOnCorruptedParquetStatistics) throws ParquetCorruptionException { if (numberOfRows == 0) { return false; } if (effectivePredicate.isNone()) { return false; } Map<ColumnDescriptor, Domain> effectivePredicateDomains = effectivePredicate.getDomains() .orElseThrow(() -> new IllegalStateException("Effective predicate other than none should have domains")); for (RichColumnDescriptor column : columns) { Statistics<?> columnStatistics = statistics.get(column); Type type = getPrestoType(effectivePredicate, column); if (columnStatistics == null || columnStatistics.isEmpty()) { } else { Domain domain = getDomain(type, numberOfRows, columnStatistics, id, column.toString(), failOnCorruptedParquetStatistics); if (domain.isNone()) { return false; } Domain effectivePredicateDomain = effectivePredicateDomains.get(column); <START> if (effectivePredicateDomain != null) { <END> if (effectivePredicateDomain.intersect(domain).isNone()) { return false; } } } } return true; }</code><technical_language>java if (effectivePredicateDomain != null && effectivePredicateDomain.intersect(domain).isNone()) {</technical_language>

Target:
public boolean matches(long numberOfRows, Map<ColumnDescriptor, Statistics<?>> statistics, ParquetDataSourceId id, boolean failOnCorruptedParquetStatistics) throws ParquetCorruptionException { if (numberOfRows == 0) { return false; } if (effectivePredicate.isNone()) { return false; } Map<ColumnDescriptor, Domain> effectivePredicateDomains = effectivePredicate.getDomains() .orElseThrow(() -> new IllegalStateException("Effective predicate other than none should have domains")); for (RichColumnDescriptor column : columns) { Domain effectivePredicateDomain = effectivePredicateDomains.get(column); if (effectivePredicateDomain == null) { continue; } Statistics<?> columnStatistics = statistics.get(column); if (columnStatistics == null || columnStatistics.isEmpty()) { } else { Domain domain = getDomain(effectivePredicateDomain.getType(), numberOfRows, columnStatistics, id, column.toString(), failOnCorruptedParquetStatistics); if (effectivePredicateDomain.intersect(domain).isNone()) { return false; } } } return true; }
Source:
<code>public void openFile(Path file, boolean raisePanel) { <START> openFiles(new ArrayList<>(Collections.singletonList(file)), raisePanel); <END> }</code><technical_language>suggestion openFiles(Arrays.asList(file)), raisePanel);</technical_language>

Target:
public void openFile(Path file, boolean raisePanel) { openFiles(Arrays.asList(file), raisePanel); }
Source:
<code><START> public void setLoadMetersEnabled(boolean enabled) { <END> m_loadMetersEnabled = enabled; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }</code><technical_language>if (m_loadMetersEnabled == enabled) return;</technical_language>

Target:
public void setLoadMetersEnabled(boolean enabled) { if (m_loadMetersEnabled == enabled) return; m_loadMetersEnabled = enabled; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }
Source:
<code>public void initialize(Server server, Injector injector) { final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); root.addServlet(new ServletHolder(new DefaultServlet()), "/*"); root.addServlet( new ServletHolder( new AsyncQueryForwardingServlet( jsonMapper, smileMapper, hostFinder, httpClient, emitter, requestLogger ) ), "/druid/v2/*" ); <START> addExtensionFilters(root, injector); <END> root.addFilter(defaultAsyncGzipFilterHolder(), "/*", null); root.addFilter(GuiceFilter.class, "/status/*", null); final HandlerList handlerList = new HandlerList(); handlerList.setHandlers(new Handler[]{root}); server.setHandler(handlerList); }</code><technical_language>for this work router nodes, filter implementations able handle async servlet request propertly. add a note in ServletFilterHolder that</technical_language>

Target:
public void initialize(Server server, Injector injector) { final ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); root.addServlet(new ServletHolder(new DefaultServlet()), "/*"); final AsyncQueryForwardingServlet asyncQueryForwardingServlet = new AsyncQueryForwardingServlet( jsonMapper, smileMapper, hostFinder, httpClientProvider, httpClientConfig, emitter, requestLogger ); asyncQueryForwardingServlet.setTimeout(httpClientConfig.getReadTimeout().getMillis()); root.addServlet(new ServletHolder(asyncQueryForwardingServlet), "/druid/v2/*"); JettyServerInitUtils.addExtensionFilters(root, injector); root.addFilter(JettyServerInitUtils.defaultAsyncGzipFilterHolder(), "/*", null); root.addFilter(GuiceFilter.class, "/status/*", null); final HandlerList handlerList = new HandlerList(); handlerList.setHandlers(new Handler[]{root}); server.setHandler(handlerList); }
Source:
<code><START> static long getCacheDuration() { <END> return Long.parseLong( System.getProperty( "org.codice.ddf.security.saml.Metadata.cacheDuration", String.valueOf(Duration.ofDays(7).toMillis()))); }</code><technical_language>reasons simply compute this a static constant re-use instead of retrieving time</technical_language>

Target:
public static Duration getCacheDuration() { return Duration.parse( System.getProperty("org.codice.ddf.security.saml.Metadata.cacheDuration", "P7D")); }