auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onAdd(IForgeRegistryInternal<Block> owner, RegistryManager stage, int id, Block block, @Nullable Block oldBlock) { @SuppressWarnings("unchecked") ClearableObjectIntIdentityMap<IBlockState> blockstateMap = owner.getSlaveMap(BLOCKSTATE_TO_ID, ClearableObjectIntIdentityMap.class); if (oldBlock != null) { <START> for (IBlockState state : oldBlock.getBlockState().getValidStates()) <END> blockstateMap.remove(state); } if ("minecraft:tripwire".equals(block.getRegistryName().toString())) { for (int meta = 0; meta < 15; meta++) blockstateMap.put(block.getStateFromMeta(meta), id << 4 | meta); } final boolean[] usedMeta = new boolean[16]; for (IBlockState state : block.getBlockState().getValidStates()) { final int meta = block.getMetaFromState(state); blockstateMap.put(state, id << 4 | meta); usedMeta[meta] = true; } for (int meta = 0; meta < 16; meta++) { if (block.getClass() == BlockObserver.class) continue; if (usedMeta[meta]) blockstateMap.put(block.getStateFromMeta(meta), id << 4 | meta); } if (oldBlock != null) { @SuppressWarnings("unchecked") BiMap<Block, Item> blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, BiMap.class); Item item = blockToItem.get(oldBlock); if (item != null) blockToItem.forcePut(block, item); } }</code><technical_language>prefer braces for loops, of in forge codebase braces</technical_language>

Target:
public void onAdd(IForgeRegistryInternal<Block> owner, RegistryManager stage, int id, Block block, @Nullable Block oldBlock) { @SuppressWarnings("unchecked") ClearableObjectIntIdentityMap<IBlockState> blockstateMap = owner.getSlaveMap(BLOCKSTATE_TO_ID, ClearableObjectIntIdentityMap.class); if (oldBlock != null) { for (IBlockState state : oldBlock.getBlockState().getValidStates()) { blockstateMap.remove(state); } } if ("minecraft:tripwire".equals(block.getRegistryName().toString())) { for (int meta = 0; meta < 15; meta++) blockstateMap.put(block.getStateFromMeta(meta), id << 4 | meta); } final boolean[] usedMeta = new boolean[16]; for (IBlockState state : block.getBlockState().getValidStates()) { final int meta = block.getMetaFromState(state); blockstateMap.put(state, id << 4 | meta); usedMeta[meta] = true; } for (int meta = 0; meta < 16; meta++) { if (block.getClass() == BlockObserver.class) continue; if (usedMeta[meta]) blockstateMap.put(block.getStateFromMeta(meta), id << 4 | meta); } if (oldBlock != null) { @SuppressWarnings("unchecked") BiMap<Block, Item> blockToItem = owner.getSlaveMap(BLOCK_TO_ITEM, BiMap.class); Item item = blockToItem.get(oldBlock); if (item != null) blockToItem.forcePut(block, item); } }
Source:
<code>private void configureRatingTooltip() { playerInfoBean.chatOnlyProperty().addListener((observable1, oldValue1, newValue1) -> { if (!newValue1) { Tooltip userRatingTooltip = new Tooltip(playerInfoBean.getCountry()); String globalRating = i18n.get("playerRatingFormat.global", RatingUtil.getGlobalRating(playerInfoBean)); String ladderRating = i18n.get("playerRatingFormat.ladder", RatingUtil.getLadderRating(playerInfoBean)); <START> userRatingTooltip.setText(String.format("%s \n %s", globalRating, ladderRating)); <END> playerInfoBean.globalRatingMeanProperty().addListener((observable, oldValue, newValue) -> { String updatedGlobalRating = i18n.get("playerRatingFormat.global", RatingUtil.getGlobalRating(playerInfoBean)); String oldLadderRating = i18n.get("playerRatingFormat.ladder", RatingUtil.getLadderRating(playerInfoBean)); userRatingTooltip.setText(String.format("%s \n %s", updatedGlobalRating, oldLadderRating)); }); playerInfoBean.ladderRatingMeanProperty().addListener((observable, oldValue, newValue) -> { String oldGlobalRating = i18n.get("playerRatingFormat.global", RatingUtil.getGlobalRating(playerInfoBean)); String updatedLadderRating = i18n.get("playerRatingFormat.ladder", RatingUtil.getLadderRating(playerInfoBean)); userRatingTooltip.setText(String.format("%s \n %s", oldGlobalRating, updatedLadderRating)); }); Tooltip.install(clanLabel, userRatingTooltip); Tooltip.install(usernameLabel, userRatingTooltip); } }); }</code><technical_language>Instead of defining string formats joining (with unnecessary spaces :-)) create string format newline. playerRatingFormat=Global Rating: {0,number,#}\nLeaderboard Rating: {0,number,#} call "Leaderboard" instead of "Ladder"</technical_language>

Target:
private void configureRatingTooltip() { if (!playerInfoBean.getChatOnly()) { Tooltip userRatingTooltip = new Tooltip(); String rating = i18n.get("userInfo.ratingFormat", RatingUtil.getRoundedGlobalRating(playerInfoBean), RatingUtil.getLeaderboardRating(playerInfoBean)); userRatingTooltip.setText(rating); addRatingListenerToTooltip(playerInfoBean.leaderboardRatingMeanProperty(), userRatingTooltip); addRatingListenerToTooltip(playerInfoBean.globalRatingMeanProperty(), userRatingTooltip); Tooltip.install(clanLabel, userRatingTooltip); Tooltip.install(usernameLabel, userRatingTooltip); } }
Source:
<code><START> protected Map<String,String> parseAttributes(final String attributesString) throws UnsupportedEncodingException { <END> final Map<String, String> attributes = new LinkedHashMap<>(); final String[] splitLine = attributesString.split(ATTRIBUTE_DELIMITER); for(String attribute : splitLine) { final String[] key_value = attribute.split(KEY_VALUE_SEPARATOR); if (key_value.length<2) { continue; } attributes.put(URLDecoder.decode(key_value[0].trim(), "UTF-8"), URLDecoder.decode(key_value[1].trim(), "UTF-8")); } return attributes; }</code><technical_language>this static private I</technical_language>

Target:
static private Map<String,String> parseAttributes(final String attributesString) throws UnsupportedEncodingException { final Map<String, String> attributes = new LinkedHashMap<>(); final List<String> splitLine = ParsingUtils.split(attributesString,ATTRIBUTE_DELIMITER); for(String attribute : splitLine) { final List<String> key_value = ParsingUtils.split(attribute,KEY_VALUE_SEPARATOR); if (key_value.size()<2) { continue; } attributes.put(URLDecoder.decode(key_value.get(0).trim(), "UTF-8"), URLDecoder.decode(key_value.get(1).trim(), "UTF-8")); } return attributes; }
Source:
<code>private void loadProviders() { ProviderType providerType = getProviderType(); if (providerType == null) { return; } AsyncDataProvider.getInstance().getAllProvidersByType(new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { List<Provider<?>> providers = new ArrayList<Provider<?>>(); <START> for (Provider provider : (List<Provider>) returnValue) { <END> VmwareVmProviderProperties properties = (VmwareVmProviderProperties) provider.getAdditionalProperties(); if (getDataCenters().getSelectedItem().getId().equals(properties.getStoragePoolId())) { providers.add(provider); } } providers.add(0, null); getProviders().setItems(providers); } }), providerType); }</code><technical_language>here, Provider<VmwareVmProviderProperties>. This enable get rid of some of casts on</technical_language>

Target:
private void loadProviders() { switch(importSources.getSelectedItem()) { case VMWARE: loadVmwareProviders(); break; default: } }
Source:
<code>public ProjectMergeStrategies call() throws Exception { pc = open(); ProjectConfig config; MetaDataUpdate md = metaDataUpdateFactory.create(projectName); try { config = ProjectConfig.read(md); if (config.getRevision() != null <START> && !config.getRevision().equals( <END> pc.getProjectState().getConfig().getRevision())) { projectCache.evict(config.getProject()); pc = open(); } } finally { md.close(); } List<MergeStrategySection> local = new ArrayList<MergeStrategySection>(); Set<String> ownerOf = new HashSet<String>(); for (MergeStrategySection section : config.getMergeStrategySections()) { RefControl rc = pc.controlForRef(section.getName()); if (rc.isOwner()) { local.add(section); ownerOf.add(section.getName()); } else if (rc.isVisible()) { local.add(section); } } final ProjectMergeStrategies detail = new ProjectMergeStrategies(); detail.setRevision(config.getRevision().name()); detail.setLocal(local); detail.setOwnerOf(ownerOf); if (projectName.equals(allProjectsName)) { detail.setInheritsFrom(null); } else if (config.getProject().getParent() != null) { detail.setInheritsFrom(config.getProject().getParent()); } else { detail.setInheritsFrom(allProjectsName); } return detail; }</code><technical_language>I is work (doubt) cache here? if so, code do version check live else? I admit I know, step in here, point some similar examples in Gerrit</technical_language>

Target:
public ProjectMergeStrategies call() throws Exception { ProjectConfig config = null; boolean cacheNeedsRefreshing = false; MetaDataUpdate md = metaDataUpdateFactory.create(projectName); try { config = ProjectConfig.read(md); if (config.getRevision() != null && projectCache.get(projectName).isRevisionOutOfDate(config)) { cacheNeedsRefreshing = true; } } finally { md.close(); if (config != null) { pc = projectControlFactory.validateFor(config.getProject(), ProjectControl.OWNER | ProjectControl.VISIBLE, cacheNeedsRefreshing); } else { pc = projectControlFactory.validateFor(projectName, ProjectControl.OWNER | ProjectControl.VISIBLE); } } List<MergeStrategySection> local = new ArrayList<MergeStrategySection>(); Set<String> ownerOf = new HashSet<String>(); for (MergeStrategySection section : config.getMergeStrategySections()) { RefControl rc = pc.controlForRef(section.getName()); if (rc.isOwner()) { local.add(section); ownerOf.add(section.getName()); } else if (rc.isVisible()) { local.add(section); } } final ProjectMergeStrategies strategies = new ProjectMergeStrategies(); strategies.setRevision(config.getRevision().name()); strategies.setMergeStrategies(local); strategies.setOwnerOf(ownerOf); if (projectName.equals(allProjectsName)) { strategies.setInheritsFrom(null); } else if (config.getProject().getParent() != null) { strategies.setInheritsFrom(config.getProject().getParent()); } else { strategies.setInheritsFrom(allProjectsName); } return strategies; }
Source:
<code>private Object buildFromResultSet(java.sql.Array array, StatementContext ctx) throws SQLException { final ColumnMapper<?> mapper = ctx.findColumnMapperFor(componentType) .orElseThrow(() -> new IllegalArgumentException("Unable to find column mapper for " + componentType)); List<Object> list = new ArrayList<>(); try (ResultSet rs = array.getResultSet()) { while (rs.next()) { list.add(mapper.map(rs, 2, ctx)); } } <START> Object ary = Array.newInstance(componentType, list.size()); <END> if (componentType.isPrimitive()) { for (int i = 0; i < list.size(); i++) { Array.set(ary, i, list.get(i)); } return ary; } return list.toArray((Object[]) ary); }</code><technical_language>If allocate this array store mapper.map, avoid extra List<Object> list storage</technical_language>

Target:
private Object buildFromResultSet(java.sql.Array array, StatementContext ctx) throws SQLException { List<Object> list = new ArrayList<>(); try (ResultSet rs = array.getResultSet()) { while (rs.next()) { list.add(elementMapper.map(rs, 2, ctx)); } } Object ary = Array.newInstance(componentType, list.size()); if (componentType.isPrimitive()) { for (int i = 0; i < list.size(); i++) { Array.set(ary, i, list.get(i)); } return ary; } return list.toArray((Object[]) ary); }
Source:
<code>public void putBulkObjectWithPipeAndSync() throws Exception { assumeThat(Util.getBlackPearlVersion(client), greaterThan(3.0)); <START> <END> final String bucketName = "test_put_bulk_pipe_object"; try { Util.createBucket(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "put_bulk", "-b", bucketName, "--sync"}); final String file; if (Utils.isWindows) { file = ".\\src\\test\\resources\\books\\beowulf.txt\n.\\src\\test\\resources\\books\\ulysses.txt"; } else { file = "./src/test/resources/books/beowulf.txt\n./src/test/resources/books/ulysses.txt"; } final InputStream testFile = new ByteArrayInputStream(file.getBytes("UTF-8")); System.setIn(testFile); final CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is(String.format("SUCCESS: Wrote all piped files to bucket %s", bucketName))); testFile.reset(); final CommandResponse response2 = Util.command(client, args); assertThat(response2.getMessage(), is("SUCCESS: All files are up to date")); } finally { Util.deleteBucket(client, bucketName); } }</code><technical_language>question</technical_language>

Target:
public void putBulkObjectWithPipeAndSync() throws Exception { assumeThat(Util.getBlackPearlVersion(client), greaterThan(1.2)); final String bucketName = "test_put_bulk_pipe_object"; try { Util.createBucket(client, bucketName); final Arguments args = new Arguments(new String[]{"--http", "-c", "put_bulk", "-b", bucketName, "--sync"}); final String file; if (Utils.isWindows) { file = ".\\src\\test\\resources\\books\\beowulf.txt\n.\\src\\test\\resources\\books\\ulysses.txt"; } else { file = "./src/test/resources/books/beowulf.txt\n./src/test/resources/books/ulysses.txt"; } final InputStream testFile = new ByteArrayInputStream(file.getBytes("UTF-8")); System.setIn(testFile); final CommandResponse response = Util.command(client, args); assertThat(response.getMessage(), is(String.format("SUCCESS: Wrote all piped files to bucket %s", bucketName))); testFile.reset(); final CommandResponse response2 = Util.command(client, args); assertThat(response2.getMessage(), is("SUCCESS: All files are up to date")); } finally { Util.deleteBucket(client, bucketName); } }
Source:
<code>public Sheet getByName(String sheetName) { <START> if (nameToSheet.containsKey(sheetName)) { return nameToSheet.get(sheetName); } return null; <END> }</code><technical_language>This implementation is identical returning nameToSheet.get(sheetName). return null if key is present</technical_language>

Target:
public Sheet getByName(String sheetName) { return nameToSheet.get(sheetName); }
Source:
<code>public void visitTryStatement(TryStatementTree tree) { insideTryStatement = true; tree.resourceList().stream() <START> .map(resource -> ((VariableTreeImpl) resource).simpleName().name()) <END> .forEach(resourceResolversInTryWithResources::add); super.visitTryStatement(tree); resourceResolversInTryWithResources.clear(); insideTryStatement = false; }</code><technical_language>reason referring implementation type casting</technical_language>

Target:
public void visitTryStatement(TryStatementTree tree) { insideTryStatement = true; tree.resourceList().stream() .filter(resource -> resource instanceof VariableTree) .map(VariableTree.class::cast) .map(resource -> resource.simpleName().name()) .forEach(resourceResolversInTryWithResources::add); super.visitTryStatement(tree); resourceResolversInTryWithResources.clear(); insideTryStatement = false; }
Source:
<code>public void setAllTasksFinal(Iterable<TaskInfo> finalTaskInfos) <START> { <END> checkState(stageState.get().isDone()); StageInfo stageInfo = getStageInfo(() -> finalTaskInfos); checkArgument(stageInfo.isCompleteInfo(), "finalTaskInfos are not final"); finalStageInfo.compareAndSet(Optional.empty(), Optional.of(stageInfo)); }</code><technical_language>requireNonNull(finalTaskInfos, "finalTaskInfos is null");</technical_language>

Target:
public void setAllTasksFinal(Iterable<TaskInfo> finalTaskInfos) { requireNonNull(finalTaskInfos, "finalTaskInfos is null"); checkState(stageState.get().isDone()); StageInfo stageInfo = getStageInfo(() -> finalTaskInfos); checkArgument(stageInfo.isCompleteInfo(), "finalTaskInfos are not all done"); finalStageInfo.compareAndSet(Optional.empty(), Optional.of(stageInfo)); }
Source:
<code>public XYChartConsumer createChartConsumer() { <START> List<XYSeriesConsumer> series = new ArrayList<>(); getData().getChartSeries().stream().forEach(s -> { IDataConsumer xConsumer; IDataConsumer yConsumer; Predicate<@Nullable Number> xPredicate; if (getModel().isXLogscale()) { xPredicate = new LogarithmicPredicate(s.getX().getResolver()); } else { xPredicate = Objects::nonNull; } if (getXDescriptorsInfo().areNumericals()) { xConsumer = new NumericalConsumer(s.getX().getResolver(), xPredicate); } else { xConsumer = new ScatterStringConsumer(s.getX().getResolver(), fXStringMap); } Predicate<@Nullable Number> yPredicate; if (getModel().isYLogscale()) { yPredicate = new LogarithmicPredicate(s.getY().getResolver()); } else { yPredicate = Objects::nonNull; } if (getYDescriptorsInfo().areNumericals()) { yConsumer = new NumericalConsumer(s.getY().getResolver(), yPredicate); } else { yConsumer = new ScatterStringConsumer(s.getY().getResolver(), fYStringMap); } series.add(new XYSeriesConsumer(s, xConsumer, yConsumer)); }); NumericalConsumerAggregator xAggregator; if (getXDescriptorsInfo().areNumericals()) { xAggregator = new NumericalConsumerAggregator(); } else { xAggregator = null; } NumericalConsumerAggregator yAggregator; if (getYDescriptorsInfo().areNumericals()) { yAggregator = new NumericalConsumerAggregator(); } else { yAggregator = null; } return new XYChartConsumer(series, xAggregator, yAggregator); } <END></code><technical_language>This is cleaner</technical_language>

Target:
public XYChartConsumer createChartConsumer() { List<XYSeriesConsumer> series = new ArrayList<>(); getData().getChartSeries().stream().forEach(s -> { IDataConsumer xConsumer; IDataConsumer yConsumer; IDataResolver<?, ?> xResolver = checkNotNull(s.getX().getResolver()); Predicate<@Nullable Number> xPredicate; if (getModel().isXLogscale()) { xPredicate = new LogarithmicPredicate(xResolver); } else { xPredicate = Objects::nonNull; } if (getXDescriptorsInfo().areNumericals()) { xConsumer = new NumericalConsumer(xResolver, xPredicate); } else { xConsumer = new ScatterStringConsumer(xResolver, fXStringMap); } IDataResolver<?, ?> yResolver = checkNotNull(s.getY().getResolver()); Predicate<@Nullable Number> yPredicate; if (getModel().isYLogscale()) { yPredicate = new LogarithmicPredicate(yResolver); } else { yPredicate = Objects::nonNull; } if (getYDescriptorsInfo().areNumericals()) { yConsumer = new NumericalConsumer(yResolver, yPredicate); } else { yConsumer = new ScatterStringConsumer(yResolver, fYStringMap); } series.add(new XYSeriesConsumer(s, xConsumer, yConsumer)); }); NumericalConsumerAggregator xAggregator; if (getXDescriptorsInfo().areNumericals()) { xAggregator = new NumericalConsumerAggregator(); } else { xAggregator = null; } NumericalConsumerAggregator yAggregator; if (getYDescriptorsInfo().areNumericals()) { yAggregator = new NumericalConsumerAggregator(); } else { yAggregator = null; } return new XYChartConsumer(series, xAggregator, yAggregator); }
Source:
<code>private static boolean usesScrollbars() { if (usesScrollbars_ != null) return usesScrollbars_; if (!BrowseCap.isMacintosh()) { usesScrollbars_ = true; } else { <START> Element parent = Document.get().createElement("div"); <END> parent.getStyle().setWidth(100, Unit.PX); parent.getStyle().setHeight(100, Unit.PX); parent.getStyle().setOverflow(Overflow.AUTO); parent.getStyle().setVisibility(Visibility.HIDDEN); Element content = Document.get().createElement("div"); content.getStyle().setWidth(100, Unit.PX); content.getStyle().setHeight(200, Unit.PX); parent.appendChild(content); Document.get().getBody().appendChild(parent); boolean hasScrollbars = parent.getOffsetWidth() - parent.getClientWidth() > 0; parent.removeFromParent(); usesScrollbars_ = hasScrollbars; } return usesScrollbars_; }</code><technical_language>reduce odds of flicker, set kinds of test divs position: fixed offscreen coordinates</technical_language>

Target:
private static boolean usesScrollbars() { if (usesScrollbars_ != null) return usesScrollbars_; if (!BrowseCap.isMacintosh()) { usesScrollbars_ = true; } else { Element parent = Document.get().createElement("div"); parent.getStyle().setWidth(100, Unit.PX); parent.getStyle().setHeight(100, Unit.PX); parent.getStyle().setOverflow(Overflow.AUTO); parent.getStyle().setVisibility(Visibility.HIDDEN); parent.getStyle().setPosition(Position.FIXED); parent.getStyle().setLeft(-300, Unit.PX); parent.getStyle().setTop(-300, Unit.PX); Element content = Document.get().createElement("div"); content.getStyle().setWidth(100, Unit.PX); content.getStyle().setHeight(200, Unit.PX); parent.appendChild(content); Document.get().getBody().appendChild(parent); boolean hasScrollbars = parent.getOffsetWidth() - parent.getClientWidth() > 0; parent.removeFromParent(); usesScrollbars_ = hasScrollbars; } return usesScrollbars_; }
Source:
<code>public static Optional<Path> getConventionTestResultsDumpPath() { <START> String path = System.getProperty(CONVENTION_TESTS_RESULTS_DUMP_PATH_KEY, ""); <END> if (path.isEmpty()) { return Optional.empty(); } return Optional.of(Paths.get(path)); }</code><technical_language>Change this java return Optional.ofNullable(System.getProperty(C_T_R_D_P_K))</technical_language>

Target:
public static Optional<Path> getConventionTestResultsDumpPath() { return Optional.ofNullable(System.getProperty(CONVENTION_TESTS_RESULTS_DUMP_PATH_KEY)) .map(Paths::get); }
Source:
<code><START> public Response remove(GlusterBricks bricks) { <END> for (GlusterBrick brick : bricks.getGlusterBricks()) { validateParameters(brick, "id"); } return performAction(VdcActionType.GlusterVolumeRemoveBricks, new GlusterVolumeRemoveBricksParameters(asGuid(getVolumeId()), mapBricks(asGuid(getVolumeId()), bricks))); }</code><technical_language>potential NPE bricks.getGlusterBricks(), check isSet()</technical_language>

Target:
public Response remove(GlusterBricks bricks) { if (bricks.getGlusterBricks().size() > 0) { for (GlusterBrick brick : bricks.getGlusterBricks()) { validateParameters(brick, "id"); } } return performAction(VdcActionType.GlusterVolumeRemoveBricks, new GlusterVolumeRemoveBricksParameters(asGuid(getVolumeId()), mapBricks(asGuid(getVolumeId()), bricks))); }
Source:
<code>private java.util.Timer makeConfigurationChangeMonitor(long reloadInterval, <START> SslContextFactory.Server sslContextFactory) { <END> java.util.Timer timer = new java.util.Timer("SSL Certificates Store Monitor", true); timer.schedule(new FileMonitoringTimerTask( Paths.get(keyStore), path -> { LOG.info("Reloading certificates from store keystore " + keyStore); try { sslContextFactory.reload(factory -> { }); } catch (Exception ex) { LOG.error("Failed to reload SSL keystore certificates", ex); } },null), reloadInterval, reloadInterval ); return timer; }</code><technical_language>style of backing class... do big right-shifts parameters line. careful w/ line lengths too. backing file do 80 chars</technical_language>

Target:
private Timer makeConfigurationChangeMonitor(long reloadInterval, SslContextFactory.Server sslContextFactory) { Timer timer = new Timer("SSL Certificates Store Monitor", true); timer.schedule(new FileMonitoringTimerTask( Paths.get(keyStore), path -> { LOG.info("Reloading certificates from store keystore " + keyStore); try { sslContextFactory.reload(factory -> { }); } catch (Exception ex) { LOG.error("Failed to reload SSL keystore certificates", ex); } },null), reloadInterval, reloadInterval ); return timer; }
Source:
<code>protected OneTimePasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { decoder.startSequence(); final String algorithm = decoder.decodeOctetStringAsString(); <START> final String seed = decoder.decodeOctetStringAsString(); <END> final int sequenceNumber = decoder.decodeInteger().intValue(); decoder.endSequence(); return new OneTimePasswordAlgorithmSpec(algorithm, seed, sequenceNumber); }</code><technical_language>StandardCharsets.US_ASCII too</technical_language>

Target:
protected OneTimePasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { decoder.startSequence(); final String algorithm = decoder.decodeOctetStringAsString(); final String seed = decoder.decodeIA5String(); final int sequenceNumber = decoder.decodeInteger().intValue(); decoder.endSequence(); return new OneTimePasswordAlgorithmSpec(algorithm, seed, sequenceNumber); }
Source:
<code>private void saveClientCertSettings(){ <START> if (getInteger(PERSIST_CLIENT_CERT, 0) > 0){ <END> logger.warn("Saving Client Certificate settings: password will be found in config"); setUseClientCert(getInteger(USE_CLIENT_CERT, 0) > 0); setClientCertLocation(getString(CLIENT_CERT_LOCATION, "")); setClientCertPassword(getString(CLIENT_CERT_PASSWORD, "")); } else { setUseClientCert(false); setClientCertLocation(""); setClientCertPassword(""); } }</code><technical_language>This a boolean</technical_language>

Target:
private void saveClientCertSettings(){ if (getBoolean(PERSIST_CLIENT_CERT, false)){ logger.warn("Saving Client Certificate settings: password will be found in config"); setUseClientCert(getBoolean(USE_CLIENT_CERT, false)); setClientCertLocation(getString(CLIENT_CERT_LOCATION, "")); setClientCertPassword(getString(CLIENT_CERT_PASSWORD, "")); setClientCertIndex(getInt(CLIENT_CERT_INDEX, 0)); } else { setUseClientCert(false); setClientCertLocation(""); setClientCertPassword(""); setClientCertIndex(0); } }
Source:
<code>public Object[] getJsonFields() { List<String> elementlist = new ArrayList(); Iterator<Map.Entry<String, JsonNode>> fields = this.rootNode.getFields(); while(fields.hasNext()){ String fieldsstr = ""; Map.Entry<String, JsonNode> entry = fields.next(); <START> fieldsstr += entry.getKey() +","+entry.getValue().toString(); <END> elementlist.add(fieldsstr); } return elementlist.toArray(); }</code><technical_language>Please "," a separator b/w key value</technical_language>

Target:
public Object[] getJsonFields() { List<String> elementlist = new ArrayList(); Iterator<Map.Entry<String, JsonNode>> fields = this.rootNode.getFields(); while(fields.hasNext()){ Map.Entry<String, JsonNode> entry = fields.next(); StringBuilder fieldBuilder = new StringBuilder(); fieldBuilder.append(entry.getKey()); fieldBuilder.append(","); fieldBuilder.append(entry.getValue().toString()); elementlist.add(fieldBuilder.toString()); } return elementlist.toArray(); }
Source:
<code>protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, Http2Exception http2Ex) { if (http2Ex == null) { http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); } ChannelPromise promise = ctx.newPromise(); ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise()); if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) { doGracefulShutdown(ctx, future, promise); } else { future.addListener(new ClosingChannelFutureListener(ctx, promise)); } <START> ctx.flush(); <END> }</code><technical_language>Is this necessary? If due a read trigger a flush channelReadComplete(). If due a write, a flush write</technical_language>

Target:
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, Http2Exception http2Ex) { if (http2Ex == null) { http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); } ChannelPromise promise = ctx.newPromise(); ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise()); if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) { doGracefulShutdown(ctx, future, promise); } else { future.addListener(new ClosingChannelFutureListener(ctx, promise)); } }
Source:
<code>protected String runIf(CommandContext ctx) throws Exception { ctx.handle("if result.value==\"true\" of " + this.getReadPropertyReq()); <START> ctx.handle(this.getWritePropertyReq("\"true\"")); <END> ctx.handle("else"); ctx.handle(this.getWritePropertyReq("\"false\"")); ctx.handle("end-if"); cliOut.reset(); ctx.handle(getReadPropertyReq()); return getValue(); }</code><technical_language>is reason this change</technical_language>

Target:
protected String runIf(CommandContext ctx) throws Exception { ctx.handle("if result.value==\"true\" of " + this.getReadPropertyReq()); ctx.handle(this.getWritePropertyReq("\"false\"")); ctx.handle("else"); ctx.handle(this.getWritePropertyReq("\"true\"")); ctx.handle("end-if"); cliOut.reset(); ctx.handle(getReadPropertyReq()); return getValue(); }
Source:
<code>public void disable(CommandSource src) { <START> Sponge.getServer().getWorld("no-save").ifPresent(world -> { <END> Sponge.getServer().unloadWorld(world); Sponge.getServer().deleteWorld(world.getProperties()); }); Sponge.getServer().getWorld("metadata-only").ifPresent(world -> { Sponge.getServer().unloadWorld(world); Sponge.getServer().deleteWorld(world.getProperties()); }); }</code><technical_language>Pull out Sponge.getServer() a local variable this point times called</technical_language>

Target:
public void disable(CommandSource src) { final Server server = Sponge.getServer(); server.getWorld("no-save").ifPresent(world -> { server.unloadWorld(world); server.deleteWorld(world.getProperties()); }); server.getWorld("metadata-only").ifPresent(world -> { server.unloadWorld(world); server.deleteWorld(world.getProperties()); }); }
Source:
<code><START> private BlockingQueue<Runnable> newQueue(boolean needPrioritySort) { <END> return needPrioritySort ? new PriorityBlockingQueue<>() : new LinkedBlockingQueue<>(); }</code><technical_language>static</technical_language>

Target:
private static BlockingQueue<Runnable> newQueue(boolean needPrioritySort) { return needPrioritySort ? new PriorityBlockingQueue<>() : new LinkedBlockingQueue<>(); }
Source:
<code>private IStatus copyFile(InputStream in, IPath to, long ts) throws CoreException { File tempFile = null; try { File file = to.toFile(); tempFile = writeToTempFile(in, to); moveTempFile(tempFile, file); if (ts != IResource.NULL_STAMP && ts != 0) file.setLastModified(ts); } catch (CoreException e) { throw e; } catch (Exception e) { return new Status(IStatus.ERROR, ASWTPToolsPlugin.PLUGIN_ID, IEventCodes.JST_PUB_FAIL, NLS.bind(Messages.errorCopyingFile, to.toString(), e.getLocalizedMessage()), null); } finally { if (tempFile != null && tempFile.exists()) tempFile.deleteOnExit(); try { <START> if (in != null) <END> in.close(); } catch (Exception ex) { } } return null; }</code><technical_language>StreamUtils.safeClose(in);</technical_language>

Target:
private IStatus copyFile(InputStream in, IPath to, long ts) throws CoreException { File tempFile = null; try { File file = to.toFile(); tempFile = writeToTempFile(in, to); moveTempFile(tempFile, file); if (ts != IResource.NULL_STAMP && ts != 0) file.setLastModified(ts); } catch (CoreException e) { throw e; } catch (Exception e) { return new Status(IStatus.ERROR, ASWTPToolsPlugin.PLUGIN_ID, IEventCodes.JST_PUB_FAIL, NLS.bind(Messages.errorCopyingFile, to.toString(), e.getLocalizedMessage()), null); } finally { if (tempFile != null && tempFile.exists()) tempFile.deleteOnExit(); StreamUtils.safeClose(in); } return null; }
Source:
<code>private void delete(Path d) { try { Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS); Instant lastModified = Files.getLastModifiedTime(d).toInstant(); if (lastModified.isBefore(threshold)) { Files.delete(d); } } catch (IOException e) { <START> LOG.error("Unable to delete path {}", d, e); <END> } }</code><technical_language>externalize error message is method error(String, Object arg, Throwable exception) error(String, Object arg1, Object arg2)</technical_language>

Target:
private void delete(Path d) { try { Instant threshold = Instant.now().minus(30, ChronoUnit.SECONDS); Instant lastModified = Files.getLastModifiedTime(d).toInstant(); if (lastModified.isBefore(threshold)) { Files.delete(d); } } catch (IOException e) { LOG.error(MessageFormat.format(JGitText.get().cannotDeleteFile, d), e); } }
Source:
<code>public static List<SqlScalarFunction> parseFunctionDefinitions(Class<?> clazz) { <START> ImmutableList.Builder<SqlScalarFunction> builder = ImmutableList.builder(); <END> for (ScalarHeaderAndMethods methods : findScalarsInFunctionSetClass(clazz)) { builder.add(parseParametricScalar(methods, ImmutableMap.of())); } return builder.build(); }</code><technical_language>nit: more explicit: function definition classes (classes annotated @ScalarFunction) define SQL functions non-static java function. Function set classes define SQL functions static java functions. constructor in function set classes is define SQL functions</technical_language>

Target:
public static List<SqlScalarFunction> parseFunctionDefinitions(Class<?> clazz) { ImmutableList.Builder<SqlScalarFunction> builder = ImmutableList.builder(); for (ScalarHeaderAndMethods methods : findScalarsInFunctionSetClass(clazz)) { builder.add(parseParametricScalar(methods, Optional.empty())); } return builder.build(); }
Source:
<code>private void renderCombinedEventScripts() { StringBuilder combinedScript = new StringBuilder(); for (HeaderItem curItem : domReadyItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); if (curItem instanceof OnDomReadyHeaderItem) { combinedScript.append(((OnDomReadyHeaderItem)curItem).getJavaScript()); } else if (curItem instanceof OnEventHeaderItem) { combinedScript.append(((OnEventHeaderItem)curItem).getCompleteJavaScript()); } combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);"); getRealResponse().render( OnDomReadyHeaderItem.forScript(combinedScript.append('\n').toString())); } combinedScript.setLength(0); for (OnLoadHeaderItem curItem : loadItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); combinedScript.append(curItem.getJavaScript()); combinedScript.append(';'); } } if (combinedScript.length() > 0) { <START> combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_TIMERS_BOUND);"); <END> getRealResponse().render( OnLoadHeaderItem.forScript(combinedScript.append('\n').toString())); } }</code><technical_language>do timers in response ? this event is published matter timer behaviors in not</technical_language>

Target:
private void renderCombinedEventScripts() { StringBuilder combinedScript = new StringBuilder(); for (HeaderItem curItem : domReadyItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); if (curItem instanceof OnDomReadyHeaderItem) { combinedScript.append(((OnDomReadyHeaderItem)curItem).getJavaScript()); } else if (curItem instanceof OnEventHeaderItem) { combinedScript.append(((OnEventHeaderItem)curItem).getCompleteJavaScript()); } combinedScript.append(';'); } } if (combinedScript.length() > 0) { combinedScript.append("\nWicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND);"); getRealResponse().render( OnDomReadyHeaderItem.forScript(combinedScript.append('\n').toString())); } combinedScript.setLength(0); for (OnLoadHeaderItem curItem : loadItemsToBeRendered) { if (markItemRendered(curItem)) { combinedScript.append('\n'); combinedScript.append(curItem.getJavaScript()); combinedScript.append(';'); } } if (combinedScript.length() > 0) { getRealResponse().render( OnLoadHeaderItem.forScript(combinedScript.append('\n').toString())); } }
Source:
<code>public boolean getLock(DatabaseTransOperator transOperator, String lockName, int lockTimeoutInSeconds) throws SQLException { <START> String getLockStatement = String.format(getLockTemplate, lockName, lockTimeoutInSeconds); <END> return transOperator.query(getLockStatement, this); }</code><technical_language>check lockName lockTimeoutInSeconds. fields null <0 respectively</technical_language>

Target:
public boolean getLock(DatabaseTransOperator transOperator, String lockName, int lockTimeoutInSeconds) throws SQLException { if (StringUtils.isEmpty(lockName)) { throw new IllegalArgumentException("Lock name cannot be null or empty"); } String getLockStatement = String.format(getLockTemplate, lockName, lockTimeoutInSeconds); return transOperator.query(getLockStatement, this); }
Source:
<code>public static void applyGermlineVariantFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (!vc.hasAttribute(GATKVCFConstants.NORMAL_LOD_KEY)) { return; } <START> final int loc = vc.getStart(); <END> final boolean siteInCosmic = vc.hasAttribute(SomaticGenotypingEngine.IN_COSMIC_VCF_ATTRIBUTE); final boolean siteInDbsnp = vc.hasAttribute(SomaticGenotypingEngine.IN_DBSNP_VCF_ATTRIBUTE); if (siteInDbsnp && !siteInCosmic ) { final double normalLod = vc.getAttributeAsDouble(GATKVCFConstants.NORMAL_LOD_KEY, 0.0); if (normalLod < MTAC.NORMAL_DBSNP_LOD_THRESHOLD) { filters.add(GATKVCFConstants.GERMLINE_RISK_FILTER_NAME); } } }</code><technical_language>intelliJ loc is</technical_language>

Target:
private static void applyGermlineVariantFilter(final M2ArgumentCollection MTAC, final VariantContext vc, final Collection<String> filters) { if (!vc.hasAttribute(GATKVCFConstants.NORMAL_LOD_KEY)) { return; } final boolean siteInCosmic = vc.hasAttribute(SomaticGenotypingEngine.IN_COSMIC_VCF_ATTRIBUTE); final boolean siteInDbsnp = vc.hasAttribute(SomaticGenotypingEngine.IN_DBSNP_VCF_ATTRIBUTE); if (siteInDbsnp && !siteInCosmic ) { final double normalLod = vc.getAttributeAsDouble(GATKVCFConstants.NORMAL_LOD_KEY, 0.0); if (normalLod < MTAC.NORMAL_DBSNP_LOD_THRESHOLD) { filters.add(GATKVCFConstants.GERMLINE_RISK_FILTER_NAME); } } }
Source:
<code>private void write(Set<String> modules) throws ForbiddenException, ServerException, ConflictException { VirtualFileEntry file; <START> file = baseFolder.getChild(MODULES_PATH); <END> if (file == null && !modules.isEmpty()) file = ((FolderEntry)baseFolder.getChild(".codenvy")).createFile("modules", new byte[0], MediaType.TEXT_PLAIN); String all = ""; for (String path : modules) { all += (path + "\n"); } if (file != null) { ((FileEntry)file).updateContent(all.getBytes()); } }</code><technical_language>Append assignnment declaration</technical_language>

Target:
private void write(Set<String> modules) throws ForbiddenException, ServerException, ConflictException { VirtualFileEntry file = baseFolder.getChild(MODULES_PATH); if (file == null && !modules.isEmpty()) { file = ((FolderEntry)baseFolder.getChild(".codenvy")).createFile("modules", new byte[0], MediaType.TEXT_PLAIN); } String all = ""; for (String path : modules) { all += (path + "\n"); } if (file != null) { ((FileEntry)file).updateContent(all.getBytes()); } }
Source:
<code>static Stream<Arguments> getTestParameters() { ConfigurationServiceVersion[] filteredKeyServiceVersion = Arrays.stream(ConfigurationServiceVersion.values()).filter(TestHelper::shouldServiceVersionBeTested) .toArray(ConfigurationServiceVersion[]::new); <START> return getArgumentsFromServiceVersion(Arrays.asList(filteredKeyServiceVersion)); <END> }</code><technical_language>This method strategy apply service versions. need run specific versions rolling. So, providing array of service versions sufficient. This method in a strategy</technical_language>

Target:
static Stream<Arguments> getTestParameters() { return getArgumentsFromServiceVersion(ConfigurationServiceVersion.values(), shouldServiceVersionBeTested, SERVICE_VERSION_FROM_ENV); }
Source:
<code>public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof SwiftObject, "this binder is only valid for SwiftObject!"); checkNotNull(request, "request"); SwiftObject object = (SwiftObject) input; if (object.getPayload().getContentMetadata().getContentType() == null) object.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_OCTET_STREAM); if (object.getPayload().getContentMetadata().getContentLength() != null && object.getPayload().getContentMetadata().getContentLength() >= 0) { checkArgument(object.getPayload().getContentMetadata().getContentLength() <= 5l * 1024 * 1024 * 1024, "maximum size for put object is 5GB"); } else { request = (R) request.toBuilder().replaceHeader("Transfer-Encoding", "chunked").build(); } byte[] contentMD5 = object.getInfo().getHash(); if (contentMD5 != null) { request = (R) request.toBuilder() .addHeader(HttpHeaders.ETAG, BaseEncoding.base16().lowerCase().encode(contentMD5)) .build(); } Date expires = object.getPayload().getContentMetadata().getExpires(); if (expires != null) { request = (R) request.toBuilder() <START> .addHeader("X-Delete-At", String.valueOf(expires.getTime() / 1000)) <END> .build(); } request = mdBinder.bindToRequest(request, object2Blob.apply(object)); return request; }</code><technical_language>a slower, [MILLISECONDS.toSeconds(expires.getTime())](<LINK_0> read slightly more here</technical_language>

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof SwiftObject, "this binder is only valid for SwiftObject!"); checkNotNull(request, "request"); SwiftObject object = (SwiftObject) input; if (object.getPayload().getContentMetadata().getContentType() == null) object.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_OCTET_STREAM); if (object.getPayload().getContentMetadata().getContentLength() != null && object.getPayload().getContentMetadata().getContentLength() >= 0) { checkArgument(object.getPayload().getContentMetadata().getContentLength() <= 5l * 1024 * 1024 * 1024, "maximum size for put object is 5GB"); } else { request = (R) request.toBuilder().replaceHeader("Transfer-Encoding", "chunked").build(); } byte[] contentMD5 = object.getInfo().getHash(); if (contentMD5 != null) { request = (R) request.toBuilder() .addHeader(HttpHeaders.ETAG, BaseEncoding.base16().lowerCase().encode(contentMD5)) .build(); } Date expires = object.getPayload().getContentMetadata().getExpires(); if (expires != null) { request = (R) request.toBuilder() .addHeader("X-Delete-At", String.valueOf( MILLISECONDS.toSeconds(expires.getTime()))) .build(); } request = mdBinder.bindToRequest(request, object2Blob.apply(object)); return request; }
Source:
<code>static BoundedContext boundedContext(Stand stand, int concurrentThreads) { final Executor executor = concurrentThreads > 0 ? Executors.newFixedThreadPool(concurrentThreads) : <START> new Executor() { END> @Override public void execute(Runnable command) { command.run(); } }; return boundedContextBuilder(stand) .setStandFunnelExecutor(executor) .build(); }</code><technical_language>MoreExecutors#directExecutor() instead</technical_language>

Target:
static BoundedContext boundedContext(Stand stand, int concurrentThreads) { final Executor executor = concurrentThreads > 0 ? Executors.newFixedThreadPool(concurrentThreads) : MoreExecutors.directExecutor(); return boundedContextBuilder(stand) .setStandFunnelExecutor(executor) .build(); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { addAuditLogCustomValues(); <START> switch (getActionState()) { <END> case END_SUCCESS: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS; case END_FAILURE: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE; } return AuditLogType.UNASSIGNED; }</code><technical_language>need EXECUTE case operation started- AuditLogType.USER_REMOVE_DISK_SNAPSHOT</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { addAuditLogCustomValues(); switch (getActionState()) { case EXECUTE: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT; case END_SUCCESS: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_SUCCESS; case END_FAILURE: return AuditLogType.USER_REMOVE_DISK_SNAPSHOT_FINISHED_FAILURE; } return AuditLogType.UNASSIGNED; }
Source:
<code>public void coerce(RecordCursor delegate, int field) { if (delegate.isNull(field)) { setIsNull(true); return; } Block block = (Block) delegate.getObject(field); BlockBuilder builder = toType.createBlockBuilder(new BlockBuilderStatus(), 1); BlockBuilder listBuilder = builder.beginBlockEntry(); for (int i = 0; i < block.getPositionCount(); i++) { if (block.isNull(i)) { listBuilder.appendNull(); } else if (elementCoercer == null) { <START> block.writePositionTo(i, listBuilder); <END> listBuilder.closeEntry(); } else { rewriteBlock(fromElementHiveType, toElementHiveType, fromElementType, toElementType, block, i, listBuilder, elementCoercer, field); } } builder.closeEntry(); setObject(builder.build().getObject(0, Block.class)); }</code><technical_language>technique in ArrayConcatFunction. create a single create BlockBuilder, appending slicing out element for return value. need periodically clearing out avoid holding unnecessary memory. This avoids frequent allocation. For structural types, estimating size is hard (you easily space need in values block boolean null flags), this helps previous ratio is a hint for allocation time clear it. Ditto for map struct</technical_language>

Target:
public void coerce(RecordCursor delegate, int field) { if (delegate.isNull(field)) { setIsNull(true); return; } Block block = (Block) delegate.getObject(field); if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder listBuilder = blockBuilder.beginBlockEntry(); for (int i = 0; i < block.getPositionCount(); i++) { if (elementCoercer == null) { toElementType.appendTo(block, i, listBuilder); } else { if (block.isNull(i)) { listBuilder.appendNull(); } else { rewriteBlock(fromElementType, toElementType, block, i, listBuilder, elementCoercer, bridgingRecordCursor); } } } blockBuilder.closeEntry(); pageBuilder.declarePosition(); setObject(toType.getObject(blockBuilder, blockBuilder.getPositionCount() - 1)); }
Source:
<code>protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException { Collection<Player> targets; if (args.length > 0) { targets = new ArrayList<>(); int pos = 0; <START> for (int i = 0; i < args.length; i++) { <END> targets.add(getPlayer(server, sender, args, pos).getBase()); pos++; } } else { targets = ess.getOnlinePlayers(); } ess.getTNTListener().enable(); for (Player player : targets) { if (player == null) { continue; } player.sendMessage(tl("nuke")); final Location loc = player.getLocation(); final World world = loc.getWorld(); for (int x = -10; x <= 10; x += 5) { for (int z = -10; z <= 10; z += 5) { final Location tntloc = new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z); world.spawn(tntloc, TNTPrimed.class); } } } }</code><technical_language>Why</technical_language>

Target:
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws NoSuchFieldException, NotEnoughArgumentsException { Collection<Player> targets; if (args.length > 0) { targets = new ArrayList<>(); int pos = 0; for (String arg : args) { targets.add(getPlayer(server, sender, args, pos).getBase()); pos++; } } else { targets = ess.getOnlinePlayers(); } ess.getTNTListener().enable(); for (Player player : targets) { if (player == null) { continue; } player.sendMessage(tl("nuke")); final Location loc = player.getLocation(); final World world = loc.getWorld(); for (int x = -10; x <= 10; x += 5) { for (int z = -10; z <= 10; z += 5) { final Location tntloc = new Location(world, loc.getBlockX() + x, world.getHighestBlockYAt(loc) + 64, loc.getBlockZ() + z); world.spawn(tntloc, TNTPrimed.class); } } } }
Source:
<code>protected void processRequest(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { executor.submit( () -> { switch (msg.getMsgType()) { case READ_REQUEST: case KNOWN_ADDRESS_REQUEST: case COMPACT_REQUEST: Lock lock = resetLock.readLock(); lock.lock(); <START> if (msg.getEpoch() != serverContext.getLogUnitEpochWaterMark()) { r.sendResponse(ctx, msg, new CorfuPayloadMsg<>(CorfuMsgType.WRONG_EPOCH, <END> serverContext.getServerEpoch())); return; } try { getHandler().handle(msg, ctx, r); } finally { lock.unlock(); } break; default: getHandler().handle(msg, ctx, r); } }); }</code><technical_language>a perf issue, thought</technical_language>

Target:
protected void processRequest(CorfuMsg msg, ChannelHandlerContext ctx, IServerRouter r) { executor.submit(() -> getHandler().handle(msg, ctx, r)); }