auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.commons.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20 * 1024 * 1024); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfInmemElements = verifiableProperties.getInt("store.index.max.number.of.inmem.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange("store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); storeJournalFactory = verifiableProperties.getString("store.journal.factory", "com.github.ambry.store.InMemoryJournalFactory"); storeMaxNumberOfEntriesToReturnFromJournal = verifiableProperties.getIntInRange("store.max.number.of.entries.to.return.from.journal", 5000, 1, 10000); storeDeletedMessageRetentionDays = verifiableProperties.getIntInRange("store.deleted.message.retention.days", 7, <START> (int) (storeDataFlushIntervalSeconds / (24 * 3600)) + 1, 365); <END> storeHardDeleteBytesPerSec = verifiableProperties.getInt("store.hard.delete.bytes.per.sec", 1 * 1024 * 1024); storeEnableHardDelete = verifiableProperties.getBoolean("store.enable.hard.delete", false); }</code><technical_language>Realistically speaking, this happen? I log flush happen time time right. in a min if traffic is continuous. retention period is 7 days interrupt log flush time. i missing anything</technical_language>

Target:
public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.commons.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20 * 1024 * 1024); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfInmemElements = verifiableProperties.getInt("store.index.max.number.of.inmem.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange("store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); storeJournalFactory = verifiableProperties.getString("store.journal.factory", "com.github.ambry.store.InMemoryJournalFactory"); storeMaxNumberOfEntriesToReturnFromJournal = verifiableProperties.getIntInRange("store.max.number.of.entries.to.return.from.journal", 5000, 1, 10000); storeDeletedMessageRetentionDays = verifiableProperties.getInt("store.deleted.message.retention.days", 7); storeHardDeleteBytesPerSec = verifiableProperties.getInt("store.hard.delete.bytes.per.sec", 1 * 1024 * 1024); storeEnableHardDelete = verifiableProperties.getBoolean("store.enable.hard.delete", false); }
Source:
<code>public void run() { <START> logger.debug("Connecting to ipaddress on port {}", ipAddress, port, passwd); <END> pluginReference.myPlant = new MyHomeJavaConnector(ipAddress, port, passwd); try { pluginReference.myPlant.startMonitoring(); while (!Thread.interrupted()) { try { String readFrame = pluginReference.myPlant.readMonitoring(); if (readFrame != null) { buildEventFromFrame(readFrame); } } catch (InterruptedException ex) { logger.error("MonitorSessionThread.run, exception : " + ex.getMessage()); } } } catch (IOException ex) { logger.error("MonitorSessionThread.run, exception : " + ex.getMessage()); } logger.info("Stopped MonitorSessionThread thread"); }</code><technical_language>passwd parameter show in output here, add a placeholder for it</technical_language>

Target:
public void run() { logger.debug("Connecting to ipaddress on port with passord {}", ipAddress, port, passwd); pluginReference.myPlant = new MyHomeJavaConnector(ipAddress, port, passwd); try { pluginReference.myPlant.startMonitoring(); while (!Thread.interrupted()) { try { String readFrame = pluginReference.myPlant.readMonitoring(); if (readFrame != null) { buildEventFromFrame(readFrame); } } catch (InterruptedException ex) { logger.error("MonitorSessionThread.run, exception : " + ex.getMessage()); } } } catch (IOException ex) { logger.error("MonitorSessionThread.run, exception : " + ex.getMessage()); } logger.info("Stopped MonitorSessionThread thread"); }
Source:
<code>public Object compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; <START> for (int i = 0; i < stats.length; i++) { <END> stats[i] = new SummaryStatistics(); } final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] variances = new double[sketch.getNumValues()]; for (int i = 0; i < variances.length; i++) { variances[i] = stats[i].getVariance(); } return variances; }</code><technical_language>Arrays.setAll() is cleaner</technical_language>

Target:
public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] variances = new double[sketch.getNumValues()]; Arrays.setAll(variances, i -> stats[i].getVariance()); return variances; }
Source:
<code>public RScheduledFuture<?> scheduleAsync(Runnable task, CronSchedule cronSchedule) { check(task); byte[] classBody = getClassBody(task); byte[] state = encode(task); final Date startDate = cronSchedule.getExpression().getNextValidTimeAfter(new Date()); if (startDate == null) { throw new IllegalArgumentException("Wrong cron expression! Unable to calculate start date"); } long startTime = startDate.getTime(); <START> RemotePromise<Void> result = (RemotePromise<Void>) asyncScheduledServiceAtFixed.schedule(task.getClass().getName(), classBody, state, startTime, cronSchedule.getExpression(), executorId, null); <END> addListener(result); RedissonScheduledFuture<Void> f = new RedissonScheduledFuture<Void>(result, startTime) { public long getDelay(TimeUnit unit) { return unit.convert(startDate.getTime() - System.currentTimeMillis(), TimeUnit.MILLISECONDS); }; }; storeReference(f, result.getRequestId()); return f; }</code><technical_language>a bad idea pass CronExpression object. Pleasae create separate object for</technical_language>

Target:
public RScheduledFuture<?> scheduleAsync(Runnable task, CronSchedule cronSchedule) { check(task); byte[] classBody = getClassBody(task); byte[] state = encode(task); final Date startDate = cronSchedule.getExpression().getNextValidTimeAfter(new Date()); if (startDate == null) { throw new IllegalArgumentException("Wrong cron expression! Unable to calculate start date"); } long startTime = startDate.getTime(); RemotePromise<Void> result = (RemotePromise<Void>) asyncScheduledServiceAtFixed.schedule(task.getClass().getName(), classBody, state, startTime, cronSchedule.getExpression().getCronExpression(),cronSchedule.getExpression().getTimeZone().getID(), executorId, null); addListener(result); RedissonScheduledFuture<Void> f = new RedissonScheduledFuture<Void>(result, startTime) { public long getDelay(TimeUnit unit) { return unit.convert(startDate.getTime() - System.currentTimeMillis(), TimeUnit.MILLISECONDS); }; }; storeReference(f, result.getRequestId()); return f; }
Source:
<code>public void visitNewExpression(NewExpressionTree tree) { ExpressionTree expression = tree.expression(); if (expression.is(Tree.Kind.IDENTIFIER_REFERENCE)) { <START> String next = ((IdentifierTree) expression).name(); <END> if ("Array".equals(next)) { addIssue(tree, MESSAGE); } } super.visitNewExpression(tree); }</code><technical_language>I understand next. Rename constructorName prototypeName</technical_language>

Target:
public void visitNewExpression(NewExpressionTree tree) { ExpressionTree expression = tree.expression(); if (expression.is(Tree.Kind.IDENTIFIER_REFERENCE)) { String constructorName = ((IdentifierTree) expression).name(); if ("Array".equals(constructorName)) { addIssue(tree, MESSAGE); } } super.visitNewExpression(tree); }
Source:
<code>protected Set<TaskEditorPartDescriptor> createPartDescriptors() { Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors(); for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) { if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) { descriptors.remove(taskEditorPartDescriptor); break; } } descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) { @Override public AbstractTaskEditorPart createPart() { return new BugzillaRestTaskEditorPeoplePart(); } }.setPath(PATH_PEOPLE)); <START> TaskData data; <END> try { data = TasksUi.getTaskDataManager().getTaskData(getTask()); if (data != null) { Map<String, TaskAttribute> attributes = data.getRoot().getAttributes(); for (TaskAttribute attribute : attributes.values()) { if (IBugzillaRestConstants.KIND_FLAG.equals(attribute.getMetaData().getKind())) { descriptors.add(new TaskEditorPartDescriptor(ID_PART_BUGZILLA_FLAGS) { @Override public AbstractTaskEditorPart createPart() { return new BugzillaRestFlagPart(); } }.setPath(ID_PART_ATTRIBUTES + "/" + PATH_FLAGS)); break; } } } } catch (CoreException e) { e.printStackTrace(); } return descriptors; }</code><technical_language>reach for task data here. Instead, add part part check flag attributes (createControl do if aren't)</technical_language>

Target:
protected Set<TaskEditorPartDescriptor> createPartDescriptors() { Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors(); for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) { if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) { descriptors.remove(taskEditorPartDescriptor); break; } } descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) { @Override public AbstractTaskEditorPart createPart() { return new BugzillaRestTaskEditorPeoplePart(); } }.setPath(PATH_PEOPLE)); descriptors.add(new TaskEditorPartDescriptor(ID_PART_BUGZILLA_FLAGS) { @Override public AbstractTaskEditorPart createPart() { return new BugzillaRestFlagPart(); } }.setPath(ID_PART_ATTRIBUTES + "/" + PATH_FLAGS)); return descriptors; }
Source:
<code>public static void executeScriptResources( File scriptsDir) throws IOException { if( scriptsDir.isDirectory()) { List<File> scriptFiles = Utils.listAllFiles( scriptsDir ); Logger logger = Logger.getLogger( AgentUtils.class.getName()); <START> if( ! scriptFiles.isEmpty()) { <END> for( File script : scriptFiles) { if( script.getName().contains(Constants.EXEC_SCRIPT)) { if( ! script.canExecute()) script.setExecutable(true); String[] command = { script.getAbsolutePath() }; try { ExecutionResult result = ProgramUtils.executeCommandWithResult( logger, command, script.getParentFile(), null, null, null); if( ! Utils.isEmptyOrWhitespaces( result.getNormalOutput())) logger.fine( result.getNormalOutput()); if( ! Utils.isEmptyOrWhitespaces( result.getErrorOutput())) logger.warning( result.getErrorOutput()); } catch (InterruptedException e) { e.printStackTrace(); } } } } } }</code><technical_language>If scriptFiles is empty, do need test then. loop act test itself. a loop enter. So, remove **if** statement</technical_language>

Target:
public static void executeScriptResources( File scriptsDir) throws IOException { if( scriptsDir.isDirectory()) { List<File> scriptFiles = Utils.listAllFiles( scriptsDir ); Logger logger = Logger.getLogger( AgentUtils.class.getName()); for( File script : scriptFiles) { if( script.getName().contains(Constants.SCOPED_SCRIPT_SUFFIX)) { if( ! script.canExecute()) script.setExecutable(true); String[] command = { script.getAbsolutePath() }; try { ExecutionResult result = ProgramUtils.executeCommandWithResult( logger, command, script.getParentFile(), null, null, null); if( ! Utils.isEmptyOrWhitespaces( result.getNormalOutput())) logger.fine( result.getNormalOutput()); if( ! Utils.isEmptyOrWhitespaces( result.getErrorOutput())) logger.warning( result.getErrorOutput()); } catch (InterruptedException e) { Utils.logException( logger, e ); } } } } }
Source:
<code>public static Optional<Rectangle> getUsableScreenDimensions() { try { if (PlatformSpecific.isOnLinux()) { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } else { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); return Optional.of(ge.getMaximumWindowBounds()); } catch (Exception e) { logger.error(e.getLocalizedMessage(), e); } <START> return Optional.empty(); <END> }</code><technical_language>This return catch block</technical_language>

Target:
public static Optional<Rectangle> getUsableScreenDimensions() { try { if (PlatformSpecific.isOnLinux()) { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName()); } else { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); return Optional.of(ge.getMaximumWindowBounds()); } catch (Exception e) { logger.error(e.getLocalizedMessage(), e); return Optional.empty(); } }
Source:
<code>public ServiceMetricEvent.Builder makeMetricBuilder(TimeBoundaryQuery query) { return new ServiceMetricEvent.Builder() .setDimension("dataSource", DataSourceUtil.getMetricName(query.getDataSource())) .setDimension("type", query.getType()); <START> } <END></code><technical_language>Boolean vanished</technical_language>

Target:
public ServiceMetricEvent.Builder makeMetricBuilder(TimeBoundaryQuery query) { return new ServiceMetricEvent.Builder() .setDimension(DruidMetrics.DATASOURCE, DataSourceUtil.getMetricName(query.getDataSource())) .setDimension(DruidMetrics.TYPE, query.getType()); }
Source:
<code><START> public List<AccountInfo> members(boolean recursive) throws RestApiException { <END> String restPath = getRequestPath() + "/members/?recursive"; JsonElement result = gerritRestClient.getRequest(restPath); return groupsParser.parseGroupMembers(result); }</code><technical_language>Argument recursive is below. nice if cover this in a test</technical_language>

Target:
public List<AccountInfo> members(boolean recursive) throws RestApiException { String restPath = null; if (recursive) { restPath = getRequestPath() + "/members/?recursive"; } else { restPath = getRequestPath() + "/members"; } JsonElement result = gerritRestClient.getRequest(restPath); return groupsParser.parseGroupMembers(result); }
Source:
<code>public void shouldThrowIfIncompatibleSerdeForValue() throws ClassNotFoundException { final Class myClass = Class.forName("java.lang.String"); final StateSerdes<Object, Object> stateSerdes = new StateSerdes<Object, Object>("anyName", Serdes.serdeFrom(myClass), Serdes.serdeFrom(myClass)); final Integer myInt = 123; final Exception e = assertThrows(StreamsException.class, () -> stateSerdes.rawValue(myInt)); assertThat( e.getMessage(), equalTo( <START> "A serializer (value: org.apache.kafka.common.serialization.StringSerializer) " + <END> "is not compatible to the actual value type (value type: java.lang.Integer). " + "Change the default Serdes in StreamConfig or provide correct Serdes via method parameters.")); }</code><technical_language>reuse error message entire template</technical_language>

Target:
public void shouldThrowIfIncompatibleSerdeForValue() throws ClassNotFoundException { final Class myClass = Class.forName("java.lang.String"); final StateSerdes<Object, Object> stateSerdes = new StateSerdes<Object, Object>("anyName", Serdes.serdeFrom(myClass), Serdes.serdeFrom(myClass)); final Integer myInt = 123; final Exception e = assertThrows(StreamsException.class, () -> stateSerdes.rawValue(myInt)); assertThat( e.getMessage(), equalTo( "A serializer (org.apache.kafka.common.serialization.StringSerializer) " + "is not compatible to the actual value type (value type: java.lang.Integer). " + "Change the default Serdes in StreamConfig or provide correct Serdes via method parameters.")); }
Source:
<code>public static Optional<RichColumnDescriptor> getDescriptor(List<PrimitiveColumnIO> columns, List<String> path, HiveColumnHandle hiveColumnHandle) { checkArgument(path.size() >= 1, "Parquet nested path should have at least one component"); int index = getPathIndex(columns, path); if (index == -1) { return empty(); } PrimitiveColumnIO columnIO = columns.get(index); HiveType hiveType = hiveColumnHandle == null ? null : hiveColumnHandle.getHiveType(); <START> return Optional.of(new RichColumnDescriptor(columnIO.getColumnDescriptor(), <END> columnIO.getType().asPrimitiveType(), hiveType)); }</code><technical_language>Put in line: HiveType hiveType = hiveColumnHandle == null ? null : hiveColumnHandle.getHiveType(); return Optional.of(new RichColumnDescriptor(columnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType(), hiveType));</technical_language>

Target:
public static Optional<RichColumnDescriptor> getDescriptor(List<PrimitiveColumnIO> columns, List<String> path, HiveColumnHandle hiveColumnHandle) { checkArgument(path.size() >= 1, "Parquet nested path should have at least one component"); int index = getPathIndex(columns, path); if (index == -1) { return empty(); } PrimitiveColumnIO columnIO = columns.get(index); HiveType hiveType = hiveColumnHandle == null ? null : hiveColumnHandle.getHiveType(); return Optional.of(new RichColumnDescriptor(columnIO.getColumnDescriptor(), columnIO.getType().asPrimitiveType(), Optional.ofNullable(hiveType))); }
Source:
<code>public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), getClusterId(action)); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); if (action.isSetVm() && action.getVm().isSetSnapshots() && action.getVm().getSnapshots().isSetCollapseSnapshots()) { params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); } <START> if (action.isSetImportAsNewEntity()) { <END> params.setImportAsNewEntity(action.isImportAsNewEntity()); if(action.isSetVm() && action.getVm().isSetName()) { params.getVm().setvm_name(action.getVm().getName()); } } return doAction(VdcActionType.ImportVm, params, action); }</code><technical_language>name change...</technical_language>

Target:
public Response doImport(Action action) { validateParameters(action, "cluster.id|name"); Guid destStorageDomainId = getDestStorageDomainId(action); ImportVmParameters params = new ImportVmParameters(getEntity(), parent.getStorageDomainId(), destStorageDomainId, parent.getDataCenterId(destStorageDomainId), getClusterId(action)); params.setImageToDestinationDomainMap(getDiskToDestinationMap(action)); if (action.isSetVm() && action.getVm().isSetSnapshots() && action.getVm().getSnapshots().isSetCollapseSnapshots()) { params.setCopyCollapse(action.getVm().getSnapshots().isCollapseSnapshots()); } if (action.isSetClone()) { params.setImportAsNewEntity(action.isClone()); if(action.isSetVm() && action.getVm().isSetName()) { params.getVm().setvm_name(action.getVm().getName()); } } return doAction(VdcActionType.ImportVm, params, action); }
Source:
<code>private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; if (yieldSignal.isSet()) { return; } } while (nextJoinPositionIndex < joinPositions.length) { if (pageBuilder.isFull()) { return; } int joinPosition = joinPositions[nextJoinPositionIndex]; if (pagesSpatialIndex.isJoinPositionEligible(joinPosition, probePosition, probe)) { pageBuilder.declarePosition(); appendProbe(); pagesSpatialIndex.appendTo(joinPosition, pageBuilder, probeOutputChannels.size()); matchFound = true; } nextJoinPositionIndex++; if (yieldSignal.isSet()) { return; } } <START> if (!matchFound && joinType == SpatialJoinNode.Type.LEFT) { <END> if (pageBuilder.isFull()) { return; } pageBuilder.declarePosition(); appendProbe(); int buildColumnCount = pagesSpatialIndexFactory.getOutputTypes().size(); for (int i = 0; i < buildColumnCount; i++) { pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull(); } } joinPositions = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }</code><technical_language>Unnecessary? imported statically above</technical_language>

Target:
private void processProbe() { verify(probe != null); PagesSpatialIndex pagesSpatialIndex = getDone(pagesSpatialIndexFuture); DriverYieldSignal yieldSignal = operatorContext.getDriverContext().getYieldSignal(); while (probePosition < probe.getPositionCount()) { if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; if (yieldSignal.isSet()) { return; } } while (nextJoinPositionIndex < joinPositions.length) { if (pageBuilder.isFull()) { return; } int joinPosition = joinPositions[nextJoinPositionIndex]; if (pagesSpatialIndex.isJoinPositionEligible(joinPosition, probePosition, probe)) { pageBuilder.declarePosition(); appendProbe(); pagesSpatialIndex.appendTo(joinPosition, pageBuilder, probeOutputChannels.size()); matchFound = true; } nextJoinPositionIndex++; if (yieldSignal.isSet()) { return; } } if (!matchFound && joinType == LEFT) { if (pageBuilder.isFull()) { return; } pageBuilder.declarePosition(); appendProbe(); int buildColumnCount = pagesSpatialIndexFactory.getOutputTypes().size(); for (int i = 0; i < buildColumnCount; i++) { pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull(); } } joinPositions = null; localUserMemoryContext.setBytes(0); probePosition++; } this.probe = null; this.probePosition = 0; }
Source:
<code>public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); <START> target.setId(new Guid(step.getId())); <END> if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { StepEnum type = StepEnum.fromValue(step.getType()); if (type != null) { target.setStepType(map(type)); } } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(JobMapper.map(step.getStatus(), null)); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }</code><technical_language>'new Guid()' here!, please GuidUtils instead</technical_language>

Target:
public static org.ovirt.engine.core.common.job.Step map(Step step, org.ovirt.engine.core.common.job.Step entity) { org.ovirt.engine.core.common.job.Step target = entity != null ? entity : new org.ovirt.engine.core.common.job.Step(); target.setId(GuidUtils.asGuid(step.getId())); if (step.isSetParentStep()) { target.setParentStepId(GuidUtils.asGuid(step.getParentStep().getId())); } target.setJobId(GuidUtils.asGuid(step.getJob().getId())); if (step.isSetType()) { StepEnum type = StepEnum.fromValue(step.getType()); if (type != null) { target.setStepType(map(type)); } } if (step.isSetDescription()) { target.setDescription(step.getDescription()); } if (step.isSetNumber()) { target.setStepNumber(step.getNumber()); } if (step.isSetStatus()) { target.setStatus(JobMapper.map(step.getStatus(), null)); } target.setStartTime(step.isSetStartTime() ? step.getStartTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setEndTime(step.isSetEndTime() ? step.getEndTime().toGregorianCalendar().getTime() : new Date((Calendar.getInstance().getTimeInMillis()))); target.setExternal(step.isSetExternal() ? step.isExternal() : true); return target; }
Source:
<code>public void run() { setThreadName(); <START> receiver = initializeMessageReceiver(); <END> try { consume(); } finally { logger.info("Stopped consumer for subscription {}", subscription.getId()); unsetThreadName(); stoppedLatch.countDown(); } }</code><technical_language>call this phase bootstrap add more debug level logs is currently long initializing receiver (or other component fits bootstrap phase)</technical_language>

Target:
public void run() { setThreadName(); logger.info("Starting batch consumer for subscription ", subscription.getId()); Timer.Context timer = new Timer().time(); receiver = initializeMessageReceiver(); logger.info("Started batch consumer for subscription in ms", subscription.getId(), TimeUnit.NANOSECONDS.toMillis(timer.stop())); try { consume(); } finally { logger.info("Stopped consumer for subscription {}", subscription.getId()); unsetThreadName(); stoppedLatch.countDown(); } }
Source:
<code>public static CrateTestServer[] cluster(String clusterName, int numberOfNodes) { int transportPorts[] = new int[numberOfNodes]; int httpPorts[] = new int[numberOfNodes]; Set<Integer> usedPorts = new HashSet<>(2*numberOfNodes); for (int i = 0; i<numberOfNodes; i++) { int port = randomAvailablePort(); <START> while (usedPorts.contains(port)) { <END> port = randomAvailablePort(); } transportPorts[i] = port; usedPorts.add(port); while (usedPorts.contains(port)) { port = randomAvailablePort(); } httpPorts[i] = port; usedPorts.add(port); } String hostAddress = hostAddress().getHostAddress(); CrateTestServer[] servers = new CrateTestServer[numberOfNodes]; for (int i = 0; i< numberOfNodes; i++) { servers[i] = new CrateTestServer(clusterName, hostAddress, httpPorts[i], transportPorts[i], getUnicastHosts(hostAddress, transportPorts, i)); } return servers; }</code><technical_language>is this necessary if port is retrieved os</technical_language>

Target:
public static CrateTestServer[] cluster(String clusterName, int numberOfNodes) { int transportPorts[] = new int[numberOfNodes]; int httpPorts[] = new int[numberOfNodes]; for (int i = 0; i<numberOfNodes; i++) { transportPorts[i] = randomAvailablePort(); httpPorts[i] = randomAvailablePort(); } String hostAddress = InetAddress.getLoopbackAddress().getHostAddress(); CrateTestServer[] servers = new CrateTestServer[numberOfNodes]; String[] unicastHosts = getUnicastHosts(hostAddress, transportPorts); for (int i = 0; i< numberOfNodes; i++) { servers[i] = new CrateTestServer(clusterName, hostAddress, httpPorts[i], transportPorts[i], unicastHosts); } return servers; }
Source:
<code>private List<ApiKeyEntity> getAllEntities(final Boolean includeDeleted) { List<ApiKeyEntity> result = entityManager <START> .createQuery("from ApiKeyEntity where (deleted = :includeDeleted) ", ApiKeyEntity.class) <END> .setParameter("includeDeleted", includeDeleted) .getResultList(); return result; }</code><technical_language>I this is right.. this search for deleted api keys if includeDeleted == true. I want is some dynamic HQL includes "where deleted = false" leaves clause entirely</technical_language>

Target:
private List<ApiKeyEntity> getAllEntities(final Boolean includeDeleted) { List<ApiKeyEntity> result; if (includeDeleted) { result = entityManager .createQuery("from ApiKeyEntity ", ApiKeyEntity.class) .getResultList(); } else { result = entityManager .createQuery("from ApiKeyEntity where (deleted = false) ", ApiKeyEntity.class) .getResultList(); } return result; }
Source:
<code>public void setUpEnvironment() throws CoreException, IOException { TEMPORARY_FOLDER.create(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot wsRoot = workspace.getRoot(); IProject project = wsRoot.getProject(SOME_PROJECT_NAME); project.create(PROGRESS_MONITOR); project.open(PROGRESS_MONITOR); fProject = project; IFolder folder = project.getFolder("Experiments"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } folder = project.getFolder("Traces"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } IPath filePath = ActivatorTest.getAbsoluteFilePath(TRACE_PATH); IResource resource = folder.getFile(TRACE_FILE); assertNotNull(resource); assertTrue(ResourceUtil.createSymbolicLink(resource, filePath, true, PROGRESS_MONITOR)); <START> File newFolder = TEMPORARY_FOLDER.newFolder(TRACE_FILE); <END> resource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, newFolder.getPath()); IFolder traceFolder = folder.getFolder(TRACE_FOLDER_PATH); if (!traceFolder.exists()) { traceFolder.create(true, true, PROGRESS_MONITOR); } IResource extraTraceResource = traceFolder.getFile(TRACE_FILE); assertNotNull(extraTraceResource); assertTrue(ResourceUtil.createSymbolicLink(extraTraceResource, filePath, true, PROGRESS_MONITOR)); extraTraceResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, newFolder.getPath()); }</code><technical_language>I I this variable, newFolder is a good name ;-)</technical_language>

Target:
public void setUpEnvironment() throws CoreException, IOException { TEMPORARY_FOLDER.create(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot wsRoot = workspace.getRoot(); IProject project = wsRoot.getProject(SOME_PROJECT_NAME); project.create(PROGRESS_MONITOR); project.open(PROGRESS_MONITOR); fProject = project; IFolder folder = project.getFolder("Experiments"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } folder = project.getFolder("Traces"); if (!folder.exists()) { folder.create(true, true, PROGRESS_MONITOR); } IPath filePath = ActivatorTest.getAbsoluteFilePath(TRACE_PATH); IResource resource = folder.getFile(TRACE_FILE); assertNotNull(resource); assertTrue(ResourceUtil.createSymbolicLink(resource, filePath, true, PROGRESS_MONITOR)); File supplementaryFile = TEMPORARY_FOLDER.newFolder(TRACE_FILE); resource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplementaryFile.getPath()); IFolder traceFolder = folder.getFolder(TRACE_FOLDER_PATH); if (!traceFolder.exists()) { traceFolder.create(true, true, PROGRESS_MONITOR); } IResource extraTraceResource = traceFolder.getFile(TRACE_FILE); assertNotNull(extraTraceResource); assertTrue(ResourceUtil.createSymbolicLink(extraTraceResource, filePath, true, PROGRESS_MONITOR)); extraTraceResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplementaryFile.getPath()); }
Source:
<code>private void parseGlobalSecurity(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException { <START> GlobalSecurityConfigurationBuilder builder = holder.getGlobalConfigurationBuilder().security(); <END> ParseUtils.requireNoAttributes(reader); while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case AUTHORIZATION: { parseGlobalAuthorization(reader, holder); break; } default: { throw ParseUtils.unexpectedElement(reader); } } } }</code><technical_language>builder</technical_language>

Target:
private void parseGlobalSecurity(XMLExtendedStreamReader reader, ConfigurationBuilderHolder holder) throws XMLStreamException { ParseUtils.requireNoAttributes(reader); while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case AUTHORIZATION: { parseGlobalAuthorization(reader, holder); break; } default: { throw ParseUtils.unexpectedElement(reader); } } } }
Source:
<code>public List<PaymentWorksVendorUpdatesDTO> getPendingAchUpdatesFromPaymentWorks() { <START> PaymentWorksVendorUpdatesRootDTO updateVendorsRoot = null; <END> List<PaymentWorksVendorUpdatesDTO> vendorUpdates = new ArrayList<PaymentWorksVendorUpdatesDTO>(); boolean moreRecords = true; Client client = buildClient(); ClientResponse response = client.handle(buildClientRequest(buildPendingAchUpdatesFromPaymentWorksURL())); while (moreRecords) { updateVendorsRoot = response.getEntity(PaymentWorksVendorUpdatesRootDTO.class); LOG.debug("getPendingAddressVendorUpdatesFromPaymentWorks, Status: " + response.getStatus()); if (response.getStatus() == 200) { if (ObjectUtils.isNotNull(updateVendorsRoot)) { LOG.debug("getPendingAchUpdatesFromPaymentWorks, ACH Updates retrieved: " + updateVendorsRoot.getCount()); } if (updateVendorsRoot.getCount() > 0) { vendorUpdates.addAll(updateVendorsRoot.getVendorUpdates().getNewVendorList()); } if (StringUtils.isNotEmpty(updateVendorsRoot.getNext())) { response = client.handle(buildClientRequest(updateVendorsRoot.getNext())); } else { moreRecords = false; } } else { LOG.error("getPendingAchUpdatesFromPaymentWorks, Failed to retrieve Pending ACH Updates: " + response.getEntity(String.class)); moreRecords = false; } } return vendorUpdates; }</code><technical_language>more similar logic</technical_language>

Target:
public List<PaymentWorksVendorUpdatesDTO> getPendingAchUpdatesFromPaymentWorks() { PaymentWorksVendorUpdatesRootDTO updateVendorsRoot = null; List<PaymentWorksVendorUpdatesDTO> vendorUpdates = new ArrayList<PaymentWorksVendorUpdatesDTO>(); processVendorUpdates(vendorUpdates, buildPendingAchUpdatesFromPaymentWorksURL()); return vendorUpdates; }
Source:
<code>public KStream<K, V> repartition() { <START> return repartition(RepartitionedInternal.empty()); <END> }</code><technical_language>Repartitioned.as(null) ? This remove empty() -- align pattern apply in existing code</technical_language>

Target:
public KStream<K, V> repartition() { return doRepartition(Repartitioned.as(null)); }
Source:
<code>public CollectEnvCommand(FileSystemContext fsContext) { super(fsContext); <START> mCommands = new HashMap<>(); mCommandsAlt = new HashMap<>(); <END> registerCommands(); }</code><technical_language>This is initialized super class</technical_language>

Target:
public CollectEnvCommand(FileSystemContext fsContext) { super(fsContext); registerCommands(); }
Source:
<code>public static Properties loadProperties(Class<?> cls, String name) throws IOException { final String ERR_MSG = "Failed to locate resource file: " + name; InputStream is = cls.getClassLoader().getResourceAsStream(name); if (is == null) { log.error(ERR_MSG); throw new FileNotFoundException(ERR_MSG); } try { Properties props = new Properties(); props.load(is); return props; } finally { try { is.close(); } catch (Exception e) { String msg = (e.getMessage() != null) ? e.getMessage() : ""; <START> log.error("Failed to close input stream: {}", msg); <END> log.debug("Exception", e); } } }</code><technical_language>I drop msg simply e.getMessage()</technical_language>

Target:
public static Properties loadProperties(Class<?> cls, String name) throws IOException { final String ERR_MSG = "Failed to locate resource file: " + name; InputStream is = cls.getClassLoader().getResourceAsStream(name); if (is == null) { log.error(ERR_MSG); throw new FileNotFoundException(ERR_MSG); } try { Properties props = new Properties(); props.load(is); return props; } finally { try { is.close(); } catch (Exception e) { log.error("Failed to close input stream: {}", e.getMessage()); log.debug("Exception", e); } } }
Source:
<code>public void testSanity() throws Exception { <START> IncrementalIndex index = new OnheapIncrementalIndex( <END> 0, QueryGranularity.MINUTE, new AggregatorFactory[]{new CountAggregatorFactory("cnt")} ); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("billy"), ImmutableMap.<String, Object>of("billy", "hi") ) ); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("sally"), ImmutableMap.<String, Object>of("sally", "bo") ) ); GroupByQueryEngine engine = makeGroupByQueryEngine(); final Sequence<Row> rows = engine.process( GroupByQuery.builder() .setDataSource("test") .setGranularity(QueryGranularity.ALL) .setInterval(new Interval(0, new DateTime().getMillis())) .addDimension("billy") .addDimension("sally") .addAggregator(new LongSumAggregatorFactory("cnt", "cnt")) .build(), new IncrementalIndexStorageAdapter(index) ); final ArrayList<Row> results = Sequences.toList(rows, Lists.<Row>newArrayList()); Assert.assertEquals(2, results.size()); MapBasedRow row = (MapBasedRow) results.get(0); Assert.assertEquals(ImmutableMap.of("billy", "hi", "cnt", 1l), row.getEvent()); row = (MapBasedRow) results.get(1); Assert.assertEquals(ImmutableMap.of("sally", "bo", "cnt", 1l), row.getEvent()); }</code><technical_language>here, parametrize for on- off-heap</technical_language>

Target:
public void testSanity() throws Exception { IncrementalIndex index = indexCreator.createIndex(); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("billy"), ImmutableMap.<String, Object>of("billy", "hi") ) ); index.add( new MapBasedInputRow( new DateTime().minus(1).getMillis(), Lists.newArrayList("sally"), ImmutableMap.<String, Object>of("sally", "bo") ) ); GroupByQueryEngine engine = makeGroupByQueryEngine(); final Sequence<Row> rows = engine.process( GroupByQuery.builder() .setDataSource("test") .setGranularity(QueryGranularity.ALL) .setInterval(new Interval(0, new DateTime().getMillis())) .addDimension("billy") .addDimension("sally") .addAggregator(new LongSumAggregatorFactory("cnt", "cnt")) .build(), new IncrementalIndexStorageAdapter(index) ); final ArrayList<Row> results = Sequences.toList(rows, Lists.<Row>newArrayList()); Assert.assertEquals(2, results.size()); MapBasedRow row = (MapBasedRow) results.get(0); Assert.assertEquals(ImmutableMap.of("billy", "hi", "cnt", 1l), row.getEvent()); row = (MapBasedRow) results.get(1); Assert.assertEquals(ImmutableMap.of("sally", "bo", "cnt", 1l), row.getEvent()); }
Source:
<code><START> public Enhancer(Class<?> hostClass, Map<Method, Method> bridgeDelegates) { <END> super(hostClass, ENHANCER_BY_GUICE_MARKER); this.bridgeDelegates = bridgeDelegates; this.checkcastToProxy = ClassDefining.isAnonymousHost(hostClass) ? hostName : proxyName; }</code><technical_language>nit, need public</technical_language>

Target:
Enhancer(Class<?> hostClass, Map<Method, Method> bridgeDelegates) { super(hostClass, ENHANCER_BY_GUICE_MARKER); this.bridgeDelegates = bridgeDelegates; this.checkcastToProxy = ClassDefining.isAnonymousHost(hostClass) ? hostName : proxyName; }
Source:
<code>private WeldSEBeanDeploymentArchive mergeToOne(CDI11Bootstrap bootstrap, Collection<WeldSEBeanDeploymentArchive> discoveredArchives) { Set<String> beanClasses = new HashSet<String>(); Set<URL> urls = new HashSet<URL>(); for (BeanDeploymentArchive archive : discoveredArchives) { beanClasses.addAll(archive.getBeanClasses()); urls.add(archive.getBeansXml().getUrl()); } BeansXml beansXml = bootstrap.parse(urls); <START> CompositeWeldSeBeanDeploymentArchive archive = new CompositeWeldSeBeanDeploymentArchive(getId(beansXml.getUrl().getPath()), beanClasses, beansXml); <END> return archive; }</code><technical_language>is this single composite bda, "main" ID. is before</technical_language>

Target:
private WeldSEBeanDeploymentArchive mergeToOne(CDI11Bootstrap bootstrap, Collection<WeldSEBeanDeploymentArchive> discoveredArchives) { Set<String> beanClasses = new HashSet<String>(); Set<URL> urls = new HashSet<URL>(); for (BeanDeploymentArchive archive : discoveredArchives) { beanClasses.addAll(archive.getBeanClasses()); urls.add(archive.getBeansXml().getUrl()); } BeansXml beansXml = bootstrap.parse(urls, true); WeldSEBeanDeploymentArchive archive = new WeldSEBeanDeploymentArchive("main", beanClasses, beansXml); return archive; }
Source:
<code>protected void renameTable(String catalogName, SchemaTableName oldTable, SchemaTableName newTable) { try (Connection connection = connectionFactory.openConnection()) { String sql = format( <START> "ALTER TABLE %s RENAME TO %s", <END> quoted(catalogName, oldTable.getSchemaName(), oldTable.getTableName()), quoted(newTable.getTableName())); execute(connection, sql); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }</code><technical_language>Clickhouse a rename syntax (<LINK_0></technical_language>

Target:
protected void renameTable(String catalogName, SchemaTableName oldTable, SchemaTableName newTable) { try (Connection connection = connectionFactory.openConnection()) { String sql = format( "RENAME TABLE %s TO %s", quoted(catalogName, oldTable.getSchemaName(), oldTable.getTableName()), quoted(newTable.getTableName())); execute(connection, sql); } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
<code>public AbstractDecimalSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext systemMemoryContext, int valuesPerPosition) { <START> this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); <END> this.filter = filter.orElse(null); this.outputRequired = outputType.isPresent(); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || this.nonDeterministicFilter || this.filter.testNull(); this.scale = streamDescriptor.getOrcType().getScale().get(); this.nullBlock = outputType.map(type -> type.createBlockBuilder(null, 1).appendNull().build()).orElse(null); this.valuesPerPosition = valuesPerPosition; }</code><technical_language>"stream is null" -> "streamDescriptor is null"</technical_language>

Target:
public AbstractDecimalSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, Optional<Type> outputType, LocalMemoryContext systemMemoryContext, int valuesPerPosition) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputType.isPresent(); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || this.nonDeterministicFilter || this.filter.testNull(); this.scale = streamDescriptor.getOrcType().getScale().get(); this.nullBlock = outputType.map(type -> type.createBlockBuilder(null, 1).appendNull().build()).orElse(null); this.valuesPerPosition = valuesPerPosition; }
Source:
<code>private static List<Type> outputTypes(List<? extends Type> sourceTypes, List<Integer> outputChannels) { <START> ImmutableList.Builder<Type> types = ImmutableList.builder(); <END> for (int channel : outputChannels) { types.add(sourceTypes.get(channel)); } return types.build(); }</code><technical_language>streaming: outputChannels.stream() .map(channel -> sourceTypes::get) .collect(toImmutableList());</technical_language>

Target:
private static List<Type> outputTypes(List<? extends Type> sourceTypes, List<Integer> outputChannels) { return outputChannels.stream() .map(sourceTypes::get) .collect(toImmutableList()); }
Source:
<code>private String aPayment() { JsonStringBuilder jsonStringBuilder = new JsonStringBuilder() .add("charge_id", "chargeId") .add("amount", 100) .add("language", "en") .add("reference", "ref 12") .add("state", new PaymentState("created", false, null, null, null)) .add("email", "test@example.com") .add("description", "description") .add("mandate_id", "amandateid") <START> .add("provider_id", "aproviderid") <END> .add("return_url", "<LINK_0>") .add("payment_provider", "sandbox") .add("card_brand", "VISA") .add("created_date", "2018-07-25T13:12:00"); return jsonStringBuilder.build(); }</code><technical_language>This for card payments add her.e</technical_language>

Target:
private String aPayment() { JsonStringBuilder jsonStringBuilder = new JsonStringBuilder() .add("charge_id", "chargeId") .add("amount", 100) .add("language", "en") .add("reference", "ref 12") .add("state", new PaymentState("created", false, null, null)) .add("email", "test@example.com") .add("description", "description") .add("return_url", "<LINK_0>") .add("payment_provider", "sandbox") .add("card_brand", "VISA") .add("created_date", "2018-07-25T13:12:00"); return jsonStringBuilder.build(); }
Source:
<code>Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); active.closeZombieTasks(); assignedActiveTasks.clear(); changelogReader.clear(); <START> if (!restoreConsumerAssignedStandbys) { <END> restoreConsumer.unsubscribe(); } return zombieTasks; }</code><technical_language>I is safe rely passed in parameter clear tasks assuming set of partitions (though I agree is case indeed), do</technical_language>

Target:
Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); final List<TopicPartition> lostTaskChangelogs = new ArrayList<>(); final RuntimeException exception = active.closeZombieTasks(zombieTasks, lostTaskChangelogs); assignedActiveTasks.keySet().removeAll(zombieTasks); changelogReader.remove(lostTaskChangelogs); removeChangelogsFromRestoreConsumer(lostTaskChangelogs, false); if (exception != null) { throw exception; } else if (!assignedActiveTasks.isEmpty()) { throw new IllegalStateException("TaskManager had leftover tasks after removing all zombies"); } return zombieTasks; }
Source:
<code>private boolean usernamesMatch(String url, String bodyUsername) { String usernamePattern = "(?:" + NpmLayoutProvider.NPM_USER_PATH + ")(.*)"; <START> Pattern pattern = Pattern.compile(usernamePattern); <END> Matcher urlUsernameMatcher = pattern.matcher(url); return urlUsernameMatcher.find() && urlUsernameMatcher.group(1).equals(bodyUsername); }</code><technical_language>pattern constant, compile time</technical_language>

Target:
private boolean usernamesMatch(String url, String bodyUsername) { Matcher urlUsernameMatcher = NpmLayoutProvider.NPM_URL_USERNAME_PATTERN.matcher(url); return urlUsernameMatcher.find() && urlUsernameMatcher.group(1).equals(bodyUsername); }
Source:
<code>public void begin( Bookmark initialBookmark ) { Map<String,Value> parameters = initialBookmark.asBeginTransactionParameters(); <START> connection.run( "BEGIN", parameters, NoOpResponseHandler.INSTANCE ); <END> connection.pullAll( NoOpResponseHandler.INSTANCE ); if ( !initialBookmark.isEmpty() ) { connection.sync(); } }</code><technical_language>Do "BEGIN", "COMMIT" "ROLLBACK" strings deserve constants</technical_language>

Target:
public void begin( Bookmark initialBookmark ) { Map<String,Value> parameters = initialBookmark.asBeginTransactionParameters(); connection.run( BEGIN_QUERY, parameters, NoOpResponseHandler.INSTANCE ); connection.pullAll( NoOpResponseHandler.INSTANCE ); if ( !initialBookmark.isEmpty() ) { connection.sync(); } }