auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static int countBitstreamMime(Context context, BundleName bundleName, Item item, String mimeList) { int count = 0; for(Bundle bundle: item.getBundles()){ if (!bundle.getName().equals(bundleName.name())){ continue; } for(Bitstream bit: bundle.getBitstreams()) { for(String mime: mimeList.split(",")) { try { if (bit.getFormat(context).getMIMEType().equals(mime)) { <START> count++; <END> } } catch (SQLException e) { log.error("Get format error for bitstream " + bit.getName()); } } } } return count; }</code><technical_language>trim mime ? space occurs commas code work properly</technical_language>

Target:
static int countBitstreamMime(Context context, BundleName bundleName, Item item, String mimeList) { int count = 0; for(Bundle bundle: item.getBundles()){ if (!bundle.getName().equals(bundleName.name())){ continue; } for(Bitstream bit: bundle.getBitstreams()) { for(String mime: mimeList.split(",")) { try { if (bit.getFormat(context).getMIMEType().equals(mime.trim())) { count++; } } catch (SQLException e) { log.error("Get format error for bitstream " + bit.getName()); } } } } return count; }
Source:
<code>public void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel) { <START> if (shouldProceed(restRequest, restResponseChannel)) { <END> try { BlobProperties blobProperties = RestUtils.buildBlobProperties(restRequest.getArgs()); byte[] usermetadata = RestUtils.buildUsermetadata(restRequest.getArgs()); router.putBlob(blobProperties, usermetadata, restRequest, new MockPutCallback(this, restRequest, restResponseChannel, blobProperties)); } catch (RestServiceException e) { handleResponse(restRequest, restResponseChannel, null, e); } } }</code><technical_language>ambry support PUTs. do in AdminBlobStorageService here</technical_language>

Target:
public void handlePut(RestRequest restRequest, RestResponseChannel restResponseChannel) { Exception exception = new RestServiceException("PUT is not supported", RestServiceErrorCode.UnsupportedHttpMethod); handleResponse(restRequest, restResponseChannel, null, exception); }
Source:
<code>public PinotScatterGatherQueryClient(PinotConfig pinotConfig) { requestIdGenerator = new AtomicLong(0); prestoHostId = getDefaultPrestoId(); registry = new MetricsRegistry(); brokerMetrics = new BrokerMetrics(registry, DEFAULT_EMIT_TABLE_LEVEL_METRICS); brokerMetrics.initializeGlobalMeters(); eventLoopGroup = new NioEventLoopGroup(); final NettyClientMetrics clientMetrics = new NettyClientMetrics(registry, "presto_pinot_client_"); resourceManager = new PooledNettyClientResourceManager(eventLoopGroup, new HashedWheelTimer(), clientMetrics); requestSenderPool = Executors.newFixedThreadPool(pinotConfig.getThreadPoolSize()); poolTimeoutExecutor = new ScheduledThreadPoolExecutor(pinotConfig.getCorePoolSize()); connectionTimeout = pinotConfig.getConnectionTimeout(); <START> connPool = new KeyedPoolImpl<PooledNettyClientResourceManager.PooledClientConnection>(pinotConfig.getMinConnectionsPerServer(), pinotConfig.getMaxConnectionsPerServer(), pinotConfig.getIdleTimeout().toMillis(), pinotConfig.getMaxBacklogPerServer(), resourceManager, poolTimeoutExecutor, requestSenderPool, registry); <END> resourceManager.setPool(connPool); scatterGatherer = new ScatterGatherImpl(connPool, requestSenderPool); }</code><technical_language>Break this multiple lines. - connectionPool name</technical_language>

Target:
public PinotScatterGatherQueryClient(PinotConfig pinotConfig) { requestIdGenerator = new AtomicLong(0); prestoHostId = getDefaultPrestoId(); final MetricsRegistry registry = new MetricsRegistry(); brokerMetrics = new BrokerMetrics(registry, DEFAULT_EMIT_TABLE_LEVEL_METRICS); brokerMetrics.initializeGlobalMeters(); eventLoopGroup = new NioEventLoopGroup(); final NettyClientMetrics clientMetrics = new NettyClientMetrics(registry, "presto_pinot_client_"); PooledNettyClientResourceManager resourceManager = new PooledNettyClientResourceManager(eventLoopGroup, new HashedWheelTimer(), clientMetrics); ExecutorService requestSenderPool = Executors.newFixedThreadPool(pinotConfig.getThreadPoolSize()); ScheduledThreadPoolExecutor poolTimeoutExecutor = new ScheduledThreadPoolExecutor(pinotConfig.getCorePoolSize()); connectionTimeout = pinotConfig.getConnectionTimeout(); KeyedPool<PooledNettyClientResourceManager.PooledClientConnection> connectionPool = new KeyedPoolImpl<>( pinotConfig.getMinConnectionsPerServer(), pinotConfig.getMaxConnectionsPerServer(), pinotConfig.getIdleTimeout().toMillis(), pinotConfig.getMaxBacklogPerServer(), resourceManager, poolTimeoutExecutor, requestSenderPool, registry); resourceManager.setPool(connectionPool); scatterGatherer = new ScatterGatherImpl(connectionPool, requestSenderPool); }
Source:
<code>private void addMapReduceJobState(PigJob pigJob) { JobClient jobClientLocal = getJobClient(); try { String id = pigJob.getId(); RunningJob runningJob = jobClientLocal.getJob(id); Properties jobConfProperties = getJobConfFromFile(runningJob); if (runningJob == null) { log.warn("Couldn't find job status for jobId=" + pigJob.getId()); return; } JobID jobID = runningJob.getID(); TaskReport[] mapTaskReport = jobClientLocal.getMapTaskReports(jobID); TaskReport[] reduceTaskReport = jobClientLocal.getReduceTaskReports(jobID); if (jobConfProperties != null && jobConfProperties.size() > 0) { pigJob.setConfiguration(jobConfProperties); } pigJob.setMapReduceJobState(new MapReduceJobState(runningJob, mapTaskReport, reduceTaskReport)); } catch (IOException e) { <START> log.error("Error getting job info.", e); <END> } }</code><technical_language>This error concern red herrings a pig script author. add more context error message. want people this error thinking reason job died for example</technical_language>

Target:
private void addMapReduceJobState(PigJob pigJob) { JobClient jobClientLocal = getJobClient(); try { String id = pigJob.getId(); RunningJob runningJob = jobClientLocal.getJob(id); Properties jobConfProperties = getJobConfFromFile(runningJob); if (runningJob == null) { log.warn("Couldn't find job status for jobId=" + pigJob.getId()); return; } JobID jobID = runningJob.getID(); TaskReport[] mapTaskReport = jobClientLocal.getMapTaskReports(jobID); TaskReport[] reduceTaskReport = jobClientLocal.getReduceTaskReports(jobID); if (jobConfProperties != null && jobConfProperties.size() > 0) { pigJob.setConfiguration(jobConfProperties); } pigJob.setMapReduceJobState( new MapReduceJobState(runningJob, mapTaskReport, reduceTaskReport)); } catch (IOException e) { log.warn("Error occurred when retrieving job progress info. ", e); } }
Source:
<code>protected void wakeup() { currentInterval = getRegularInterval(); <START> perClusterSet = Collections.newSetFromMap(new ConcurrentHashMap<AffinityRulesEnforcementPerCluster, Boolean>()); <END> for (VDSGroup vdsGroup : vdsGroupDao.getAll()) { perClusterSet.add(createEnforcementPerCluster(vdsGroup)); } AuditLogableBase logable = new AuditLogableBase(); auditLogDirector.log(logable, AuditLogType.AFFINITY_RULES_ENFORCEMENT_MANAGER_START); scheduleJobs(currentInterval, getInitialInterval()); }</code><technical_language>I get do gain Set instead of a map here</technical_language>

Target:
protected void wakeup() { currentInterval = getRegularInterval(); AuditLogableBase logable = new AuditLogableBase(); auditLogDirector.log(logable, AuditLogType.AFFINITY_RULES_ENFORCEMENT_MANAGER_START); scheduleJobs(currentInterval, getInitialInterval()); }
Source:
<code>private void traceGetCommitTimestamps(@Nullable TableReference tableRef, Set<Long> gets) { if (tableRef != null) { <START> log.trace("Getting commit timestamps for a read", <END> SafeArg.of("numTimestamps", gets.size()), LoggingArgs.tableRef(tableRef)); return; } log.trace("Getting commit timestamps", SafeArg.of("numTimestamps", gets.size())); }</code><technical_language>nit: This is other path, worth including info is a table in log message</technical_language>

Target:
private void traceGetCommitTimestamps(@Nullable TableReference tableRef, Set<Long> gets) { if (tableRef != null) { log.trace("Getting commit timestamps for a read while reading table.", SafeArg.of("numTimestamps", gets.size()), LoggingArgs.tableRef(tableRef)); return; } log.trace("Getting commit timestamps.", SafeArg.of("numTimestamps", gets.size())); }
Source:
<code>public void createNonNullArray() { <START> return new MetaColumn @NonNull [value]; <END> }</code><technical_language>grammar update supports it, love a multi-dimensional array here, dimension annotation</technical_language>

Target:
public Object[] createNonNullArray() { return new Object @NonNull[0]; }
Source:
<code><START> public void closeTest() { <END> HttpRequest request = createRequestWithHeaders(HttpMethod.GET, TestingUri.Close.toString()); EmbeddedChannel channel = createEmbeddedChannel(); channel.writeInbound(request); while (channel.readOutbound() != null) { ; } assertFalse("Channel should be closed", channel.isOpen()); }</code><technical_language>part in this test calls NettyResponseChannel.close()</technical_language>

Target:
public void closeTest() { HttpRequest request = createRequestWithHeaders(HttpMethod.GET, TestingUri.Close.toString()); EmbeddedChannel channel = createEmbeddedChannel(); channel.writeInbound(request); while (channel.readOutbound() != null) { } assertFalse("Channel should be closed", channel.isOpen()); }
Source:
<code>public void testParseFile() throws Exception { Depgraph depgraph = parseFile(); assertThat(depgraph.getRoots()) .containsExactly( "my/thing/static/js/annotations/annotations-canvas-controller.js", "blaze-out/blah/my/blaze-out-file.js") .inOrder(); assertThat(depgraph.getNonroots()) .containsExactly("javascript/closure/base.js", "javascript/closure/string/string.js") .inOrder(); <START> assertThat(depgraph.getNonrootExterns()).containsExactly("javascript/common/dom.js").inOrder(); <END> }</code><technical_language>Add assertion getRootExterns</technical_language>

Target:
public void testParseFile() throws Exception { Depgraph depgraph = parseFile(); assertThat(depgraph.getRoots()) .containsExactly( "my/thing/static/js/annotations/annotations-canvas-controller.js", "blaze-out/blah/my/blaze-out-file.js") .inOrder(); assertThat(depgraph.getNonroots()) .containsExactly("javascript/closure/base.js", "javascript/closure/string/string.js") .inOrder(); assertThat(depgraph.getRootExterns()).isEmpty(); assertThat(depgraph.getNonrootExterns()).containsExactly("javascript/common/dom.js").inOrder(); }
Source:
<code>public static void teardown() <START> { <END> }</code><technical_language>call tearDown laggards operator</technical_language>

Target:
public static void teardown() { laggards.teardown(); }
Source:
<code>private @Nullable Long getTimeFocusedElapsed() { long timeElapsed = (long)(((SystemClock.elapsedRealtime() - timeFocusedAtMs) / 1_000d) + 0.5d); <START> if (timeElapsed < 1 || timeElapsed > 86_400) <END> return null; return timeElapsed; }</code><technical_language>limit attribution window (since changeable) 1 day</technical_language>

Target:
private @Nullable Long getTimeFocusedElapsed() { if (timeFocusedAtMs == null) return null; long timeElapsed = (long)(((SystemClock.elapsedRealtime() - timeFocusedAtMs) / 1_000d) + 0.5d); if (timeElapsed < 1 || timeElapsed > 86_400) return null; return timeElapsed; }
Source:
<code>protected void writeToFile(IFile iFile) { long <START> time1 = <END> System.currentTimeMillis(); try { writer.writeEndDocument(); writer.close(); outputStream.flush(); outputStream.close(); ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); if (iFile.exists()) { iFile.setContents(inputStream, IResource.KEEP_HISTORY | IResource.FORCE, null); } else { checkAndCreateFolderHierarchy(iFile); iFile.create(inputStream, IResource.KEEP_HISTORY | IResource.FORCE, null); } } catch (CoreException | IOException | XMLStreamException e) { Activator.getDefault().logError(e.getMessage(), e); } long time2 = System.currentTimeMillis(); System.out.println("Saving time for System: " + (time2 - time1) + " ms"); }</code><technical_language>startTime</technical_language>

Target:
protected void writeToFile(IFile iFile) { long startTime = System.currentTimeMillis(); try { writer.writeEndDocument(); writer.close(); outputStream.flush(); outputStream.close(); ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); if (iFile.exists()) { iFile.setContents(inputStream, IResource.KEEP_HISTORY | IResource.FORCE, null); } else { checkAndCreateFolderHierarchy(iFile); iFile.create(inputStream, IResource.KEEP_HISTORY | IResource.FORCE, null); } } catch (CoreException | IOException | XMLStreamException e) { Activator.getDefault().logError(e.getMessage(), e); } long endTime = System.currentTimeMillis(); System.out.println("Saving time for System: " + (endTime - startTime) + " ms"); }
Source:
<code>private boolean isBlockUpload(String request) { <START> return Regex.simpleMatch("PUT *?*comp=block*", request); }</code><technical_language>Sam in production code, matching comp=blocklist redundant matching comp=block</technical_language>

Target:
private boolean isBlockUpload(String request) { return Regex.simpleMatch("PUT *?*comp=block*", request) && request.contains("blockid=")); }
Source:
<code>private void loadExtensions(Wallet wallet, WalletExtension[] extensionsList, Protos.Wallet walletProto) throws UnreadableWalletException { final Map<String, WalletExtension> extensions = new HashMap<String, WalletExtension>(); for (WalletExtension e : extensionsList) extensions.put(e.getWalletExtensionID(), e); extensions.putAll(wallet.getExtensions()); for (Protos.Extension extProto : walletProto.getExtensionList()) { String id = extProto.getId(); WalletExtension extension = extensions.get(id); if (extension == null) { if (extProto.getMandatory()) { if (requireMandatoryExtensions) throw new UnreadableWalletException("Unknown mandatory extension in wallet: " + id); else log.error("Unknown extension in wallet {}, ignoring", id); } } else { log.info("Loading wallet extension {}", id); try { wallet.deserializeWalletExtension(extension, extProto.getData().toByteArray()); <START> wallet.addOrGetExistingExtension(extension); <END> } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) { log.error("Error whilst reading extension {}, failing to read wallet", id, e); throw new UnreadableWalletException("Could not parse mandatory extension in wallet: " + id); } else { log.error("Error whilst reading extension {}, ignoring", id, e); } } } } }</code><technical_language>good, adding Wallet.deserializeWalletExtension a new method here, invoke addOrGet time in implementation holding lock, deserialized added atomically</technical_language>

Target:
private void loadExtensions(Wallet wallet, WalletExtension[] extensionsList, Protos.Wallet walletProto) throws UnreadableWalletException { final Map<String, WalletExtension> extensions = new HashMap<String, WalletExtension>(); for (WalletExtension e : extensionsList) extensions.put(e.getWalletExtensionID(), e); extensions.putAll(wallet.getExtensions()); for (Protos.Extension extProto : walletProto.getExtensionList()) { String id = extProto.getId(); WalletExtension extension = extensions.get(id); if (extension == null) { if (extProto.getMandatory()) { if (requireMandatoryExtensions) throw new UnreadableWalletException("Unknown mandatory extension in wallet: " + id); else log.error("Unknown extension in wallet {}, ignoring", id); } } else { log.info("Loading wallet extension {}", id); try { wallet.deserializeAndAddExtension(extension, extProto.getData().toByteArray()); } catch (Exception e) { if (extProto.getMandatory() && requireMandatoryExtensions) { log.error("Error whilst reading extension {}, failing to read wallet", id, e); throw new UnreadableWalletException("Could not parse mandatory extension in wallet: " + id); } else { log.error("Error whilst reading extension {}, ignoring", id, e); } } } } }
Source:
<code>private void addJars() { List<IAntClasspathEntry> allEntries = new ArrayList<>(); if (currentParent != null) { allEntries.addAll(Arrays.asList(currentParent.getEntries())); } else { IAntClasspathEntry[] entries = antContentProvider.getModel().getEntries(ClasspathModel.USER); if (entries != null) { allEntries.addAll(Arrays.asList(entries)); } } List<IPath> selectedPaths = new ArrayList<>(allEntries.size()); Iterator<IAntClasspathEntry> iterator = allEntries.iterator(); while (iterator.hasNext()) { IAntClasspathEntry entry = iterator.next(); URL url = entry.getEntryURL(); if (url != null) { String <START> file = <END> url.getFile(); if (file != null && file.length() > 0) { for (IFile file2 : ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(new Path(file).toFile().toURI())) { selectedPaths.add(file2.getFullPath()); } } } } IPath[] paths = BuildPathDialogAccess.chooseJAREntries(treeViewer.getControl().getShell(), null, selectedPaths.toArray(new IPath[selectedPaths.size()])); if (paths != null && paths.length > 0) { AntClasspathContentProvider contentProvider = (AntClasspathContentProvider) treeViewer.getContentProvider(); contentProvider.setRefreshEnabled(false); for (IPath path : paths) { String varExpression = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", path.toString()); contentProvider.add(currentParent, varExpression); } contentProvider.setRefreshEnabled(true); updateContainer(); } }</code><technical_language>rename fileName, 'file' loop var name</technical_language>

Target:
private void addJars() { List<IAntClasspathEntry> allEntries = new ArrayList<>(); if (currentParent != null) { allEntries.addAll(Arrays.asList(currentParent.getEntries())); } else { IAntClasspathEntry[] entries = antContentProvider.getModel().getEntries(ClasspathModel.USER); if (entries != null) { allEntries.addAll(Arrays.asList(entries)); } } List<IPath> selectedPaths = new ArrayList<>(allEntries.size()); Iterator<IAntClasspathEntry> iterator = allEntries.iterator(); while (iterator.hasNext()) { IAntClasspathEntry entry = iterator.next(); URL url = entry.getEntryURL(); if (url != null) { String fileName = url.getFile(); if (fileName != null && fileName.length() > 0) { for (IFile file : ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(new Path(fileName).toFile().toURI())) { selectedPaths.add(file.getFullPath()); } } } } IPath[] paths = BuildPathDialogAccess.chooseJAREntries(treeViewer.getControl().getShell(), null, selectedPaths.toArray(new IPath[selectedPaths.size()])); if (paths != null && paths.length > 0) { AntClasspathContentProvider contentProvider = (AntClasspathContentProvider) treeViewer.getContentProvider(); contentProvider.setRefreshEnabled(false); for (IPath path : paths) { String varExpression = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", path.toString()); contentProvider.add(currentParent, varExpression); } contentProvider.setRefreshEnabled(true); updateContainer(); } }
Source:
<code>public void basicTest() throws Exception { refreshState(false, true); List<String> segmentsUnderCompaction = getLogSegments(0, 2); <START> reduceValidDataSizeInLogSegments(segmentsUnderCompaction, state.log.getSegmentCapacity() - LogSegment.HEADER_SIZE); <END> long deleteReferenceTimeMs = state.time.milliseconds(); compactAndVerify(segmentsUnderCompaction, deleteReferenceTimeMs, true); }</code><technical_language>minor: I do increment time here. mimic actual flow, reduceValidDataSizeInLogSegments return deleteRefTime in next line</technical_language>

Target:
public void basicTest() throws Exception { refreshState(false, true); List<String> segmentsUnderCompaction = getLogSegments(0, 2); long deleteReferenceTimeMs = reduceValidDataSizeInLogSegments(segmentsUnderCompaction, state.log.getSegmentCapacity() - LogSegment.HEADER_SIZE); compactAndVerify(segmentsUnderCompaction, deleteReferenceTimeMs, true); }
Source:
<code>public byte[] getSrcPathsHash(String[] srcs) { MessageDigest md; try { <START> md = MessageDigest.getInstance("MD5"); <END> } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } for (String src: srcs) { md.update(src.getBytes(Charsets.UTF_8)); } return md.digest(); }</code><technical_language>refine this method. 1. synchronize this method. 2. MessageDigest.getInstance() big overhead reuse it. (It's instantiates a new object time) 3. use, call MessageDigest#reset(). <LINK_0></technical_language>

Target:
public byte[] getSrcPathsHash(String[] srcs) { synchronized (digest) { for (String src : srcs) { digest.update(src.getBytes(Charsets.UTF_8)); } byte[] result = digest.digest(); digest.reset(); return result; } }
Source:
<code>public static List<ReviewProcessor> buildProcessors(Configuration configuration) { List<ReviewProcessor> processors = new ArrayList<>(); <START> ServiceLoader<ReviewProcessorFactory> theLoader = ServiceLoader.load(ReviewProcessorFactory.class); <END> Iterator<ReviewProcessorFactory> theIterator = theLoader.iterator(); while (theIterator.hasNext()) { ReviewProcessorFactory theFactory = theIterator.next(); if (theFactory.isEnabled(configuration)) { processors.add(theFactory.create(configuration)); } } return processors; }</code><technical_language>change variable names match other variables style, so: serviceLoader instead of theLoader, iterator instead of theIterator, reviewProcessorFactory instead of theFactory etc</technical_language>

Target:
public static List<ReviewProcessor> buildProcessors(Configuration configuration) { List<ReviewProcessor> processors = new ArrayList<>(); ServiceLoader<ReviewProcessorFactory> loader = ServiceLoader.load(ReviewProcessorFactory.class); Iterator<ReviewProcessorFactory> iterator = loader.iterator(); while (iterator.hasNext()) { ReviewProcessorFactory factory = iterator.next(); if (factory.isEnabled(configuration)) { processors.add(factory.create(configuration)); } } return processors; }
Source:
<code>public boolean isExist(byte[] key) throws IOException { try { return db.get(handle, key) != null; } catch (RocksDBException e) { throw toIOException( <START> "Failed to check if given key exists", e); <END> } }</code><technical_language>This error message is kind of confusing. replace with, "Error in accessing DB."</technical_language>

Target:
public boolean isExist(byte[] key) throws IOException { try { return db.get(handle, key) != null; } catch (RocksDBException e) { throw toIOException( "Error in accessing DB. ", e); } }
Source:
<code>private void handleExistingObsWithComplexConcept(Obs obs) { if (null != obs.getConcept() && obs.getConcept().isComplex() <START> && null != obs.getComplexData()) { <END> ComplexObsHandler handler = getHandler(obs); if (null != handler) { handler.saveObs(obs); } else { throw new APIException("unknown.handler", new Object[] { obs.getConcept() }); } } }</code><technical_language>put check for getData() null? Of in addition added. :)</technical_language>

Target:
private void handleExistingObsWithComplexConcept(Obs obs) { ComplexData complexData = obs.getComplexData(); Concept concept = obs.getConcept(); if (null != concept && concept.isComplex() && null != complexData && null != complexData.getData()) { ComplexObsHandler handler = getHandler(obs); if (null != handler) { handler.saveObs(obs); } else { throw new APIException("unknown.handler", new Object[] {concept}); } } }
Source:
<code>public void updateFormTitle(Form form, ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element == null) { return; } SiriusInputDescriptor inputDescriptor = new SiriusInputDescriptor(element); EObject semanticElement = inputDescriptor.getSemanticElement(); if (semanticElement != null) { String text = new SiriusToolServices().eefViewText(semanticElement); if (!Util.isBlank(text)) { String[] result = <START> text.split("\r\n|\r|\n", 2); <END> if (result.length >= 1) { form.setText(result[0]); } } form.setImage(ExtendedImageRegistry.INSTANCE.getImage(new SiriusToolServices().eefViewImage(semanticElement))); } } }</code><technical_language>pre-compiled in a static constant</technical_language>

Target:
public void updateFormTitle(Form form, ISelection selection) { if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element == null) { return; } SiriusInputDescriptor inputDescriptor = new SiriusInputDescriptor(element); EObject semanticElement = inputDescriptor.getSemanticElement(); if (semanticElement != null) { String text = new SiriusToolServices().eefViewText(semanticElement); if (!Util.isBlank(text)) { String[] result = LINE_SEPARATOR_PATTERN.split(text, 2); if (result.length >= 1) { form.setText(result[0]); } } form.setImage(ExtendedImageRegistry.INSTANCE.getImage(new SiriusToolServices().eefViewImage(semanticElement))); } } }
Source:
<code>public static void validateDeploymentProperties(Map<String, String> properties) { if (properties == null) { return; } for (Entry<String, String> property : properties.entrySet()) { String key = property.getKey(); if (!key.startsWith("app.") && !key.startsWith("deployer.") <START> && !key.startsWith("spring.cloud.scheduler.")) { <END> throw new IllegalArgumentException( "Only deployment property keys starting with 'app.', 'deployer.' or, 'spring.cloud.scheduler.' allowed, got '" + key + "'"); } } }</code><technical_language>this schedule a prefix</technical_language>

Target:
public static void validateDeploymentProperties(Map<String, String> properties) { if (properties == null) { return; } for (Entry<String, String> property : properties.entrySet()) { String key = property.getKey(); if (!key.startsWith("app.") && !key.startsWith("deployer.") && !key.startsWith("scheduler.")) { throw new IllegalArgumentException( "Only deployment property keys starting with 'app.', 'deployer.' or, 'scheduler.' allowed, got '" + key + "'"); } } }
Source:
<code>@Test public void testWindowOnSortedInput() { Tester tester = new TesterImpl(getDiffRepos(), true, true, false, false, true, null, null) { @Override public RelOptPlanner createPlanner() { return new MockRelOptPlanner(Contexts.empty()) { @Override public List<RelTraitDef> getRelTraitDefs() { return ImmutableList.of(RelCollationTraitDef.INSTANCE); } @Override public RelTraitSet emptyTraitSet() { return RelTraitSet.createEmpty().plus( RelCollationTraitDef.INSTANCE.getDefault()); } }; } }; final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); final HepProgram program = HepProgram.builder() .addRuleInstance(ProjectToWindowRule.PROJECT) <START> .build(); <END> final String sql = "select mgr, deptno, sum(sal) over (partition by deptno)\n" + "from emp\n" + "order by mgr, deptno"; RelNode r = checkPlanning(tester, preProgram, new HepPlanner(program), sql); RelCollation c = r.getInput(0).getTraitSet().getTrait(RelCollationTraitDef.INSTANCE); assertEquals("Collation is incorrect", "[3, 7]", c.toString()); }</code><technical_language>tests gave, i figure out fixing, input output nodes collation same</technical_language>

Target:
@Test public void testWindowOnSortedInput() { Tester tester = new TesterImpl(getDiffRepos(), true, true, false, false, true, null, null) { @Override public RelOptPlanner createPlanner() { return new MockRelOptPlanner(Contexts.empty()) { @Override public List<RelTraitDef> getRelTraitDefs() { return ImmutableList.of(RelCollationTraitDef.INSTANCE); } @Override public RelTraitSet emptyTraitSet() { return RelTraitSet.createEmpty().plus( RelCollationTraitDef.INSTANCE.getDefault()); } }; } }; final HepProgram preProgram = new HepProgramBuilder() .addRuleInstance(SortProjectTransposeRule.INSTANCE) .build(); final HepProgram program = HepProgram.builder() .addRuleInstance(ProjectToWindowRule.PROJECT) .build(); final String sql = "select mgr, deptno, sum(sal) over (partition by deptno)\n" + "from emp\n" + "order by mgr, deptno"; RelNode r = checkPlanning(tester, preProgram, new HepPlanner(program), sql); RelCollation ci = r.getInput(0).getTraitSet().getTrait(RelCollationTraitDef.INSTANCE); assertEquals("Window collation is incorrect", "[3, 7]", ci.toString()); RelCollation co = r.getTraitSet().getTrait(RelCollationTraitDef.INSTANCE); assertEquals("Project collation is incorrect", "[0, 1]", co.toString()); }
Source:
<code>public RangeOptions scanMetadataTable() { this.table = MetadataTable.NAME; <START> return this; <END> }</code><technical_language>I wonder, in cases implementation for setting a single parameter is trivial, is do is here, is do: java @Override public RangeOptions scanMetadataTable() { return scanTable(MetadataTable.NAME); }</technical_language>

Target:
public RangeOptions scanMetadataTable() { return scanTable(MetadataTable.NAME); }
Source:
<code>public int run() throws IOException { Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(), "Sample CSV path is required"); Preconditions.checkArgument(samplePaths.size() == 1, "Only one CSV sample can be given"); if (header != null) { noHeader = true; } CSVProperties props = new CSVProperties.Builder() .delimiter(delimiter) .escape(escape) .quote(quote) .header(header) .hasHeader(!noHeader) .linesToSkip(linesToSkip) .charset(charsetName) .build(); Set<String> required = ImmutableSet.of(); if (requiredFields != null) { required = ImmutableSet.copyOf(requiredFields); } <START> HashMap<String,String> types = new HashMap<String,String>(); <END> if (fieldTypes != null) { for (String fieldType : fieldTypes) { String[] ft = fieldType.split("=", 2); types.put(ft[0], ft[1]); } } String sampleSchema = CSVUtil .inferNullableSchema( recordName, open(samplePaths.get(0)), props, required, types) .toString(!minimize); output(sampleSchema, console, outputPath); return 0; }</code><technical_language>avoid parsing [dynamic parameters](<LINK_0></technical_language>

Target:
public int run() throws IOException { Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(), "Sample CSV path is required"); Preconditions.checkArgument(samplePaths.size() == 1, "Only one CSV sample can be given"); if (header != null) { noHeader = true; } CSVProperties props = new CSVProperties.Builder() .delimiter(delimiter) .escape(escape) .quote(quote) .header(header) .hasHeader(!noHeader) .linesToSkip(linesToSkip) .charset(charsetName) .build(); Set<String> required = ImmutableSet.of(); if (requiredFields != null) { required = ImmutableSet.copyOf(requiredFields); } String sampleSchema = CSVUtil .inferNullableSchema( recordName, open(samplePaths.get(0)), props, required, fieldTypes) .toString(!minimize); output(sampleSchema, console, outputPath); return 0; }
Source:
<code>public ScheduledExecutorService getTimerExecutor() { if (timerExecutor == null) { <START> timerExecutor = Executors.newScheduledThreadPool(1, new DaemonThreadFactory(new ThreadGroup("weld-workers"), "weld-timer-")); <END> } return timerExecutor; }</code><technical_language>I extract "weld-workers" a constant DaemonThreadFactory</technical_language>

Target:
public ScheduledExecutorService getTimerExecutor() { return timerExecutor; }
Source:
<code>public LogRecord<M> read(Duration timeout) throws InterruptedException { LogRecord<M> ret = read(); if (ret != null) { return ret; } final long timeoutMs = timeout.toMillis(); final long deadline = System.currentTimeMillis() + timeoutMs; <START> final long delay = Math.min(POLL_INTERVAL_MS, timeoutMs); <END> while (ret == null && System.currentTimeMillis() < deadline) { Thread.sleep(delay); ret = read(); } return ret; }</code><technical_language>need for final</technical_language>

Target:
public LogRecord<M> read(Duration timeout) throws InterruptedException { LogRecord<M> ret = read(); if (ret != null) { return ret; } long timeoutMs = timeout.toMillis(); long deadline = System.currentTimeMillis() + timeoutMs; long delay = Math.min(POLL_INTERVAL_MS, timeoutMs); while (ret == null && System.currentTimeMillis() < deadline) { Thread.sleep(delay); ret = read(); } return ret; }
Source:
<code>private void scheduleManagerUpdate(IContributionManager mgr) { <START> boolean workaroundEnabled = Boolean.getBoolean("eclipse.workaround.bug467000"); END> if (!workaroundEnabled) { mgr.update(false); return; } synchronized (mgrToUpdate) { if (this.mgrToUpdate.isEmpty()) { Display display = context.get(Display.class); if (display != null && !display.isDisposed()) { display.timerExec(100, new Runnable() { @Override public void run() { Collection<IContributionManager> toUpdate = new LinkedHashSet<>(); synchronized (mgrToUpdate) { toUpdate.addAll(mgrToUpdate); mgrToUpdate.clear(); } for (IContributionManager mgr : toUpdate) { mgr.update(false); } } }); } this.mgrToUpdate.add(mgr); } } }</code><technical_language>This put a constant</technical_language>

Target:
private void scheduleManagerUpdate(IContributionManager mgr) { boolean workaroundEnabled = Boolean.getBoolean(ECLIPSE_WORKAROUND_BUG467000); if (!workaroundEnabled) { mgr.update(false); return; } synchronized (mgrToUpdate) { if (this.mgrToUpdate.isEmpty()) { Display display = context.get(Display.class); if (display != null && !display.isDisposed()) { display.timerExec(100, new Runnable() { @Override public void run() { Collection<IContributionManager> toUpdate = new LinkedHashSet<>(); synchronized (mgrToUpdate) { toUpdate.addAll(mgrToUpdate); mgrToUpdate.clear(); } for (IContributionManager mgr : toUpdate) { mgr.update(false); } } }); } this.mgrToUpdate.add(mgr); } } }
Source:
<code>public HistorySearchBar(String id, CommitGraphTable graph, IAction openCloseAction, <START> IActionBars bars) { <END> super(id, graph, openCloseAction); this.bars = bars; }</code><technical_language>Strange formatting; line</technical_language>

Target:
public HistorySearchBar(String id, CommitGraphTable graph, IAction openCloseAction, IActionBars bars) { super(id, graph); this.bars = bars; this.openCloseToggle = openCloseAction; super.setVisible(false); }
Source:
<code><START> static String getProtectedPrefix(final String protectedId) <END> { return PROTECTED_PREFIX + protectedId + PROTECTED_SEPARATOR; }</code><technical_language>public</technical_language>

Target:
public static String getProtectedPrefix(final String protectedId) { return PROTECTED_PREFIX + protectedId + PROTECTED_SEPARATOR; }
Source:
<code><START> public static TimestampString literalValue(RexNode node, TimeZone timeZone) { <END> switch (node.getKind()) { case LITERAL: switch (((RexLiteral) node).getTypeName()) { case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return ((RexLiteral) node).getValueAs(TimestampString.class); case TIMESTAMP: final TimestampString t = ((RexLiteral) node).getValueAs(TimestampString.class); return new TimestampWithTimeZoneString(t.toString() + " " + timeZone.getID()) .withTimeZone(DateTimeUtils.UTC_ZONE).getLocalTimestampString(); case DATE: final DateString d = ((RexLiteral) node).getValueAs(DateString.class); return new TimestampWithTimeZoneString( TimestampString.fromMillisSinceEpoch( d.getMillisSinceEpoch()).toString() + " " + timeZone.getID()) .withTimeZone(DateTimeUtils.UTC_ZONE).getLocalTimestampString(); } break; case CAST: assert node instanceof RexCall; final RexCall call = (RexCall) node; final RexNode operand = call.getOperands().get(0); final RelDataType callType = call.getType(); final RelDataType operandType = operand.getType(); if (operand.getKind() == SqlKind.LITERAL && callType.getSqlTypeName() == operandType.getSqlTypeName() && (callType.getSqlTypeName() == SqlTypeName.DATE || callType.getSqlTypeName() == SqlTypeName.TIMESTAMP || callType.getSqlTypeName() == SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE) && callType.isNullable() && !operandType.isNullable()) { return literalValue(operand, timeZone); } } return null; }</code><technical_language>this protected</technical_language>

Target:
protected static TimestampString literalValue(RexNode node, TimeZone timeZone) { switch (node.getKind()) { case LITERAL: switch (((RexLiteral) node).getTypeName()) { case TIMESTAMP_WITH_LOCAL_TIME_ZONE: return ((RexLiteral) node).getValueAs(TimestampString.class); case TIMESTAMP: final TimestampString t = ((RexLiteral) node).getValueAs(TimestampString.class); return new TimestampWithTimeZoneString(t.toString() + " " + timeZone.getID()) .withTimeZone(DateTimeUtils.UTC_ZONE).getLocalTimestampString(); case DATE: final DateString d = ((RexLiteral) node).getValueAs(DateString.class); return new TimestampWithTimeZoneString( TimestampString.fromMillisSinceEpoch( d.getMillisSinceEpoch()).toString() + " " + timeZone.getID()) .withTimeZone(DateTimeUtils.UTC_ZONE).getLocalTimestampString(); } break; case CAST: assert node instanceof RexCall; final RexCall call = (RexCall) node; final RexNode operand = call.getOperands().get(0); final RelDataType callType = call.getType(); final RelDataType operandType = operand.getType(); if (operand.getKind() == SqlKind.LITERAL && callType.getSqlTypeName() == operandType.getSqlTypeName() && (callType.getSqlTypeName() == SqlTypeName.DATE || callType.getSqlTypeName() == SqlTypeName.TIMESTAMP || callType.getSqlTypeName() == SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE) && callType.isNullable() && !operandType.isNullable()) { return literalValue(operand, timeZone); } } return null; }
Source:
<code>public static Optional<SchemaTableName> getSourceTableNameFromSystemTable(SchemaTableName tableName) { <START> for (SystemTableHandler handler : ImmutableList.of(partitionsTableHandler, propertiesTableHandler)) { <END> if (handler.matches(tableName)) { SchemaTableName sourceTableName = handler.getSourceTableName(tableName); return Optional.of(sourceTableName); } } return Optional.empty(); }</code><technical_language>I write this a stream java return Stream.of(partitionsTableHandler, propertiesTableHandler) .filter(handler -> handler.matches(tableName)) .map(handler -> handler.getSourceTableName(tableName)) .findAny();</technical_language>

Target:
public static Optional<SchemaTableName> getSourceTableNameFromSystemTable(SchemaTableName tableName) { return Stream.of(PARTITIONS_TABLE_HANDLER, PROPERTIES_TABLE_HANDLER) .filter(handler -> handler.matches(tableName)) .map(handler -> handler.getSourceTableName(tableName)) .findAny(); }
Source:
<code>public static List<List<String>> findComponentCycles(StormTopology topology, String topoId) { List<List<String>> ret = new ArrayList<>(); Map<String, Set<String>> edgesOut = getStormTopologyForwardGraph(topology); Set<String> allComponentIds = new HashSet<>(); edgesOut.forEach((k, v) -> { allComponentIds.add(k) ; allComponentIds.addAll(v); }); if (topology.get_spouts_size() == 0) { LOG.error("Topology does not contain any spouts, cannot traverse graph to determine cycles", topoId); ret.add(new ArrayList(edgesOut.keySet())); return ret; } Set<String> unreachable = new HashSet<>(edgesOut.keySet()); topology.get_spouts().forEach((spoutId, spout) -> { Stack<String> dfsStack = new Stack<>(); dfsStack.push(spoutId); Set<String> seen = new HashSet<>(); seen.add(spoutId); findComponentCyclesRecursion(dfsStack, edgesOut, seen, ret); unreachable.removeAll(seen); }); if (!unreachable.isEmpty()) { LOG.warn("Topology contains unreachable components \"{}\"", topoId, String.join(",", unreachable)); } if (!ret.isEmpty()) { <START> LOG.error("Topology contains cycles {}", topoId, <END> ret.stream() .map(x -> String.join(",", x)) .collect(Collectors.joining(" ; ")) ); } return ret; }</code><technical_language>This repeating log message in validateConfs, removed</technical_language>

Target:
public static List<List<String>> findComponentCycles(StormTopology topology, String topoId) { List<List<String>> ret = new ArrayList<>(); Map<String, Set<String>> edgesOut = getStormTopologyForwardGraph(topology); Set<String> allComponentIds = new HashSet<>(); edgesOut.forEach((k, v) -> { allComponentIds.add(k) ; allComponentIds.addAll(v); }); if (topology.get_spouts_size() == 0) { LOG.error("Topology does not contain any spouts, cannot traverse graph to determine cycles", topoId); return ret; } Set<String> unreachable = new HashSet<>(edgesOut.keySet()); topology.get_spouts().forEach((spoutId, spout) -> { Stack<String> dfsStack = new Stack<>(); dfsStack.push(spoutId); Set<String> seen = new HashSet<>(); seen.add(spoutId); findComponentCyclesRecursion(dfsStack, edgesOut, seen, ret); unreachable.removeAll(seen); }); if (!unreachable.isEmpty()) { LOG.warn("Topology contains unreachable components \"{}\"", topoId, String.join(",", unreachable)); } return ret; }
Source:
<code>protected void executeQueryCommand() { if (MultiLevelAdministrationHandler.isAdminUser(getUser())) { VmDeviceDAO dao = getDbFacade().getVmDeviceDao(); List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getParameters().getId(), VmDeviceGeneralType.DISK); for (VmDevice disk : disks) { if (VmPayload.isPayload(disk.getSpecParams())) { VmPayload payload = new VmPayload(disk); <START> payload.setDeviceType(VmDeviceType.valueOf(disk.getDevice().toUpperCase())); <END> for (Map.Entry<String, String> entry : payload.getFiles().entrySet()) { entry.setValue(new String(Base64.decodeBase64(entry.getValue()))); } getQueryReturnValue().setReturnValue(payload); } } } }</code><technical_language>this line is needed anymore, right? VmPayload ctor do this set</technical_language>

Target:
protected void executeQueryCommand() { if (MultiLevelAdministrationHandler.isAdminUser(getUser())) { VmDeviceDAO dao = getDbFacade().getVmDeviceDao(); List<VmDevice> disks = dao.getVmDeviceByVmIdAndType(getParameters().getId(), VmDeviceGeneralType.DISK); for (VmDevice disk : disks) { if (VmPayload.isPayload(disk.getSpecParams())) { VmPayload payload = new VmPayload(disk); for (Map.Entry<String, String> entry : payload.getFiles().entrySet()) { entry.setValue(new String(Base64.decodeBase64(entry.getValue()))); } getQueryReturnValue().setReturnValue(payload); } } } }
Source:
<code>protected void sendReplies(Object processorResult, Message message) { Object replyChannelHeader = null; if (message != null) { replyChannelHeader = message.getHeaders().getReplyChannel(); } <START> if (StringUtils.hasText(this.outputChannelName)) { <END> synchronized (this) { if (this.outputChannelName != null) { try { this.outputChannel = getBeanFactory().getBean(this.outputChannelName, MessageChannel.class); this.outputChannelName = null; } catch (BeansException e) { throw new DestinationResolutionException("Failed to look up MessageChannel with name '" + this.outputChannelName + "' in the BeanFactory."); } } } } Object replyChannel = this.outputChannel; if (this.outputChannel == null) { replyChannel = replyChannelHeader; } Assert.notNull(replyChannel, "no outputChannel or replyChannel header available"); if (processorResult instanceof Iterable<?> && shouldSendMultipleReplies((Iterable<?>) processorResult)) { for (Object next : (Iterable<?>) processorResult) { this.sendReplyMessage(next, replyChannel); } } else { this.sendReplyMessage(processorResult, replyChannel); } }</code><technical_language>this is in main message flow, optimize if (this.outputChannelName != null). in discardMessage</technical_language>

Target:
protected void sendReplies(Object processorResult, Message message) { Object replyChannelHeader = null; if (message != null) { replyChannelHeader = message.getHeaders().getReplyChannel(); } if (this.outputChannelName != null) { synchronized (this) { if (this.outputChannelName != null) { try { this.outputChannel = getBeanFactory().getBean(this.outputChannelName, MessageChannel.class); this.outputChannelName = null; } catch (BeansException e) { throw new DestinationResolutionException("Failed to look up MessageChannel with name '" + this.outputChannelName + "' in the BeanFactory."); } } } } Object replyChannel = this.outputChannel; if (this.outputChannel == null) { replyChannel = replyChannelHeader; } Assert.notNull(replyChannel, "no outputChannel or replyChannel header available"); if (processorResult instanceof Iterable<?> && shouldSendMultipleReplies((Iterable<?>) processorResult)) { for (Object next : (Iterable<?>) processorResult) { this.sendReplyMessage(next, replyChannel); } } else { this.sendReplyMessage(processorResult, replyChannel); } }
Source:
<code>protected boolean checkCanDisableVirtIoScsi() { VmValidator vmValidator = createVmValidator(vmFromConfiguration); if (Boolean.FALSE.equals(getParameters().isVirtioScsiEnabled()) && !validate(vmValidator.canDisableVirtioScsi(getAdjustedDiskImagesFromConfiguration()))) { return false; } <START> else return true; <END> }</code><technical_language>please project formatter, this {}</technical_language>

Target:
protected boolean checkCanDisableVirtIoScsi() { VmValidator vmValidator = createVmValidator(vmFromConfiguration); if (Boolean.FALSE.equals(getParameters().isVirtioScsiEnabled()) && !validate(vmValidator.canDisableVirtioScsi(getAdjustedDiskImagesFromConfiguration()))) { return false; } else { return true; } }
Source:
<code>public boolean hasPermission( Authentication authentication, Object targetDomainObject, Object permission) { if (authorizationServiceFacade == null) { authorizationServiceFacade = AuthorizationServiceFacade.instance(); } final IAuthorizationPrincipal principal = getAuthorizationPrincipal(authentication); String targetId = null; if (targetDomainObject instanceof String) { targetId = (String) targetDomainObject; } else if (targetDomainObject instanceof JsonEntityBean) { targetId = ((JsonEntityBean) targetDomainObject).getTargetString(); } AuthorizableActivity activity = null; if (permission instanceof AuthorizableActivity) { activity = (AuthorizableActivity) permission; } else if (permission instanceof String) { String activityName = (String) permission; activity = getViewActivity(activityName, (JsonEntityBean) targetDomainObject); } else { throw new RuntimeException( "Unable to determine permission target id for type " + targetDomainObject.getClass()); } if (this.logger.isTraceEnabled()) { logger.trace( String.format( "In hasPermission() - owner=[%s], activity=[%s], targetId=[%s] ", activity.getOwnerFname(), activity.getActivityFname(), targetId)); <START> } <END> if (activity != null) { final boolean hasPermission = principal.hasPermission( activity.getOwnerFname(), activity.getActivityFname(), targetId); return hasPermission; } else { return false; } }</code><technical_language>Simply... logger.trace("In hasPermission() - owner=[{}], activity=[{}], targetId=[{}]", activity.getOwnerFname(), activity.getActivityFname(), targetId);</technical_language>

Target:
public boolean hasPermission( Authentication authentication, Object targetDomainObject, Object permission) { if (authorizationServiceFacade == null) { authorizationServiceFacade = AuthorizationServiceFacade.instance(); } final IAuthorizationPrincipal principal = getAuthorizationPrincipal(authentication); String targetId = null; if (targetDomainObject instanceof String) { targetId = (String) targetDomainObject; } else if (targetDomainObject instanceof JsonEntityBean) { targetId = ((JsonEntityBean) targetDomainObject).getTargetString(); } AuthorizableActivity activity = null; if (permission instanceof AuthorizableActivity) { activity = (AuthorizableActivity) permission; } else if (permission instanceof String) { String activityName = (String) permission; activity = getViewActivity(activityName, (JsonEntityBean) targetDomainObject); } else { throw new RuntimeException( "Unable to determine permission target id for type " + targetDomainObject.getClass()); } logger.trace( "In hasPermission() - owner=[{}], activity=[{}], targetId=[{}] ", activity.getOwnerFname(), activity.getActivityFname(), targetId); if (activity != null) { final boolean hasPermission = principal.hasPermission( activity.getOwnerFname(), activity.getActivityFname(), targetId); return hasPermission; } else { return false; } }