auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void handleGenieException( final HttpServletResponse response, final GenieException e ) throws IOException { if (e instanceof GenieBadRequestException) { this.badRequestRate.increment(); } else if (e instanceof GenieConflictException) { this.conflictRate.increment(); } else if (e instanceof GenieNotFoundException) { this.notFoundRate.increment(); } else if (e instanceof GeniePreconditionException) { this.preconditionRate.increment(); } else if (e instanceof GenieServerException) { this.serverRate.increment(); } else if (e instanceof GenieServerUnavailableException) { this.serverUnavailableRate.increment(); } else if (e instanceof GenieTimeoutException) { this.timeoutRate.increment(); } else if (e instanceof GenieUserLimitExceededException) { <START> this.userLimitExceededRate.increment(); <END> } else { this.genieRate.increment(); } log.error(e.getLocalizedMessage(), e); response.sendError(e.getErrorCode(), e.getLocalizedMessage()); }</code><technical_language>tag this metric user name is it</technical_language>

Target:
public void handleGenieException( final HttpServletResponse response, final GenieException e ) throws IOException { if (e instanceof GenieBadRequestException) { this.badRequestRate.increment(); } else if (e instanceof GenieConflictException) { this.conflictRate.increment(); } else if (e instanceof GenieNotFoundException) { this.notFoundRate.increment(); } else if (e instanceof GeniePreconditionException) { this.preconditionRate.increment(); } else if (e instanceof GenieServerException) { this.serverRate.increment(); } else if (e instanceof GenieServerUnavailableException) { this.serverUnavailableRate.increment(); } else if (e instanceof GenieTimeoutException) { this.timeoutRate.increment(); } else if (e instanceof GenieUserLimitExceededException) { final GenieUserLimitExceededException userLimitExceededException = (GenieUserLimitExceededException) e; final Id taggedId = this.userLimitExceededRateId .withTag("user", userLimitExceededException.getUser()) .withTag("limit", userLimitExceededException.getExceededLimitName()); this.registry.counter(taggedId).increment(); } else { this.genieRate.increment(); } log.error(e.getLocalizedMessage(), e); response.sendError(e.getErrorCode(), e.getLocalizedMessage()); }
Source:
<code>private static FileDialog createNewFileDialog(Shell parent, int style) { String[] desiredPath = fOverridePath; fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return desiredPath != null ? <START> desiredPath[0] : <END> null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return desiredPath != null ? getFileName(desiredPath[0]) : ""; } @Override public String[] getFileNames() { List<String> inStrings = Arrays.asList(desiredPath); List<String> outStrings = new ArrayList<>(); for (String entry : inStrings) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return (desiredPath != null) ? new Path(desiredPath[0]).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }</code><technical_language>exception if user overrides empty array</technical_language>

Target:
private static FileDialog createNewFileDialog(Shell parent, int style) { String[] overrridePath = fOverridePath; String[] sanitizedPath = overrridePath == null ? null : overrridePath.length == 0 ? null : overrridePath; fOverride = false; return new FileDialog(parent, style) { @Override public String open() { return sanitizedPath != null ? sanitizedPath[0] : null; } @Override protected void checkSubclass() { } @Override public String getFileName() { return sanitizedPath != null ? getFileName(sanitizedPath[0]) : ""; } @Override public String[] getFileNames() { List<String> inStrings = sanitizedPath == null ? Collections.emptyList() : Arrays.asList(sanitizedPath); List<String> outStrings = new ArrayList<>(); for (String entry : inStrings) { outStrings.add(getFileName(entry)); } return outStrings.toArray(new String[outStrings.size()]); } @Override public String getFilterPath() { return (sanitizedPath != null) ? new Path(sanitizedPath[0]).removeLastSegments(1).toString() : ""; } private String getFileName(String path) { return new Path(path).lastSegment(); } }; }
Source:
<code>public MrrtReportTemplate getMrrtReportTemplateByUuid(String uuid) { return (MrrtReportTemplate) sessionFactory.getCurrentSession() <START> .createQuery("from MrrtReportTemplate m where m.uuid = :uuid") <END> .setString("uuid", uuid) .uniqueResult(); }</code><technical_language>@ivange94 please hibernates criteria do in other hibernate DAOs</technical_language>

Target:
public MrrtReportTemplate getMrrtReportTemplateByUuid(String uuid) { final Criteria criteria = createMrrtReportTemplateCriteria(); criteria.add(Restrictions.eq("uuid", uuid)); return (MrrtReportTemplate) criteria.uniqueResult(); }
Source:
<code>private static ItemStack insertIntoVanillaInventory(ItemStack stack, Inventory inv) { ItemStack[] contents = inv.getContents(); int minSlot = 0; int maxSlot = contents.length; if (inv instanceof FurnaceInventory) { if (stack.getType().isFuel()) { minSlot = 1; maxSlot = 2; } else { maxSlot = 1; } } else if (inv instanceof BrewerInventory) { if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) { maxSlot = 3; } else if (stack.getType() == Material.BLAZE_POWDER) { minSlot = 4; maxSlot = 5; } else { minSlot = 3; maxSlot = 4; } } for (int slot = minSlot; slot < maxSlot; slot++) { ItemStack is = contents[slot]; if (is == null) { inv.setItem(slot, stack.clone()); return null; } else { <START> if (SlimefunUtils.isItemSimilar(is, stack, true, false) && is.getAmount() < is.getType().getMaxStackSize()) { int amount = is.getAmount() + stack.getAmount(); if (amount > is.getType().getMaxStackSize()) { is.setAmount(is.getType().getMaxStackSize()); stack.setAmount(amount - is.getType().getMaxStackSize()); } else { is.setAmount(amount); stack = null; <END> } inv.setItem(slot, is); return stack; } } } return stack; }</code><technical_language>This reduced in size Math.min(amount, getMaxStackSize</technical_language>

Target:
private static ItemStack insertIntoVanillaInventory(ItemStack stack, Inventory inv) { ItemStack[] contents = inv.getContents(); int minSlot = 0; int maxSlot = contents.length; if (inv instanceof FurnaceInventory) { if (stack.getType().isFuel()) { minSlot = 1; maxSlot = 2; } else { maxSlot = 1; } } else if (inv instanceof BrewerInventory) { if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) { maxSlot = 3; } else if (stack.getType() == Material.BLAZE_POWDER) { minSlot = 4; maxSlot = 5; } else { minSlot = 3; maxSlot = 4; } } ItemStackWrapper wrapper = new ItemStackWrapper(stack); for (int slot = minSlot; slot < maxSlot; slot++) { ItemStack itemInSlot = contents[slot]; if (itemInSlot == null) { inv.setItem(slot, stack); return null; } else { int maxStackSize = itemInSlot.getType().getMaxStackSize(); if (SlimefunUtils.isItemSimilar(itemInSlot, wrapper, true, false) && itemInSlot.getAmount() < maxStackSize) { int amount = itemInSlot.getAmount() + stack.getAmount(); if (amount > maxStackSize) { stack.setAmount(amount - maxStackSize); } else { stack = null; } itemInSlot.setAmount(Math.min(amount, maxStackSize)); inv.setItem(slot, itemInSlot); return stack; } } } return stack; }
Source:
<code><START> public static void readByteBufferFully(FileChannel channel, ByteBuffer b) throws IOException { <END> do { if (channel.read(b) == -1) { throwPrematureEndOfFile(); } } while (b.hasRemaining()); }</code><technical_language>this package-private instead, consistent visibility of class</technical_language>

Target:
static void readByteBufferFully(FileChannel channel, ByteBuffer b) throws IOException { do { if (channel.read(b) == -1) { throwPrematureEndOfFile(); } } while (b.hasRemaining()); }
Source:
<code>private <T, E> List<T> requestList(String url, Class<T> resultClass, QueryPart<T> query, RequestProcessor<E> requestProcessor) { Response response = doRequest(url, query, requestProcessor); <START> if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) { <END> return response.readEntity(listType(resultClass)); } else if (response.getStatus() == HttpStatus.SC_NOT_FOUND) { return Collections.emptyList(); } else { throw AtsdServerExceptionFactory.fromResponse(response); } }</code><technical_language>Move check private separate util method hasStatusFamily(Response res, Status.Family)</technical_language>

Target:
private <T, E> List<T> requestList(String url, Class<T> resultClass, QueryPart<T> query, RequestProcessor<E> requestProcessor) { Response response = doRequest(url, query, requestProcessor); if (AtsdUtil.hasStatusFamily(response, Response.Status.Family.SUCCESSFUL)) { return response.readEntity(listType(resultClass)); } else if (response.getStatus() == HttpStatus.SC_NOT_FOUND) { return Collections.emptyList(); } else { throw AtsdServerExceptionFactory.fromResponse(response); } }
Source:
<code>VoltMessage createRepairMessage(Iv2RepairLogResponseMessage msg) { if (msg.getPayload() instanceof CompleteTransactionMessage) { CompleteTransactionMessage message = (CompleteTransactionMessage)msg.getPayload(); message.setForReplica(false); message.setRequireAck(false); message.setTimestamp(m_restartSeqGenerator.getNextSeqNum()); if (tmLog.isDebugEnabled()) { tmLog.debug(m_whoami + "sending completion for txn " + TxnEgo.txnIdToString(message.getTxnId()) + ", ts " + MpRestartSequenceGenerator.restartSeqIdToString(message.getTimestamp())); } return message; } else { FragmentTaskMessage ftm = (FragmentTaskMessage)msg.getPayload(); boolean restart = !ftm.isReadOnly(); if (restart) { assert(ftm.getInitiateTask() != null); m_interruptedTxns.add(ftm.getInitiateTask()); } CompleteTransactionMessage rollback = null; String procName = ftm.getProcedureName(); <START> if (procName != null) { <END> final SystemProcedureCatalog.Config proc = SystemProcedureCatalog.listing.get(procName); if (proc != null && !proc.isRestartable()) { rollback = new CompleteTransactionMessage( ftm.getInitiatorHSId(), ftm.getCoordinatorHSId(), ftm.getTxnId(), ftm.isReadOnly(), 0, true, false, restart, ftm.isForReplay(), ftm.isNPartTxn()); } } return rollback; } }</code><technical_language>check ftm.isSysProcTask() do map lookup</technical_language>

Target:
VoltMessage createRepairMessage(Iv2RepairLogResponseMessage msg) { if (msg.getPayload() instanceof CompleteTransactionMessage) { CompleteTransactionMessage message = (CompleteTransactionMessage)msg.getPayload(); message.setForReplica(false); message.setRequireAck(false); message.setTimestamp(m_restartSeqGenerator.getNextSeqNum()); if (tmLog.isDebugEnabled()) { tmLog.debug(m_whoami + "sending completion for txn " + TxnEgo.txnIdToString(message.getTxnId()) + ", ts " + MpRestartSequenceGenerator.restartSeqIdToString(message.getTimestamp())); } return message; } else { FragmentTaskMessage ftm = (FragmentTaskMessage)msg.getPayload(); boolean restart = !ftm.isReadOnly(); if (restart) { assert(ftm.getInitiateTask() != null); m_interruptedTxns.add(ftm.getInitiateTask()); } CompleteTransactionMessage rollback = null; if (ftm.isSysProcTask()) { String procName = ftm.getProcedureName(); if (procName != null) { final SystemProcedureCatalog.Config proc = SystemProcedureCatalog.listing.get(procName); if (proc != null && !proc.isRestartable()) { rollback = new CompleteTransactionMessage( ftm.getInitiatorHSId(), ftm.getCoordinatorHSId(), ftm.getTxnId(), ftm.isReadOnly(), 0, true, false, restart, ftm.isForReplay(), ftm.isNPartTxn()); } } } return rollback; } }
Source:
<code>public synchronized void setExecutors(final ScheduledExecutorService mainExecutor, final ScheduledExecutorService secondaryExecutor, final boolean detach) { if (mainExecutor == null || secondaryExecutor == null) { <START> throw new IllegalArgumentException("executors must not be null"); <END> } if (this.executor == mainExecutor && this.secondaryExecutor == secondaryExecutor) { return; } if (running) { throw new IllegalStateException("executor service can not be set on running server"); } if (!this.detachExecutor) { if (this.executor != null) { this.executor.shutdownNow(); } if (this.secondaryExecutor != null) { this.secondaryExecutor.shutdownNow(); } } this.executor = mainExecutor; this.secondaryExecutor = secondaryExecutor; this.detachExecutor = detach; for (Endpoint ep : endpoints) { ep.setExecutors(this.executor, this.secondaryExecutor); } }</code><technical_language>NullPointerException</technical_language>

Target:
public synchronized void setExecutors(final ScheduledExecutorService mainExecutor, final ScheduledExecutorService secondaryExecutor, final boolean detach) { if (mainExecutor == null || secondaryExecutor == null) { throw new NullPointerException("executors must not be null"); } if (this.executor == mainExecutor && this.secondaryExecutor == secondaryExecutor) { return; } if (running) { throw new IllegalStateException("executor service can not be set on running server"); } if (!this.detachExecutor) { if (this.executor != null) { this.executor.shutdownNow(); } if (this.secondaryExecutor != null) { this.secondaryExecutor.shutdownNow(); } } this.executor = mainExecutor; this.secondaryExecutor = secondaryExecutor; this.detachExecutor = detach; for (Endpoint ep : endpoints) { ep.setExecutors(this.executor, this.secondaryExecutor); } }
Source:
<code>private boolean processNewTransportRelation(Relation rel, TransportRoute r) { for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.isEmpty()) continue; if ("stop".equals(role)) continue; if ("platform".equals(role)) continue; <START> if (role.matches("^(stop|platform)_(entry|exit)_only$")) continue; <END> return false; } List<Entity> platforms = new ArrayList<Entity>(); List<Entity> stops = new ArrayList<Entity>(); for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.startsWith("platform")) platforms.add(entry.getKey()); else if (role.startsWith("stop")) stops.add(entry.getKey()); else r.addWay((Way) entry.getKey()); } if (platforms.isEmpty()) platforms.addAll(stops); if (platforms.isEmpty()) return false; for (Entity s : platforms) { TransportStop stop = new TransportStop(s); if (stop.getName().isEmpty() && stopNames.containsKey(EntityId.valueOf(s))) stop.setName(stopNames.get(EntityId.valueOf(s))); r.getForwardStops().add(stop); } return true; }</code><technical_language>this regex static variable pre compiled Pattern.compile.... reused</technical_language>

Target:
private boolean processNewTransportRelation(Relation rel, TransportRoute r) { for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.isEmpty()) continue; if ("stop".equals(role)) continue; if ("platform".equals(role)) continue; stopPlatformMatcher.reset(role); if (stopPlatformMatcher.matches()) continue; return false; } List<Entity> platforms = new ArrayList<Entity>(); List<Entity> stops = new ArrayList<Entity>(); for (Entry<Entity, String> entry : rel.getMemberEntities().entrySet()) { String role = entry.getValue(); if (role.startsWith("platform")) platforms.add(entry.getKey()); else if (role.startsWith("stop")) stops.add(entry.getKey()); else if (entry.getKey() instanceof Way) r.addWay((Way) entry.getKey()); } Map<Entity, String> replacement = new HashMap<Entity, String>(); List<Entity> merged = mergePlatformsStops(platforms, stops, replacement); if (merged.isEmpty()) return false; for (Entity s : merged) { TransportStop stop = new TransportStop(s); if (replacement.containsKey(s)) stop.setName(replacement.get(s)); else if (s.getTag(OSMTagKey.NAME) == null && stopAreas.containsKey(EntityId.valueOf(s))) stop.setName(stopAreas.get(EntityId.valueOf(s)).getTag(OSMTagKey.NAME)); r.getForwardStops().add(stop); } return true; }
Source:
<code>public void taskAccepted(Executor executor, Queue.Task task) { EC2Computer computer = (EC2Computer) executor.getOwner(); EC2AbstractSlave slaveNode = computer.getNode(); int maxTotalUses = slaveNode.maxTotalUses; if (maxTotalUses <= -1) { <START> LOGGER.info("maxTotalUses set to unlimited (" + slaveNode.maxTotalUses + ") for agent " + slaveNode.instanceId); <END> return; } else if (maxTotalUses <= 1) { LOGGER.info("maxTotalUses drained - suspending agent " + slaveNode.instanceId); computer.setAcceptingTasks(false); } else { slaveNode.maxTotalUses = slaveNode.maxTotalUses - 1; LOGGER.info("maxTotalUses set to " + slaveNode.maxTotalUses + " for agent " + slaveNode.instanceId); } }</code><technical_language>I debatable this log message is of use. INFO level</technical_language>

Target:
public void taskAccepted(Executor executor, Queue.Task task) { EC2Computer computer = (EC2Computer) executor.getOwner(); EC2AbstractSlave slaveNode = computer.getNode(); int maxTotalUses = slaveNode.maxTotalUses; if (maxTotalUses <= -1) { LOGGER.fine("maxTotalUses set to unlimited (" + slaveNode.maxTotalUses + ") for agent " + slaveNode.instanceId); return; } else if (maxTotalUses <= 1) { LOGGER.info("maxTotalUses drained - suspending agent " + slaveNode.instanceId); computer.setAcceptingTasks(false); } else { slaveNode.maxTotalUses = slaveNode.maxTotalUses - 1; LOGGER.info("Agent " + slaveNode.instanceId + " has " + slaveNode.maxTotalUses + " builds left"); } }
Source:
<code>public Optional<String> getRoutingKey(final TelemetryProtos.TelemetryMessageLog message) { if (message.getUseRoutingKey()) { return Optional.of(String.format("%s@%s:%d", message.getLocation(), message.getSourceAddress(), message.getSourcePort())); } else { <START> return null; <END> } }</code><technical_language>This is Optional return null. Optional.of() Optional.empty() instead</technical_language>

Target:
public Optional<String> getRoutingKey(final TelemetryProtos.TelemetryMessageLog message) { if (message.getUseRoutingKey()) { return Optional.of(String.format("%s@%s:%d", message.getLocation(), message.getSourceAddress(), message.getSourcePort())); } return Optional.empty(); }
Source:
<code>public void delete(final String path) throws IOException { LOG.debug("DELETE {}", path); final GenericUrl genericUrl = new GenericUrl(this.url + formatPath(path)); final HttpRequestFactory httpRequestFactory = httpRequestFactoryProvider.getRequestFactory(); final HttpRequest request = httpRequestFactory.buildDeleteRequest(genericUrl); HttpResponse response = null; try { response = request.execute(); <START> if (LOG.isDebugEnabled()) { <END> LOG.debug("DELETE response ", path, response.getStatusCode(), response.getStatusMessage()); } } catch (final HttpResponseException e) { throw new MantaClientHttpResponseException(e); } finally { if (response != null) { response.disconnect(); } } }</code><technical_language>isDebugEnabled checks necessary</technical_language>

Target:
public void delete(final String path) throws IOException { LOG.debug("DELETE {}", path); final GenericUrl genericUrl = new GenericUrl(this.url + formatPath(path)); final HttpRequestFactory httpRequestFactory = httpRequestFactoryProvider.getRequestFactory(); final HttpRequest request = httpRequestFactory.buildDeleteRequest(genericUrl); HttpResponse response = null; try { response = request.execute(); LOG.debug("DELETE response ", path, response.getStatusCode(), response.getStatusMessage()); } catch (final HttpResponseException e) { throw new MantaClientHttpResponseException(e); } finally { if (response != null) { response.disconnect(); } } }
Source:
<code>private GeneralCommandLine getPantsExportCommand(final File outputFile, @NotNull Consumer<String> statusConsumer) throws IOException { final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); Optional<String> rcArg = IJRC.getImportPantsRc(commandLine.getWorkDirectory().getPath()); rcArg.ifPresent(commandLine::addParameter); final File targetSpecsFile = FileUtil.createTempFile("pants_target_specs", ".in"); try (FileWriter targetSpecsFileWriter = new FileWriter(targetSpecsFile)) { for (String targetSpec : getTargetSpecs()) { targetSpecsFileWriter.write(targetSpec); targetSpecsFileWriter.write('\n'); } } commandLine.addParameter("--target-spec-file=" + targetSpecsFile.getPath()); commandLine.addParameter("--no-quiet"); if (getOptions().isImportSourceDepsAsJars()) { commandLine.addParameter("export-dep-as-jar"); <START> if (myResolveSourcesAndDocsForJars) { <END> commandLine.addParameter("--sources"); } } else { commandLine.addParameter("export"); } commandLine.addParameter("--output-file=" + outputFile.getPath()); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } return commandLine; }</code><technical_language>users this this settings. Namely, right users expect this setting download sources for 3rdparty dependencies, expect sources accessible for source dependencies default (as is status quo). more comfortable adding another toggle "I want sources for source deps", line, like: [ ] Import source deps jars [ ] sources accessible I feel want turn this toggle default beginning UX close original possible, people disable in future (whereas want toggle resolveSourcesAnsDocsForJars default for 3rdparty deps)</technical_language>

Target:
private GeneralCommandLine getPantsExportCommand(final File outputFile, @NotNull Consumer<String> statusConsumer) throws IOException { final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(getProjectPath()); Optional<String> rcArg = IJRC.getImportPantsRc(commandLine.getWorkDirectory().getPath()); rcArg.ifPresent(commandLine::addParameter); final File targetSpecsFile = FileUtil.createTempFile("pants_target_specs", ".in"); try (FileWriter targetSpecsFileWriter = new FileWriter(targetSpecsFile)) { for (String targetSpec : getTargetSpecs()) { targetSpecsFileWriter.write(targetSpec); targetSpecsFileWriter.write('\n'); } } commandLine.addParameter("--target-spec-file=" + targetSpecsFile.getPath()); commandLine.addParameter("--no-quiet"); if (PantsUtil.isCompatiblePantsVersion(getProjectPath(), "1.24.0")) { commandLine.addParameter("--export-available-target-types"); } if (getOptions().isImportSourceDepsAsJars()) { commandLine.addParameter("export-dep-as-jar"); commandLine.addParameter("--sources"); } else { commandLine.addParameter("export"); } commandLine.addParameter("--output-file=" + outputFile.getPath()); commandLine.addParameter("--formatted"); if (myResolveSourcesAndDocsForJars) { commandLine.addParameter("--export-libraries-sources"); commandLine.addParameter("--export-libraries-javadocs"); } return commandLine; }
Source:
<code>public AccountService getAccountService() throws InstantiationException { <START> return new HelixAccountService(storeConfig, new HelixPropertyStoreFactory<>()); <END> }</code><technical_language>changes HelixPropertyStoreFactory this PR</technical_language>

Target:
public AccountService getAccountService() { long startTimeMs = System.currentTimeMillis(); logger.info("Starting a HelixAccountService"); ZkClient zkClient = new ZkClient(storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, new ZNRecordSerializer()); List<String> subscribedPaths = Collections.singletonList(storeConfig.rootPath); HelixPropertyStore<ZNRecord> helixStore = new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<>(zkClient), storeConfig.rootPath, subscribedPaths); logger.info("HelixPropertyStore started with zkClientConnectString={}, zkClientSessionTimeoutMs={}, " + "zkClientConnectionTimeoutMs={}, rootPath={}, subscribedPaths={}", storeConfig.zkClientConnectString, storeConfig.zkClientSessionTimeoutMs, storeConfig.zkClientConnectionTimeoutMs, storeConfig.rootPath, subscribedPaths); HelixAccountService helixAccountService = new HelixAccountService(helixStore, accountServiceMetrics, notifier); long spentTimeMs = System.currentTimeMillis() - startTimeMs; logger.info("HelixAccountService started, took ms", spentTimeMs); accountServiceMetrics.startupTimeInMs.update(spentTimeMs); return helixAccountService; }
Source:
<code>public CompactSketch<T> filter(Sketch<T> sketchIn) { <START> QuickSelectSketch<T> sketch = new QuickSelectSketch<>(sketchIn.getRetainedEntries(), 0, summaryFactory); <END> final SketchIterator<T> it = sketchIn.iterator(); while (it.next()) { final T summary = it.getSummary(); if (predicate.test(summary)) { sketch.insert(it.getKey(), summary.copy()); } } sketch.setThetaLong(sketchIn.getThetaLong()); sketch.setNotEmpty(); return sketch.compact(); }</code><technical_language>This throw exception if sketchIn == null</technical_language>

Target:
public CompactSketch<T> filter(Sketch<T> sketchIn) { if (sketchIn == null) return new CompactSketch<>(null, null, Long.MAX_VALUE, true); QuickSelectSketch<T> sketch = new QuickSelectSketch<>(sketchIn.getRetainedEntries(), ResizeFactor.X1.lg(), null); boolean empty = true; final SketchIterator<T> it = sketchIn.iterator(); while (it.next()) { final T summary = it.getSummary(); if (predicate.test(summary)) { sketch.insert(it.getKey(), summary.copy()); empty = false; } } sketch.setThetaLong(sketchIn.getThetaLong()); if (!empty) sketch.setNotEmpty(); return sketch.compact(); }
Source:
<code>public Response build() { <START> return Response.create(status, reason, headers, body, request); <END> }</code><technical_language>call new Response(this)</technical_language>

Target:
public Response build() { return new Response(this); }
Source:
<code>protected void deleteAllObjectsInContainerDLO(String regionId, final String containerName) { <START> Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS); <END> ObjectList objects = getApi().getObjectApi(regionId, containerName).list(new ListContainerOptions()); if (objects == null) { return; } List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject, String>() { public String apply(SwiftObject input) { return containerName + "/" + input.getName(); } }); if (!pathsToDelete.isEmpty()) { for (String name : pathsToDelete) getApi().getObjectApi(regionId, containerName).delete(name); } }</code><technical_language>Remove sleep</technical_language>

Target:
protected void deleteAllObjectsInContainerDLO(String regionId, final String containerName) { ObjectList objects = getApi().getObjectApi(regionId, containerName).list(new ListContainerOptions()); if (objects == null) { return; } for (SwiftObject object : objects) { String name = containerName + "/" + object.getName(); getApi().getObjectApi(regionId, containerName).delete(name); } }
Source:
<code>private CustomTabsIntent buildCustomTabsIntent() { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); builder.setShowTitle(true); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity); int color; if (pref.getBoolean(Constants.CONFIG_DARK_THEME, false)) { <START> color = activity.getResources().getColor(R.color.primary_material_dark); <END> } else { color = activity.getResources().getColor(R.color.pumpkin_primary); } builder.setToolbarColor(color); String saveLabel = activity.getResources().getString(R.string.save); Bitmap saveIcon = BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_share_white_24dp); builder.setActionButton(saveIcon, saveLabel, createShareIntent()); return builder.build(); }</code><technical_language>getColor is deprecated, bro. <LINK_0></technical_language>

Target:
private CustomTabsIntent buildCustomTabsIntent() { CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); builder.setShowTitle(true); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity); int color; if (pref.getBoolean(Constants.CONFIG_DARK_THEME, false)) { color = ContextCompat.getColor(activity, R.color.primary_material_dark); } else { color = ContextCompat.getColor(activity, R.color.pumpkin_primary); } builder.setToolbarColor(color); String label = activity.getResources().getString(R.string.share); Bitmap icon = BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_share_white_24dp); builder.setActionButton(icon, label, createShareIntent()); return builder.build(); }
Source:
<code>public void txAbort() { <START> operations.clear(); tablesInTxn.clear(); if (TransactionalContext.isInTransaction()) { this.objectsView.TXAbort(); tablesInTxn.forEach(t -> t.getMetrics().numTxnAborts.incrementAndGet()); } } <END></code><technical_language>order of statements incorrect, tablesInTxn is cleared line 406, iterated line 409</technical_language>

Target:
public void txAbort() { operations.clear(); if (TransactionalContext.isInTransaction()) { this.objectsView.TXAbort(); tablesInTxn.forEach(t -> t.getMetrics().incNumTxnAborts()); } tablesInTxn.clear(); }
Source:
<code>public void testLoadGlobalMRUObjectsFromServer() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); Map<String, String> idToSubjects = new HashMap<String, String>(); int numberOfRecords = 1; <START> idToSubjects = createRecordsOnServer(numberOfRecords, Constants.CASE); <END> String[] ids = idToSubjects.keySet().toArray(new String[numberOfRecords]); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size()+numberOfRecords, mruObjects.size()); } finally { deleteRecordsOnServer(ids, Constants.CASE); } }</code><technical_language>initialize this line 60</technical_language>

Target:
public void testLoadGlobalMRUObjectsFromServer() throws Exception { final List<SalesforceObject> mruObjects_before = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); int numberOfRecords = 1; Map<String, String> idToSubjects = createRecordsOnServer(numberOfRecords, Constants.CASE); Set<String> ids = idToSubjects.keySet(); try { Thread.sleep(2000); final List<SalesforceObject> mruObjects = metadataManager.loadMRUObjects(null, MAX_QUERY_LIMIT, CachePolicy.RELOAD_AND_RETURN_CACHE_DATA, REFRESH_INTERVAL, null); assertNotNull("MRU list should not be null", mruObjects); assertEquals("MRU list size should not be changed", mruObjects_before.size()+numberOfRecords, mruObjects.size()); } finally { deleteRecordsOnServer(ids, Constants.CASE); } }
Source:
<code>public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = MinioClient.builder() .endpoint("<LINK_1>") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); String config = "<ReplicationConfiguration>" <START> + " <Role>arn:aws:iam::35667example:role/CrossRegionReplicationRoleForS3</Role>" <END> + " <Rule>" + " <ID>rule1</ID>" + " <Status>Enabled</Status>" + " <Priority>1</Priority>" + " <DeleteMarkerReplication>" + " <Status>Disabled</Status>" + " </DeleteMarkerReplication>" + " <Filter>" + " <And>" + " <Prefix>TaxDocs</Prefix>" + " <Tag>" + " <Key>key1</Key>" + " <Value>value1</Value>" + " </Tag>" + " <Tag>" + " <Key>key1</Key>" + " <Value>value1</Value>" + " </Tag>" + " </And>" + " </Filter>" + " <Destination>" + " <Bucket>arn:aws:s3:::exampletargetbucket</Bucket>" + " </Destination>" + " </Rule>" + "</ReplicationConfiguration>"; minioClient.setBucketReplication( SetBucketReplicationArgs.builder().bucket("my-bucketname").config(config).build()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }</code><technical_language>ReplicationArn instead of Role - arn:minio:replica::28285312-2dec-4982-b14d-c24e99d472e6:exampletargetbucket</technical_language>

Target:
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeyException { try { MinioClient minioClient = MinioClient.builder() .endpoint("<LINK_1>") .credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG") .build(); String config = "<ReplicationConfiguration>" + " <Role>REPLACE-WITH-ACTUAL-REPLICATION-ROLE</Role>" + " <Rule>" + " <ID>rule1</ID>" + " <Status>Enabled</Status>" + " <Priority>1</Priority>" + " <DeleteMarkerReplication>" + " <Status>Disabled</Status>" + " </DeleteMarkerReplication>" + " <Filter>" + " <And>" + " <Prefix>TaxDocs</Prefix>" + " <Tag>" + " <Key>key1</Key>" + " <Value>value1</Value>" + " </Tag>" + " <Tag>" + " <Key>key2</Key>" + " <Value>value2</Value>" + " </Tag>" + " </And>" + " </Filter>" + " <Destination>" + " <Bucket>REPLACE-WITH-ACTUAL-DESTINATION-BUCKET-ARN</Bucket>" + " </Destination>" + " </Rule>" + "</ReplicationConfiguration>"; minioClient.setBucketReplication( SetBucketReplicationArgs.builder().bucket("my-bucketname").config(config).build()); } catch (MinioException e) { System.out.println("Error occurred: " + e); } }
Source:
<code>private Map.Entry<K, V> convert(String bucketToConvert) { final String[] keyValue = bucketToConvert.split(Pattern.quote(KEY_VALUE_DELIMITER)); checkKeyValue(keyValue); final String key = keyValue[0]; final String value = keyValue[1]; try { final K convertedKey = convert(keyClass, key); final V convertedValue = convert(valueClass, value); final Map.Entry<K, V> convertedBucket = new AbstractMap.SimpleEntry<>(convertedKey, convertedValue); return convertedBucket; } catch (Throwable e) { <START> throw newIllegalArgumentException("The exception is occurred during the conversion", e); <END> } }</code><technical_language>"The exception is occurred conversion" "is" read a bit better. Please test this case</technical_language>

Target:
private Map.Entry<K, V> convert(String bucketToConvert) { final String[] keyValue = bucketToConvert.split(keyValuePattern); checkKeyValue(keyValue); final String key = unquote(keyValue[0]); final String value = unquote(keyValue[1]); try { final K convertedKey = convert(keyClass, key); final V convertedValue = convert(valueClass, value); final Map.Entry<K, V> convertedBucket = new AbstractMap.SimpleEntry<>(convertedKey, convertedValue); return convertedBucket; } catch (Throwable e) { throw newIllegalArgumentException("The exception occurred during the conversion", e); } }
Source:
<code>public void execute(){ List<String> keys = _accountService.getKeys(this); RegisterResponse response = new RegisterResponse(); if(keys != null){ response.setApiKey(keys.get(0)); response.setSecretKey(keys.get(1)); } <START> response.setObjectName("listkeys"); <END> response.setResponseName(getCommandName()); this.setResponseObject(response); }</code><technical_language>this 'userKeys'</technical_language>

Target:
public void execute(){ Map<String, String> keys = _accountService.getKeys(this); RegisterResponse response = new RegisterResponse(); if(keys != null){ response.setApiKey(keys.get("apikey")); response.setSecretKey(keys.get("secretkey")); } response.setObjectName("userkeys"); response.setResponseName(getCommandName()); this.setResponseObject(response); }
Source:
<code>public BlobProperties(long blobSize, String serviceId) { <START> timeToLive = SystemTime.getInstance().milliseconds() + (SystemTime.SecsPerHour * SystemTime.MsPerSec); <END> isPrivate = false; this.blobSize = blobSize; this.creationTime = SystemTime.getInstance().milliseconds(); this.serviceId = serviceId; this.contentType = null; this.memberId = null; this.parentBlobId = null; }</code><technical_language>TimeUnit is easier read SystemTime constants: timeToLive = SystemTime.getInstance().milliseconds() + TimeUnit.HOURS.toMillis(1); I read code pin TTL is creationTime + hour. TimeUnit, read understand</technical_language>

Target:
public BlobProperties(long blobSize, String serviceId) { timeToLiveInMs = SystemTime.getInstance().milliseconds() + (SystemTime.MsPerSec * SystemTime.SecsPerHour); isPrivate = false; this.blobSize = blobSize; this.creationTimeInMs = SystemTime.getInstance().milliseconds(); this.serviceId = serviceId; this.contentType = null; this.memberId = null; this.parentBlobId = null; }
Source:
<code>public void output(String s) { <START> frame.getDialogService().notify(s); <END> }</code><technical_language>pretty BasePanel dialogServie object</technical_language>

Target:
public void output(String s) { dialogService.notify(s); }
Source:
<code>private void updateMutePreviewOverlayVisibility() { <START> boolean showMuteOverlay = getMuteOverlayConfig(); <END> mutePreviewOverlay.setVisibility( showMuteOverlay && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE); }</code><technical_language>reasons for creating a local parameter instead of method setVisibility</technical_language>

Target:
private void updateMutePreviewOverlayVisibility() { mutePreviewOverlay.setVisibility( getMuteOverlayConfig() && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE); }
Source:
<code>public void runParagraphs(RunParagraphsEvent event) { try { listener.runParagraphs(event.getNoteId(), event.getParagraphIndices(), event.getParagraphIds(), event.getCurParagraphId()); if (InterpreterContext.get() != null) { LOGGER.info("complete runParagraphs." + InterpreterContext.get().getParagraphId() + " " + event); } else { LOGGER.info("complete runParagraphs." + event); } } catch (IOException e) { <START> LOGGER.error(e.getMessage()); <END> } }</code><technical_language>LOGGER.error(e.getMessage(), e);</technical_language>

Target:
public void runParagraphs(RunParagraphsEvent event) throws TException { try { listener.runParagraphs(event.getNoteId(), event.getParagraphIndices(), event.getParagraphIds(), event.getCurParagraphId()); if (InterpreterContext.get() != null) { LOGGER.info("complete runParagraphs." + InterpreterContext.get().getParagraphId() + " " + event); } else { LOGGER.info("complete runParagraphs." + event); } } catch (IOException e) { throw new TException(e); } }
Source:
<code>public NettyServerFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, final PublicAccessLogger publicAccessLogger, final RestServerState restServerState, SSLFactory sslFactory) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || publicAccessLogger == null || restServerState == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of NettyServerFactory"); } <START> this.nettyConfig = new NettyConfig(verifiableProperties); <END> this.nettyMetrics = new NettyMetrics(metricRegistry); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = new HashMap<>(); initializers.put(nettyConfig.nettyServerPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, null)); if (sslFactory != null) { initializers.put(nettyConfig.nettyServerSSLPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, sslFactory)); } this.channelInitializers = Collections.unmodifiableMap(initializers); }</code><technical_language>minor: this required</technical_language>

Target:
public NettyServerFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, final PublicAccessLogger publicAccessLogger, final RestServerState restServerState, SSLFactory sslFactory) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || publicAccessLogger == null || restServerState == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of NettyServerFactory"); } nettyConfig = new NettyConfig(verifiableProperties); if (sslFactory == null && nettyConfig.nettyServerSSLEnabled) { throw new IllegalArgumentException("NettyServer requires SSL, but sslFactory is null"); } nettyMetrics = new NettyMetrics(metricRegistry); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = new HashMap<>(); initializers.put(nettyConfig.nettyServerPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, null)); if (nettyConfig.nettyServerSSLEnabled) { initializers.put(nettyConfig.nettyServerSSLPort, new NettyServerChannelInitializer(nettyConfig, nettyMetrics, connectionStatsHandler, requestHandler, publicAccessLogger, restServerState, sslFactory)); } channelInitializers = Collections.unmodifiableMap(initializers); }
Source:
<code>public TenantIdentityMgtClient(String cookie, String backendServerURL, ConfigurationContext configContext) throws Exception { try { <START> stub = new UserIdentityManagementAdminServiceStub(configContext, backendServerURL + "UserIdentityManagementAdminService"); <END> ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (Exception e) { throw new Exception("Error occurred while creating TenantIdentityMgtClient Object"); } }</code><technical_language>define a constant for this</technical_language>

Target:
public TenantIdentityMgtClient(String cookie, String backendServerURL, ConfigurationContext configContext) throws Exception { try { stub = new UserIdentityManagementAdminServiceStub(configContext, backendServerURL + IdentityMgtAdminUIConstants.IDENTITY_MGT_ADMIN_SERVICE_URL); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); } catch (Exception e) { throw new Exception("Error occurred while creating TenantIdentityMgtClient Object", e); } }
Source:
<code>public void testInspectGcsFile() throws InterruptedException, ExecutionException, IOException { InspectGcsFile.inspectGcsFile(PROJECT_ID, GCS_PATH, TOPIC_ID, SUBSCRIPTION_ID); String output = bout.toString(); assertThat(output, containsString("Job created: ")); String jobId = output.split("Job created: ")[1].split("\n")[0]; CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder().setName(jobId).build(); <START> try (DlpServiceClient client = DlpServiceClient.create()) { client.cancelDlpJob(request); } <END> }</code><technical_language>Fine if works, bet happen right other. (some hysteresis). (and a flaky test again)</technical_language>

Target:
public void testInspectGcsFile() throws InterruptedException, ExecutionException, IOException { InspectGcsFile.inspectGcsFile(PROJECT_ID, GCS_PATH, TOPIC_ID, SUBSCRIPTION_ID); TimeUnit.SECONDS.sleep(3); String output = bout.toString(); assertThat(output, containsString("Job created: ")); String jobId = output.split("Job created: ")[1].split("\n")[0]; CancelDlpJobRequest request = CancelDlpJobRequest.newBuilder().setName(jobId).build(); try (DlpServiceClient client = DlpServiceClient.create()) { client.cancelDlpJob(request); } }
Source:
<code><START> public static boolean setDiskAlias(BaseDisk disk, VM vm, int count) { <END> if (disk != null) { String vmName = nullSafeGetVmName(vm); disk.setDiskAlias(getSuggestedDiskAlias(disk, vmName, count)); return true; } else { log.errorFormat("Disk object is null"); return false; } }</code><technical_language>another method here? set int count = nullSafeGetCount(vm)</technical_language>

Target:
public static boolean setDiskAlias(BaseDisk disk, VM vm, int count) { if (disk == null) { log.errorFormat("Disk object is null"); return false; } String vmName = nullSafeGetVmName(vm); disk.setDiskAlias(getSuggestedDiskAlias(disk, vmName, count)); return true; }
Source:
<code>private void assertOperators(Collection<Operator> operators) { Operator o = list(operators).get(0); assertEquals("RUT:Operator:130c", o.getId().getId()); assertEquals("Ruter", o.getName()); assertNull( o.getUrl()); assertNull(o.getPhone()); <START> assertEquals(1, operators.size()); <END> }</code><technical_language>I find body more readable if size is asserted first, Collection is ordered, get(0) operation deterministic length is one</technical_language>

Target:
private void assertOperators(Collection<Operator> operators) { assertEquals(1, operators.size()); Operator o = list(operators).get(0); assertEquals("RUT:Operator:130c", o.getId().getId()); assertEquals("Ruter", o.getName()); assertNull( o.getUrl()); assertNull(o.getPhone()); }
Source:
<code>public boolean isWatching() { <START> Boolean isWatching = null; <END> if(!chains.isEmpty()) isWatching = getActiveKeyChain().isWatching(); for (ECKey importedKey : getImportedKeys()) { if (isWatching == null) isWatching = importedKey.isWatching(); else if (importedKey.isWatching() != isWatching) throw new IllegalStateException("isWatching() conflict for key " + importedKey); } if (isWatching == null) throw new IllegalStateException("no keys"); return isWatching; }</code><technical_language>is this boxed</technical_language>

Target:
public boolean isWatching() { Boolean basicChainIsWatching = basic.isWatching(); Boolean deterministicChainIsWatching = !chains.isEmpty() ? getActiveKeyChain().isWatching() : null; if (basicChainIsWatching == null && deterministicChainIsWatching == null) throw new IllegalStateException("No keys"); if (basicChainIsWatching == null && deterministicChainIsWatching != null) return deterministicChainIsWatching; if (basicChainIsWatching != null && deterministicChainIsWatching == null) return basicChainIsWatching; if (basicChainIsWatching == deterministicChainIsWatching) return deterministicChainIsWatching; if (basicChainIsWatching && !deterministicChainIsWatching) throw new IllegalStateException("Basic chain is watching, deterministic chain is not"); else throw new IllegalStateException("Basic chain is not watching, deterministic chain is"); }