auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected AzureADToken refreshToken() throws IOException { LOG.debug("AADToken: refreshing custom based token"); AzureADToken azureADToken = new AzureADToken(); String accessToken = null; Exception ex; boolean succeeded = false; int retryCount = fetchTokenRetryCount; do { ex = null; try { accessToken = adaptee.getAccessToken(); LOG.trace("CustomTokenProvider Access token fetch was successful with retry count {}", retryCount); <START> } catch (Exception e) { <END> LOG.debug("CustomTokenProvider Access token fetch failed with retry count {}", retryCount); ex = e; } succeeded = (ex == null); retryCount--; } while (!succeeded && (retryCount) >= 0); if (!succeeded) { HttpException httpEx = new HttpException( -1, "", String.format("CustomTokenProvider getAccessToken threw %s : %s", ex.getClass().getTypeName(), ex.getMessage()), "", "", "" ); throw httpEx; } azureADToken.setAccessToken(accessToken); azureADToken.setExpiry(adaptee.getExpiryTime()); return azureADToken; }</code><technical_language>Throwable safer</technical_language>

Target:
protected AzureADToken refreshToken() throws IOException { LOG.debug("AADToken: refreshing custom based token"); AzureADToken azureADToken = new AzureADToken(); String accessToken = null; Exception ex; boolean succeeded = false; int retryCount = fetchTokenRetryCount; do { ex = null; try { accessToken = adaptee.getAccessToken(); LOG.trace("CustomTokenProvider Access token fetch was successful with retry count {}", (fetchTokenRetryCount - retryCount)); } catch (Exception e) { LOG.debug("CustomTokenProvider Access token fetch failed with retry count {}", (fetchTokenRetryCount - retryCount)); ex = e; } succeeded = (ex == null); retryCount--; } while (!succeeded && (retryCount) >= 0); if (!succeeded) { HttpException httpEx = new HttpException( -1, "", String.format("CustomTokenProvider getAccessToken threw %s : %s", ex.getClass().getTypeName(), ex.getMessage()), "", "", "" ); throw httpEx; } azureADToken.setAccessToken(accessToken); azureADToken.setExpiry(adaptee.getExpiryTime()); return azureADToken; }
Source:
<code>public void write(byte[] ba, int off, int len) throws IOException { while(true) { if(lastWriteFuture.isDone() && !isClosed) { ByteBuffer bb = ByteBuffer.wrap(ba, off, len); lastWriteFuture = c.write(bb); return; } else { try { lastWriteFuture.get(1000, TimeUnit.MILLISECONDS); } catch (Exception e) { <START> ExceptionUtils.handleException(e); <END> } } } }</code><technical_language>throw this IOException</technical_language>

Target:
public void write(byte[] ba, int off, int len) throws IOException { while(true) { if(lastWriteFuture.isDone() && !isClosed) { ByteBuffer bb = ByteBuffer.wrap(ba, off, len); lastWriteFuture = c.write(bb); return; } else { blockWriteFuture(lastWriteFuture); } } }
Source:
<code>private void getConfigParameters(Map<String, Object> parameters) { <START> minThreadsShared = (int) parameters.get(CONFIG_MIN_THREADS_SHARED); <END> maxThreadsShared = (int) parameters.get(CONFIG_MAX_THREADS_SHARED); keepAliveTimeoutShared = (int) parameters.get(CONFIG_KEEP_ALIVE_SHARED); minThreadsCustom = (int) parameters.get(CONFIG_MIN_THREADS_CUSTOM); maxThreadsCustom = (int) parameters.get(CONFIG_MAX_THREADS_CUSTOM); keepAliveTimeoutCustom = (int) parameters.get(CONFIG_KEEP_ALIVE_CUSTOM); }</code><technical_language>If parameters configured in property files, end Strings in this map - do run CCEs here</technical_language>

Target:
private void getConfigParameters(Map<String, Object> parameters) { minThreadsShared = getConfigParameter(parameters, CONFIG_MIN_THREADS_SHARED, 10); maxThreadsShared = getConfigParameter(parameters, CONFIG_MAX_THREADS_SHARED, 40); keepAliveTimeoutShared = getConfigParameter(parameters, CONFIG_KEEP_ALIVE_SHARED, 60); minThreadsCustom = getConfigParameter(parameters, CONFIG_MIN_THREADS_CUSTOM, 5); maxThreadsCustom = getConfigParameter(parameters, CONFIG_MAX_THREADS_CUSTOM, 10); keepAliveTimeoutCustom = getConfigParameter(parameters, CONFIG_KEEP_ALIVE_CUSTOM, 60); }
Source:
<code>public void queryDocumentsPojo(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); String query = "Select * from c"; Flux<FeedResponse<TestObject>> queryObservable = createdCollection.queryItems(query, options, TestObject.class); List<TestObject> fetchedResults = new ArrayList<>(); queryObservable.map(feedResponse -> fetchedResults.addAll(feedResponse.getResults())).blockLast(); <START> System.out.println("fetchedResults = " + fetchedResults); <END> }</code><technical_language>I assertion in test. test verify result is correct</technical_language>

Target:
public void queryDocumentsPojo(){ FeedOptions options = new FeedOptions(); options.setEnableCrossPartitionQuery(true); options.setMaxDegreeOfParallelism(2); String query = "Select * from c"; Flux<FeedResponse<TestObject>> queryObservable = createdCollection.queryItems(query, options, TestObject.class); List<TestObject> fetchedResults = new ArrayList<>(); queryObservable.map(feedResponse -> fetchedResults.addAll(feedResponse.getResults())).blockLast(); List<Tuple> assertTuples = createdDocuments.stream() .map(cosmosItemProperties -> tuple(cosmosItemProperties.getId(), cosmosItemProperties.get("mypk"), cosmosItemProperties.get("prop"), cosmosItemProperties.get("boolProp"))) .collect(Collectors.toList()); assertThat(fetchedResults).extracting(TestObject::getId, TestObject::getMypk, TestObject::getProp, TestObject::getBoolProp) .containsAll(assertTuples); }
Source:
<code>private boolean storeFluid( IAEFluidStack stack, boolean modulate ) { try { final IStorageGrid storage = this.getProxy().getStorage(); final IMEInventory<IAEFluidStack> inv = storage.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ); if( modulate ) { final IEnergyGrid energy = this.getProxy().getEnergy(); return Platform.poweredInsert( energy, inv, stack, this.mySrc ) == null; } else { final float requiredPower = stack.getStackSize() / Math.min( 1, stack.getChannel().transferFactor() ); final IEnergyGrid energy = this.getProxy().getEnergy(); if( energy.extractAEPower( requiredPower, Actionable.SIMULATE, PowerMultiplier.CONFIG ) < requiredPower ) { return false; } return inv.injectItems( stack, Actionable.SIMULATE, this.mySrc ) == null; } } <START> catch( final GridAccessException e ) <END> { } return false; }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private boolean storeFluid( IAEFluidStack stack, boolean modulate ) { try { final IStorageGrid storage = this.getProxy().getStorage(); final IMEInventory<IAEFluidStack> inv = storage.getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ); if( modulate ) { final IEnergyGrid energy = this.getProxy().getEnergy(); return Platform.poweredInsert( energy, inv, stack, this.mySrc ) == null; } else { final float requiredPower = (float) stack.getStackSize() / Math.min( 1.0f, stack.getChannel().transferFactor() ); final IEnergyGrid energy = this.getProxy().getEnergy(); if( energy.extractAEPower( requiredPower, Actionable.SIMULATE, PowerMultiplier.CONFIG ) < requiredPower ) { return false; } return inv.injectItems( stack, Actionable.SIMULATE, this.mySrc ) == null; } } catch( final GridAccessException e ) { } return false; }
Source:
<code>public void testPredicateOnNonDeterministicSymbolsPushedDown() { assertPlan( "SELECT * FROM (" + "SELECT randcustkey, orderkey, rank() OVER (PARTITION BY randcustkey ORDER BY orderdate ASC)" + <START> "FROM (select round(custkey*rand()) randcustkey, * from orders) " + <END> ") WHERE randcustkey > 100", anyTree( window(builder -> {}, anyTree( filter("\"ROUND\" > 1E2", project(ImmutableMap.of("ROUND", expression("round(CAST(CUST_KEY AS double) * rand())")), tableScan("orders", ImmutableMap.of("CUST_KEY", "custkey")))))))); }</code><technical_language>rename randcustkey->random_column</technical_language>

Target:
public void testPredicateOnNonDeterministicSymbolsPushedDown() { assertPlan( "SELECT * FROM (" + "SELECT random_column, orderkey, rank() OVER (PARTITION BY random_column ORDER BY orderdate ASC)" + "FROM (select round(custkey*rand()) random_column, * from orders) " + ") WHERE random_column > 100", anyTree( node(WindowNode.class, anyTree( filter("\"ROUND\" > 1E2", project(ImmutableMap.of("ROUND", expression("round(CAST(CUST_KEY AS double) * rand())")), tableScan( "orders", ImmutableMap.of("CUST_KEY", "custkey")))))))); }
Source:
<code>protected ResultSetFuture newFuture() { return factory.session.executeAsync(factory.preparedStatement .bind() .setString("service", service) <START> .setInt("limit_", 10000)); <END> }</code><technical_language>this is span names suggestion .setInt("limit_", 1000)); // is browse service names</technical_language>

Target:
protected ResultSetFuture newFuture() { return factory.session.executeAsync(factory.preparedStatement .bind() .setString("service", service) .setInt("limit_", 1000)); }
Source:
<code>public DataSet next(int num) { String currentValStr = ""; INDArray features = Nd4j.create(new int[]{num-1, lotteryLength, 10}); INDArray labels = Nd4j.create(new int[]{num-1, lotteryLength, 10}); for (int i =0; i < num - 1 && iter.hasNext(); i ++) { String featureStr = ""; <START> if (null == currentValStr || "".equals(currentValStr)) { <END> currentValStr = iter.next(); currentCursor ++; } featureStr = currentValStr; featureStr = featureStr.split(",")[2]; String[] featureAry = featureStr.split(""); for (int j = 0; j < lotteryLength; j ++) { int l = Integer.parseInt(featureAry[j]); features.putScalar(new int[]{i, j, l}, 1); } String labelStr = iter.next(); currentCursor ++; currentValStr = labelStr; labelStr = labelStr.split(",")[2]; String[] labelAry = labelStr.split(""); for (int j = 0; j < lotteryLength; j ++) { int l = Integer.parseInt(labelAry[j]); labels.putScalar(new int[]{i, j, l}, 1); } } DataSet result = new DataSet(features, labels); return result; }</code><technical_language>null == currentValStr is false</technical_language>

Target:
public DataSet next(int num) { int lotteryLength = 5; String currentValStr = ""; INDArray features = Nd4j.create(new int[]{num-1, lotteryLength, 10}); INDArray labels = Nd4j.create(new int[]{num-1, lotteryLength, 10}); for (int i =0; i < num - 1 && iter.hasNext(); i ++) { if ("".equals(currentValStr)) { currentValStr = iter.next(); currentCursor ++; } String featureStr = currentValStr; featureStr = featureStr.split(",")[2]; String[] featureAry = featureStr.split(""); for (int j = 0; j < lotteryLength; j ++) { int l = Integer.parseInt(featureAry[j]); features.putScalar(new int[]{i, j, l}, 1); } String labelStr = iter.next(); currentCursor ++; currentValStr = labelStr; labelStr = labelStr.split(",")[2]; String[] labelAry = labelStr.split(""); for (int j = 0; j < lotteryLength; j ++) { int l = Integer.parseInt(labelAry[j]); labels.putScalar(new int[]{i, j, l}, 1); } } return new DataSet(features, labels); }
Source:
<code>private void logEvent( String type, String page, String method, User user, String ip, String referer, String agent, Date date) { Validate.isTrue(type != null, "Type of suspicious activity was not set"); Validate.isTrue(page != null, "Page should be non null"); SuspiciousActivity activity = new SuspiciousActivity(); SuspiciousActivityType activityType = new SuspiciousActivityType(); activityType.setName(type); activity.setType(activityType); activity.setOccurredAt(date == null ? new Date() : date); activity.setPage(abbreviatePage(page)); activity.setMethod(method); activity.setUser(user); activity.setIp(StringUtils.defaultString(ip)); activity.setRefererPage(abbreviateRefererPage(referer)); <START> activity.setUserAgent(abbreviateUserAgent(agent)); <END> suspiciousActivities.add(activity); }</code><technical_language>move stripToNull() abbreviateXYZ() invoke argument, passing abbreviateXYZ()</technical_language>

Target:
private void logEvent( String type, String page, String method, User user, String ip, String referer, String agent, Date date) { Validate.isTrue(type != null, "Type of suspicious activity was not set"); Validate.isTrue(page != null, "Page should be non null"); SuspiciousActivity activity = new SuspiciousActivity(); SuspiciousActivityType activityType = new SuspiciousActivityType(); activityType.setName(type); activity.setType(activityType); activity.setOccurredAt(date == null ? new Date() : date); activity.setPage(abbreviatePage(page)); activity.setMethod(method); activity.setUser(user); activity.setIp(StringUtils.defaultString(ip)); activity.setRefererPage(StringUtils.stripToNull(abbreviateRefererPage(referer))); activity.setUserAgent(StringUtils.stripToNull(abbreviateUserAgent(agent))); suspiciousActivities.add(activity); }
Source:
<code>public void testConcurrentCInvalidateRepositories() throws InterruptedException, ExecutionException { final ExecutorService threadPool = Executors.newFixedThreadPool(THREAD_COUNT); final List<RepositoryInfo> repositoryInfos = env.getRepositories(); List<Future<?>> futures = new LinkedList<>(); for (int i = 0; i < TASK_COUNT; i++) { futures.add(threadPool.submit(() -> { env.applyConfig(false, false); assertTestedProjects(); })); } threadPool.shutdown(); <START> threadPool.awaitTermination(100, TimeUnit.MINUTES); <END> for (Future<?> future : futures) { future.get(); } }</code><technical_language>long I think. Travis terminate build run if is output in 30 minutes IARC</technical_language>

Target:
public void testConcurrentCInvalidateRepositories() throws InterruptedException, ExecutionException { final ExecutorService threadPool = Executors.newFixedThreadPool(THREAD_COUNT); final List<RepositoryInfo> repositoryInfos = env.getRepositories(); List<Future<?>> futures = new LinkedList<>(); for (int i = 0; i < TASK_COUNT; i++) { futures.add(threadPool.submit(() -> { env.applyConfig(false, false); assertTestedProjects(); })); } threadPool.shutdown(); threadPool.awaitTermination(1, TimeUnit.MINUTES); for (Future<?> future : futures) { future.get(); } }
Source:
<code>public void onFailure(Exchange exchange) { boolean connected = AccessController.doPrivileged((PrivilegedAction<Boolean>) contentFile::checkNetwork); if (!connected) { <START> LOGGER.warn("a network error occurred. The Content Directory Monitor may be out of sync!"); <END> } cb.accept(contentFile, false); }</code><technical_language>steps suggest admin fix problem</technical_language>

Target:
public void onFailure(Exchange exchange) { boolean connected = AccessController.doPrivileged((PrivilegedAction<Boolean>) asyncFileEntry::checkNetwork); if (!connected) { LOGGER.debug( "a network error occurred, The file failed to process", asyncFileEntry.getName()); } callback.accept(asyncFileEntry, false); }
Source:
<code>public void testBindNestedNestedNull() throws Exception { Object bean = new Object() { @SuppressWarnings("unused") public Object getFoo() { return null; } }; exception.expect(IllegalArgumentException.class); <START> new BeanPropertyArguments("", bean).find("foo.bar.id", ctx).get().apply(3, stmt, null); <END> }</code><technical_language>I suit existing tests, preferring AssertJ's assertThatThrownBy() JUnit's ExpectedException. If mind converting tests in this class AssertJ appreciate it</technical_language>

Target:
public void testBindNestedNestedNull() { Object bean = new Object() { @SuppressWarnings("unused") public Object getFoo() { return null; } }; assertThatThrownBy(() -> new BeanPropertyArguments("", bean).find("foo.bar.id", ctx).get().apply(3, stmt, null)) .isInstanceOf(IllegalArgumentException.class); }
Source:
<code>public TableFacade createTable(HttpServletRequest request, HttpServletResponse response) { locale = LocaleResolver.getLocale(request); session = request.getSession(); TableFacade tableFacade = null; String matchedStudyOID = null; if(request.getParameter("maxRows") != null) { tableFacade = prepareNewTableFacade(request, response); }else { <START> TableFacade tableFacadeInSession = (TableFacade) request.getSession().getAttribute("LSStableFacade"); <END> tableFacade = getTableFacadeImpl(request, response); matchedStudyOID = (String) request.getSession().getAttribute("matchedStudyOID"); String currentStudyOID = getStudyBean().getOid(); if(matchedStudyOID != null && matchedStudyOID.equals(currentStudyOID)) { if(tableFacadeInSession != null) { Limit limitInSession = tableFacadeInSession.getLimit(); tableFacade.setStateAttr("restore"); tableFacade.setLimit(limitInSession); } }else { tableFacade = prepareNewTableFacade(request, response); } } setDataAndLimitVariables(tableFacade); configureTableFacade(response, tableFacade); if (!tableFacade.getLimit().isExported()) { configureColumns(tableFacade, locale); tableFacade.setMaxRowsIncrements(getMaxRowIncrements()); configureTableFacadePostColumnConfiguration(tableFacade); configureTableFacadeCustomView(tableFacade, request); configureUnexportedTable(tableFacade, locale); } else { configureExportColumns(tableFacade, locale); } return tableFacade; }</code><technical_language>create a static variable store attribute name is referenced in multiple places. E.g. private static final String LIST_SUBJECTS_TABLE_FACADE = "LSStableFacade";</technical_language>

Target:
public TableFacade createTable(HttpServletRequest request, HttpServletResponse response) { locale = LocaleResolver.getLocale(request); session = request.getSession(); TableFacade tableFacade = getTableFacadeImpl(request, response); tableFacade.setStateAttr("restore"); try { String maxrows = WebUtils.findParameterValue(request, "maxRows"); Integer.parseInt(maxrows); Cookie cookie = new Cookie("maxrows", maxrows); cookie.setMaxAge(7 * 24 * 60 * 60); response.addCookie(cookie); } catch (Exception e) { } try { tableFacade.setMaxRows(Integer.parseInt(WebUtils.getCookie(request, "maxrows").getValue())); } catch (Exception e) { tableFacade.setMaxRows(50); } setDataAndLimitVariables(tableFacade); configureTableFacade(response, tableFacade); if (!tableFacade.getLimit().isExported()) { configureColumns(tableFacade, locale); tableFacade.setMaxRowsIncrements(getMaxRowIncrements()); configureTableFacadePostColumnConfiguration(tableFacade); configureTableFacadeCustomView(tableFacade, request); configureUnexportedTable(tableFacade, locale); } else { configureExportColumns(tableFacade, locale); } return tableFacade; }
Source:
<code>void flushState() { try { stateMgr.flush(); } catch (final ProcessorStateException e) { <START> if (e.getCause() instanceof RetriableException) { <END> log.warn("Caught a retriable Kafka exception while flushing state. Initiating a rebalance to attempt recovery.", e); throw new TaskMigratedException(this, e); } } }</code><technical_language>Is this intentional? ProducerFencedException inherit RetriableException, missing something, this kill thread. for in StandbyTask</technical_language>

Target:
void flushState() { try { stateMgr.flush(); } catch (final ProcessorStateException e) { if (e.getCause() instanceof RecoverableClientException) { throw new TaskMigratedException(this, e); } } }
Source:
<code>public Guid getId() { <START> return this.id; <END> }</code><technical_language>this. prefix is required getters</technical_language>

Target:
public Guid getId() { return id; }
Source:
<code>public void testCurrentClientToOldServer() throws Exception { IgniteProcessProxy proxy = null; try { if (verFormatted.equals(IgniteVersionUtils.VER_STR)) { Ignite ignite = startGrid(0); initNode(ignite); } else { Ignite ignite = startGrid(1, verFormatted, this::processRemoteConfiguration, this::initNode); proxy = IgniteProcessProxy.ignite(ignite.name()); } testClient(verFormatted); } finally { stopAllGrids(); if (proxy != null) { Process proc = proxy.getProcess().getProcess(); <START> GridTestUtils.waitForCondition(() -> !proc.isAlive(), 5_000L); <END> } } }</code><technical_language>result of waitForCondition is ignored</technical_language>

Target:
public void testCurrentClientToOldServer() throws Exception { IgniteProcessProxy proxy = null; try { if (verFormatted.equals(IgniteVersionUtils.VER_STR)) { Ignite ignite = startGrid(0); initNode(ignite); } else { Ignite ignite = startGrid(1, verFormatted, this::processRemoteConfiguration, this::initNode); proxy = IgniteProcessProxy.ignite(ignite.name()); } testClient(verFormatted); } finally { stopAllGrids(); if (proxy != null) { Process proc = proxy.getProcess().getProcess(); assertTrue(GridTestUtils.waitForCondition(() -> !proc.isAlive(), 5_000L)); } } }
Source:
<code>public URI getPictureUrl() { final LinkedIn2ProfilePicture pp = getProfilePicture(); <START> if (pp == null) <END> return null; final DisplayImageTilde displayImageTilde = pp.getDisplayImageTilde(); if (displayImageTilde == null) return null; final Element[] elements = displayImageTilde.getElements(); if (elements == null || elements.length == 0) return null; final Element element = elements[0]; if (element == null) return null; final Identifier[] identifiers = element.getIdentifiers(); if (identifiers == null || identifiers.length == 0) return null; final Identifier identifier = identifiers[0]; if (identifier == null) return null; final String identifier2 = identifier.getIdentifier(); if (identifier2 == null) return null; return CommonHelper.asURI(identifier2); }</code><technical_language>written nowhere, prefer curly brackets for single line</technical_language>

Target:
public URI getPictureUrl() { final LinkedIn2ProfilePicture pp = getProfilePicture(); if (pp == null) { return null; } final DisplayImageTilde displayImageTilde = pp.getDisplayImageTilde(); if (displayImageTilde == null) { return null; } final Element[] elements = displayImageTilde.getElements(); if (elements == null || elements.length == 0) { return null; } final Element element = elements[0]; if (element == null) { return null; } final Identifier[] identifiers = element.getIdentifiers(); if (identifiers == null || identifiers.length == 0) { return null; } final Identifier identifier = identifiers[0]; if (identifier == null) { return null; } final String identifier2 = identifier.getIdentifier(); if (identifier2 == null) { return null; } return CommonHelper.asURI(identifier2); }
Source:
<code>private void setCommitBody(List<BoxUploadSessionPart> parts, Map<String, String> attributes) { JsonArray array = new JsonArray(); for (BoxUploadSessionPart part : parts) { JsonObject partObj = new JsonObject(); <START> partObj.add("part_id", part.getPartId()); <END> partObj.add("offset", part.getOffset()); partObj.add("size", part.getSize()); array.add(partObj); } mBodyMap.put("parts", array); if (attributes != null) { JsonObject attrObj = new JsonObject(); for (String key : attributes.keySet()) { attrObj.add(key, attributes.get(key)); } mBodyMap.put("attributes", attrObj); } }</code><technical_language>Please reuse strings (part_id, offset size) BoxUploadSessionPart</technical_language>

Target:
private void setCommitBody(List<BoxUploadSessionPart> parts, Map<String, String> attributes) { JsonArray array = new JsonArray(); for (BoxUploadSessionPart part : parts) { JsonObject partObj = new JsonObject(); partObj.add(BoxUploadSessionPart.FIELD_PART_ID, part.getPartId()); partObj.add(BoxUploadSessionPart.FIELD_OFFSET, part.getOffset()); partObj.add(BoxUploadSessionPart.FIELD_SIZE, part.getSize()); array.add(partObj); } mBodyMap.put("parts", array); if (attributes != null) { JsonObject attrObj = new JsonObject(); for (String key : attributes.keySet()) { attrObj.add(key, attributes.get(key)); } mBodyMap.put("attributes", attrObj); } }
Source:
<code>public void onPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); Material type = block.getType(); Location blockLocation = block.getLocation(); if (!ProtectionSystem.build(player, blockLocation, true)) { return; } event.setCancelled(true); if (!this.config.buggedBlocks || this.config.buggedBlocksExclude.contains(type)) { return; } ItemStack itemInHand = event.getItemInHand(); if ((itemInHand.getAmount() - 1) == 0) { if (Reflections.USE_PRE_9_METHODS) { player.setItemInHand(null); } else { itemInHand.setAmount(0); } } else { itemInHand.setAmount(itemInHand.getAmount() - 1); } Location playerLocation = player.getLocation(); boolean sameColumn = (playerLocation.getBlockX() == blockLocation.getBlockX()) && (playerLocation.getBlockZ() == blockLocation.getBlockZ()); double distanceUp = (playerLocation.getY() - blockLocation.getBlockY()); boolean upToTwoBlocks = (distanceUp > 0) && (distanceUp <= 2); if (sameColumn && upToTwoBlocks) { <START> player.setVelocity(new Vector(0, 0.4, 0)); <END> } Bukkit.getScheduler().runTaskLater(FunnyGuilds.getInstance(), () -> { block.setType(type); ItemStack returnItem = event.getItemInHand().clone(); returnItem.setAmount(1); Bukkit.getScheduler().runTaskLater(FunnyGuilds.getInstance(), () -> { event.getBlockReplacedState().update(true); if (!player.isOnline()) { return; } if (this.config.buggedBlockReturn) { player.getInventory().addItem(returnItem); } }, this.config.buggedBlocksTimer); }, 0); }</code><technical_language>If this vector is constant, a good idea create instance of this vector class instantiation</technical_language>

Target:
public void onPlace(BlockPlaceEvent event) { Player player = event.getPlayer(); Block block = event.getBlock(); Material type = block.getType(); Location blockLocation = block.getLocation(); if (!ProtectionSystem.build(player, blockLocation, true)) { return; } event.setCancelled(true); if (!this.config.buggedBlocks || this.config.buggedBlocksExclude.contains(type)) { return; } ItemStack itemInHand = event.getItemInHand(); if ((itemInHand.getAmount() - 1) == 0) { if (Reflections.USE_PRE_9_METHODS) { player.setItemInHand(null); } else { itemInHand.setAmount(0); } } else { itemInHand.setAmount(itemInHand.getAmount() - 1); } Location playerLocation = player.getLocation(); boolean sameColumn = (playerLocation.getBlockX() == blockLocation.getBlockX()) && (playerLocation.getBlockZ() == blockLocation.getBlockZ()); double distanceUp = (playerLocation.getY() - blockLocation.getBlockY()); boolean upToTwoBlocks = (distanceUp > 0) && (distanceUp <= 2); if (sameColumn && upToTwoBlocks) { player.setVelocity(ANTI_GLITCH_VELOCITY); } Bukkit.getScheduler().runTask(FunnyGuilds.getInstance(), () -> { block.setType(type); ItemStack returnItem = event.getItemInHand().clone(); returnItem.setAmount(1); Bukkit.getScheduler().runTaskLater(FunnyGuilds.getInstance(), () -> { event.getBlockReplacedState().update(true); if (!player.isOnline()) { return; } if (this.config.buggedBlockReturn) { player.getInventory().addItem(returnItem); } }, this.config.buggedBlocksTimer); }); }
Source:
<code>private void parseEntry(boolean forward) { currentEntry = cache.getEntry(ptr); final byte[] cep = currentEntry.path; if (!forward) { if (nextSubtreePos > 0) { final DirCacheTree p = tree.getChild(nextSubtreePos - 1); if (p.contains(cep, pathOffset, cep.length)) { nextSubtreePos--; currentSubtree = p; } } } if (nextSubtreePos != tree.getChildCount()) { final DirCacheTree s = tree.getChild(nextSubtreePos); if (s.contains(cep, pathOffset, cep.length)) { currentSubtree = s; nextSubtreePos++; if (s.isValid()) s.getObjectId().copyRawTo(subtreeId, 0); mode = FileMode.TREE.getBits(); path = cep; pathLen = pathOffset + s.nameLength(); return; } } mode = currentEntry.getRawMode(); path = cep; pathLen = cep.length; currentSubtree = null; byte[] entryName = new byte[pathLen - pathOffset]; <START> System.arraycopy(path, pathOffset, entryName, 0, pathLen - pathOffset); <END> if (Arrays.equals(entryName, DOT_GIT_ATTRIBUTES_BYTES)) attributesNode = new LazyLoadingAttributesNode( currentEntry.getObjectId()); }</code><technical_language>I need copy entry part of array in order compare DOT_GIT_ATTRIBUTES_BYTES. Instead RawParseUtil.match() compare entry name</technical_language>

Target:
private void parseEntry(boolean forward) { currentEntry = cache.getEntry(ptr); final byte[] cep = currentEntry.path; if (!forward) { if (nextSubtreePos > 0) { final DirCacheTree p = tree.getChild(nextSubtreePos - 1); if (p.contains(cep, pathOffset, cep.length)) { nextSubtreePos--; currentSubtree = p; } } } if (nextSubtreePos != tree.getChildCount()) { final DirCacheTree s = tree.getChild(nextSubtreePos); if (s.contains(cep, pathOffset, cep.length)) { currentSubtree = s; nextSubtreePos++; if (s.isValid()) s.getObjectId().copyRawTo(subtreeId, 0); mode = FileMode.TREE.getBits(); path = cep; pathLen = pathOffset + s.nameLength(); return; } } mode = currentEntry.getRawMode(); path = cep; pathLen = cep.length; currentSubtree = null; if (RawParseUtils.match(path, pathOffset, DOT_GIT_ATTRIBUTES_BYTES) == path.length) attributesNode = new LazyLoadingAttributesNode( currentEntry.getObjectId()); }
Source:
<code><START> private DataSetReference.Builder handlePersons(ResultProtos.Result result, DataSetReference.Builder builder) <END> throws IOException { if (result.getMetadata() != null) { List<CharSequence> creatorNames = new ArrayList<>(); for (eu.dnetlib.data.proto.FieldTypeProtos.Author sourceAuthor : result.getMetadata().getAuthorList()) { if (StringUtils.isNotBlank(sourceAuthor.getFullname())) { creatorNames.add(sourceAuthor.getFullname()); } } if (!creatorNames.isEmpty()) { builder.setCreatorNames(creatorNames); } } return builder; }</code><technical_language>Object returned this method is e.g. method return void</technical_language>

Target:
private void handlePersons(ResultProtos.Result result, DataSetReference.Builder builder) { if (result.getMetadata() != null) { builder.setCreatorNames(result.getMetadata().getAuthorList().stream() .filter(x -> StringUtils.isNotBlank(x.getFullname())) .map(Author::getFullname) .collect(Collectors.toList())); } }
Source:
<code>private String handleAggregationFunction(CallExpression aggregation, Map<VariableReferenceExpression, Selection> inputSelections) { String prestoAgg = aggregation.getDisplayName().toLowerCase(ENGLISH); List<RowExpression> params = aggregation.getArguments(); switch (prestoAgg) { case "count": if (params.size() <= 1) { return format("count(%s)", params.isEmpty() ? "*" : inputSelections.get(getVariableReference(params.get(0)))); } break; case "approx_percentile": return handleApproxPercentile(aggregation, inputSelections); default: if (UNARY_AGGREGATION_MAP.containsKey(prestoAgg) && aggregation.getArguments().size() == 1) { return format("%s(%s)", UNARY_AGGREGATION_MAP.get(prestoAgg), inputSelections.get(getVariableReference(params.get(0)))); <START> } <END> } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("aggregation function '%s' not supported yet", aggregation)); }</code><technical_language>spell out Aggregation</technical_language>

Target:
private String handleAggregationFunction(CallExpression aggregation, Map<VariableReferenceExpression, Selection> inputSelections) { String prestoAggregation = aggregation.getDisplayName().toLowerCase(ENGLISH); List<RowExpression> parameters = aggregation.getArguments(); switch (prestoAggregation) { case "count": if (parameters.size() <= 1) { return format("count(%s)", parameters.isEmpty() ? "*" : inputSelections.get(getVariableReference(parameters.get(0)))); } break; case "approx_percentile": return handleApproxPercentile(aggregation, inputSelections); default: if (UNARY_AGGREGATION_MAP.containsKey(prestoAggregation) && aggregation.getArguments().size() == 1) { return format("%s(%s)", UNARY_AGGREGATION_MAP.get(prestoAggregation), inputSelections.get(getVariableReference(parameters.get(0)))); } } throw new PinotException(PINOT_UNSUPPORTED_EXPRESSION, Optional.empty(), format("aggregation function '%s' not supported yet", aggregation)); }
Source:
<code>public void testDeleteLoadBalancer() throws SerializationException, StateAccessException, MappingStatusException, Rule.RuleIndexOutOfBoundsException { String path = pb.getPoolHealthMonitorMappingsPath(pool.id, healthMonitor.id); Assert.assertTrue(zk.exists(path)); <START> Assert.assertTrue(dataClient.loadBalancersGetAll().size() == 1); <END> UUID lbId = dataClient.poolGet(pool.id).getLoadBalancerId(); dataClient.loadBalancerDelete(lbId); Assert.assertFalse(zk.exists(path)); Assert.assertNull(dataClient.poolGet(pool.id)); }</code><technical_language>need this if 'get' of Pool</technical_language>

Target:
public void testDeleteLoadBalancer() throws SerializationException, StateAccessException, MappingStatusException, Rule.RuleIndexOutOfBoundsException { String path = pb.getPoolHealthMonitorMappingsPath(pool.id, healthMonitor.id); Assert.assertTrue(zk.exists(path)); UUID lbId = dataClient.poolGet(pool.id).getLoadBalancerId(); dataClient.loadBalancerDelete(lbId); Assert.assertFalse(zk.exists(path)); Assert.assertNull(dataClient.poolGet(pool.id)); }
Source:
<code>protected Command getSaveCommand() { <START> return () -> scenarioSimulationEditorWrapper.wrappedSave("Save"); <END> }</code><technical_language>a final static constant wrap this "SAVE" string, wdyt</technical_language>

Target:
protected Command getSaveCommand() { return () -> scenarioSimulationEditorWrapper.wrappedSave(ConstantHolder.SAVE); }
Source:
<code>void doIndexTestTest( String dataSource, String indexTaskFilePath, String queryFilePath, boolean waitForNewVersion ) throws IOException { final String fullDatasourceName = dataSource + config.getExtraDatasourceNameSuffix(); final String taskSpec = StringUtils.replace( getTaskAsString(indexTaskFilePath), "%%DATASOURCE%%", fullDatasourceName ); long startSubTaskCount = -1; final boolean assertRunsSubTasks = taskSpec.contains("index_parallel"); if (assertRunsSubTasks) { startSubTaskCount = countCompleteSubTasks(fullDatasourceName); } submitTaskAndWait(taskSpec, fullDatasourceName, waitForNewVersion); if (assertRunsSubTasks) { final long newSubTasks = countCompleteSubTasks(fullDatasourceName) - startSubTaskCount; <START> Assert.assertTrue("new sub tasks : " + newSubTasks, newSubTasks > 0); <END> } try { String queryResponseTemplate; try { InputStream is = AbstractITBatchIndexTest.class.getResourceAsStream(queryFilePath); queryResponseTemplate = IOUtils.toString(is, "UTF-8"); } catch (IOException e) { throw new ISE(e, "could not read query file: %s", queryFilePath); } queryResponseTemplate = StringUtils.replace( queryResponseTemplate, "%%DATASOURCE%%", fullDatasourceName ); queryHelper.testQueriesFromString(queryResponseTemplate, 2); } catch (Exception e) { LOG.error(e, "Error while testing"); throw new RuntimeException(e); } }</code><technical_language>error message more detailed. supervisor task[taskId] create tasks. executed in parallel mode</technical_language>

Target:
void doIndexTestTest( String dataSource, String indexTaskFilePath, String queryFilePath, boolean waitForNewVersion ) throws IOException { final String fullDatasourceName = dataSource + config.getExtraDatasourceNameSuffix(); final String taskSpec = StringUtils.replace( getTaskAsString(indexTaskFilePath), "%%DATASOURCE%%", fullDatasourceName ); submitTaskAndWait(taskSpec, fullDatasourceName, waitForNewVersion); try { String queryResponseTemplate; try { InputStream is = AbstractITBatchIndexTest.class.getResourceAsStream(queryFilePath); queryResponseTemplate = IOUtils.toString(is, "UTF-8"); } catch (IOException e) { throw new ISE(e, "could not read query file: %s", queryFilePath); } queryResponseTemplate = StringUtils.replace( queryResponseTemplate, "%%DATASOURCE%%", fullDatasourceName ); queryHelper.testQueriesFromString(queryResponseTemplate, 2); } catch (Exception e) { LOG.error(e, "Error while testing"); throw new RuntimeException(e); } }
Source:
<code>private CloudbreakImageCatalogV3 getImagesFromCatalog(Workspace workspace, com.sequenceiq.cloudbreak.cloud.model.Image image) throws CloudbreakImageCatalogException { String imageCatalogUrl; try { <START> imageCatalogUrl = imageCatalogService.get(workspace.getId(), image.getImageCatalogName()).getImageCatalogUrl(); <END> } catch (NotFoundException ex) { imageCatalogUrl = image.getImageCatalogUrl(); } return imageCatalogProvider.getImageCatalogV3(imageCatalogUrl); }</code><technical_language>extend branches log messages a url</technical_language>

Target:
private CloudbreakImageCatalogV3 getImagesFromCatalog(Workspace workspace, com.sequenceiq.cloudbreak.cloud.model.Image image) throws CloudbreakImageCatalogException { String imageCatalogName = image.getImageCatalogName(); String imageCatalogUrl = image.getImageCatalogUrl(); try { imageCatalogUrl = imageCatalogService.get(workspace.getId(), imageCatalogName).getImageCatalogUrl(); LOGGER.info("Image catalog with name and url is used for image filtering.", imageCatalogName, imageCatalogUrl); } catch (NotFoundException ex) { LOGGER.info("Image catalog with name not found. The following image catalog url will be used for image filtering: {}.", imageCatalogName, imageCatalogUrl); } return imageCatalogProvider.getImageCatalogV3(imageCatalogUrl); }
Source:
<code><START> private void closeQuietly(Socket socket) { <END> try { socket.close(); } catch (Throwable t) { t.printStackTrace(); } }</code><technical_language>Mark static</technical_language>

Target:
private static void closeQuietly(Socket socket) { if (socket == null){ return; } try { socket.close(); } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>public Future<Long> write(ByteBuffer src, Callback<Long> callback) { if (src == null) { throw new IllegalArgumentException("Source buffer cannot be null"); } long bytesWritten = 0; Exception exception = null; FutureResult<Long> future = new FutureResult<Long>(); if (!isOpen()) { exception = new ClosedChannelException(); } else { byte[] srcData; int start = 0; int length = src.remaining(); if (src.hasArray()) { srcData = src.array(); start = src.arrayOffset(); } else { <START> srcData = new byte[src.remaining()]; <END> src.get(srcData); } try { data.write(srcData, start, length); bytesWritten = length; } catch (Exception e) { exception = e; } } future.done(bytesWritten, exception); if (callback != null) { callback.onCompletion(bytesWritten, exception); } return future; }</code><technical_language>length instead of src.remaining</technical_language>

Target:
public Future<Long> write(ByteBuffer src, Callback<Long> callback) { if (src == null) { throw new IllegalArgumentException("Source buffer cannot be null"); } long bytesWritten = 0; Exception exception = null; FutureResult<Long> future = new FutureResult<Long>(); if (!isOpen()) { exception = new ClosedChannelException(); } else { byte[] srcData; int start = 0; int length = src.remaining(); if (src.hasArray()) { srcData = src.array(); start = src.arrayOffset(); } else { srcData = new byte[length]; src.get(srcData); } try { data.write(srcData, start, length); bytesWritten = length; } catch (Exception e) { exception = e; } } future.done(bytesWritten, exception); if (callback != null) { callback.onCompletion(bytesWritten, exception); } return future; }
Source:
<code>private static Schema.Type getType(String name, PrimitiveObjectInspector.PrimitiveCategory category) { switch (category) { case BOOLEAN: return Schema.nullableOf(Schema.of(Schema.Type.BOOLEAN)).getType(); case BYTE: case CHAR: case SHORT: case INT: <START> return Schema.nullableOf(Schema.of(Schema.Type.INT)).getType(); <END> case LONG: return Schema.nullableOf(Schema.of(Schema.Type.LONG)).getType(); case FLOAT: return Schema.nullableOf(Schema.of(Schema.Type.FLOAT)).getType(); case DOUBLE: return Schema.nullableOf(Schema.of(Schema.Type.DOUBLE)).getType(); case STRING: case VARCHAR: return Schema.nullableOf(Schema.of(Schema.Type.STRING)).getType(); case BINARY: return Schema.nullableOf(Schema.of(Schema.Type.BYTES)).getType(); case VOID: return Schema.Type.NULL; case DATE: case TIMESTAMP: case DECIMAL: case UNKNOWN: default: throw new IllegalArgumentException(String.format("Table schema contains field '%s' with unsupported type %s", name, category.name())); } }</code><technical_language>do byte, char, short fields work convert a HCatRecord a StructuredRecord</technical_language>

Target:
private static Schema getType(String name, PrimitiveObjectInspector.PrimitiveCategory category) { System.out.println("### primitive cat " + category); switch (category) { case BOOLEAN: return Schema.nullableOf(Schema.of(Schema.Type.BOOLEAN)); case BYTE: case SHORT: case INT: return Schema.nullableOf(Schema.of(Schema.Type.INT)); case LONG: return Schema.nullableOf(Schema.of(Schema.Type.LONG)); case FLOAT: return Schema.nullableOf(Schema.of(Schema.Type.FLOAT)); case DOUBLE: return Schema.nullableOf(Schema.of(Schema.Type.DOUBLE)); case CHAR: case STRING: case VARCHAR: return Schema.nullableOf(Schema.of(Schema.Type.STRING)); case BINARY: return Schema.nullableOf(Schema.of(Schema.Type.BYTES)); case VOID: case DATE: case TIMESTAMP: case DECIMAL: case UNKNOWN: default: throw new IllegalArgumentException(String.format("Table schema contains field '%s' with unsupported type %s", name, category.name())); } }
Source:
<code>public void dispose() { <START> super.dispose(); <END> boldStylerProvider.dispose(); }</code><technical_language>I call super.dispose() end of this method</technical_language>

Target:
public void dispose() { if (boldStylerProvider != null) { boldStylerProvider.dispose(); } super.dispose(); }
Source:
<code>public void update() { ticks++; if (world.isRemote) { if (ticks % (5 + world.rand.nextInt(10)) == 0 || targetPos == null) { updateLaser(); } <START> } else { <END> avgPower.tick(); previousTarget = targetPos != null ? targetPos.toImmutable() : null; if (getTarget() == null) { targetPos = null; } if (ticks % (10 + world.rand.nextInt(20)) == 0 || getTarget() == null) { findTarget(); } ILaserTarget target = getTarget(); if (target != null) { long max = getMaxPowerPerTick(); max *= battery.getStored() + max; max /= battery.getCapacity() / 2; max = Math.min(Math.min(max, getMaxPowerPerTick()), target.getRequiredLaserPower()); long power = battery.extractPower(0, max); long excess = target.receiveLaserPower(power); if (excess > 0) { battery.addPowerChecking(excess, false); } avgPower.push(power - excess); } else { avgPower.clear(); } if (changedTarget()) { sendNetworkUpdate(NET_RENDER_DATA); } } }</code><technical_language>Please return statement this else. a reason for it</technical_language>

Target:
public void update() { if (world.isRemote) { if (clientLaserMoveInterval.markTimeIfDelay(world) || targetPos == null) { updateLaser(); } return; } avgPower.tick(); BlockPos previousTargetPos = targetPos; if (getTarget() == null) { targetPos = null; } if (serverTargetMoveInterval.markTimeIfDelay(world) || getTarget() == null) { findTarget(); } ILaserTarget target = getTarget(); if (target != null) { long max = getMaxPowerPerTick(); max *= battery.getStored() + max; max /= battery.getCapacity() / 2; max = Math.min(Math.min(max, getMaxPowerPerTick()), target.getRequiredLaserPower()); long power = battery.extractPower(0, max); long excess = target.receiveLaserPower(power); if (excess > 0) { battery.addPowerChecking(excess, false); } avgPower.push(power - excess); } else { avgPower.clear(); } if (!Objects.equals(previousTargetPos, targetPos)) { sendNetworkUpdate(NET_RENDER_DATA); } }
Source:
<code>private void setBackgroundColor( View view, boolean selected, boolean read, Keyword firstTag) { if (selected || K9.useBackgroundAsUnreadIndicator()) { int res; if (selected) { res = R.attr.messageListSelectedBackgroundColor; } else { if (read) { res = R.attr.messageListReadItemBackgroundColor; } else { res = R.attr.messageListUnreadItemBackgroundColor; } } TypedValue outValue = new TypedValue(); fragment.getActivity().getTheme().resolveAttribute(res, outValue, true); int backgroundColor = outValue.data; <START> if (firstTag != null) <END> { if (K9.getK9Theme() == K9.Theme.LIGHT) { backgroundColor = firstTag.blendLightBackgroundColor(backgroundColor); } else { backgroundColor = firstTag.blendDarkBackgroundColor(backgroundColor); } } view.setBackgroundColor(backgroundColor); } else { view.setBackgroundColor(Color.TRANSPARENT); } }</code><technical_language>Code style: if (condition) { }</technical_language>

Target:
private void setBackgroundColor( View view, boolean selected, boolean read, Keyword firstTag) { if (selected || K9.useBackgroundAsUnreadIndicator() || (K9.blendBackgroundWithTagColor() && firstTag != null)) { int res; if (selected) { res = R.attr.messageListSelectedBackgroundColor; } else if (K9.useBackgroundAsUnreadIndicator()) { if (read) { res = R.attr.messageListReadItemBackgroundColor; } else { res = R.attr.messageListUnreadItemBackgroundColor; } } else { res = R.attr.messageListReadItemBackgroundColor; } TypedValue outValue = new TypedValue(); fragment.getActivity().getTheme().resolveAttribute(res, outValue, true); int color = outValue.data; if (K9.blendBackgroundWithTagColor() && !selected) { color = blendBackgroundWithKeyword(color, firstTag); } view.setBackgroundColor(color); } else { view.setBackgroundColor(Color.TRANSPARENT); } }
Source:
<code>public DocumentRevsList next() { if (!iteratorValid) { <START> return null; <END> } try { requestsOutstanding.decrementAndGet(); return completionService.take().get(); } catch (InterruptedException ie) { iteratorValid = false; throw new RuntimeException(ie); } catch (ExecutionException ee) { iteratorValid = false; throw new RuntimeException("Problem getting response from queue because the " + "original request threw an exception: ", ee.getCause()); } }</code><technical_language>I this throw a NoSuchElementException</technical_language>

Target:
public DocumentRevsList next() { if (!iteratorValid) { throw new NoSuchElementException("Iterator has been invalidated"); } try { Future<DocumentRevsList> pollResult = completionService.poll(responseTimeout, responseTimeoutUnits); if (pollResult == null) { throw new NoSuchElementException("Poll timed out"); } requestsOutstanding.decrementAndGet(); return pollResult.get(); } catch (InterruptedException ie) { iteratorValid = false; throw new RuntimeException(ie); } catch (ExecutionException ee) { iteratorValid = false; throw new RuntimeException("Problem getting response from queue because the " + "original request threw an exception: ", ee.getCause()); } }
Source:
<code>public void sendEventBundle(EventBundle events) { events = filterBundle(events); <START> if (events.size() == 0) { <END> return; } preProcessBundle(events); send(marshall(events)); }</code><technical_language>events.isEmpty()</technical_language>

Target:
public void sendEventBundle(EventBundle events) { events = filterBundle(events); if (events.isEmpty()) { return; } preProcessBundle(events); send(marshall(events)); }