auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean[] getTestedOrder() { <START> return new boolean[] {true, false}; <END> }</code><technical_language>told booleans hard maintain immediately true /false means. Order.ASCENDING Order.DESCENDING instead</technical_language>

Target:
protected Order[] getTestedOrder() { return new Order[] {Order.ASCENDING, Order.DESCENDING}; }
Source:
<code>private String getEntityTypeStringFromMetadata(List<MetadataValue> list) { String entityType = null; for (MetadataValue mdv : list) { if (StringUtils.equals(mdv.getMetadataField().getMetadataSchema().getName(), "relationship") && StringUtils.equals(mdv.getMetadataField().getElement(), "type")) { entityType = mdv.getValue(); <START> } <END> } return entityType; }</code><technical_language>Trivial: missing 'break;'</technical_language>

Target:
private String getEntityTypeStringFromMetadata(List<MetadataValue> list) { for (MetadataValue mdv : list) { if (StringUtils.equals(mdv.getMetadataField().getMetadataSchema().getName(), "relationship") && StringUtils.equals(mdv.getMetadataField().getElement(), "type")) { return mdv.getValue(); } } return null; }
Source:
<code>private ArrayList<MediaOption> initOtherMediaImageOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); <START> FragmentActivity activity = getActivity(); <END> Bundle arguments = getArguments(); boolean supportStockPhotos = arguments != null && arguments.getBoolean(ARG_SUPPORT_STOCK_PHOTOS); if (supportStockPhotos && activity != null) { String packageName = activity.getApplication().getPackageName(); int stockMediaResourceId = getResources().getIdentifier("photo_picker_stock_media", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_STOCK_MEDIA, getString(stockMediaResourceId))); } return otherMediaOptions; }</code><technical_language>AFAIU surrounded code, editor opened, "stock photos" option missing. I want log this a log (maybe sentry). Wdyt</technical_language>

Target:
private ArrayList<MediaOption> initOtherMediaImageOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); FragmentActivity activity = getActivity(); Bundle arguments = getArguments(); boolean supportStockPhotos = arguments != null && arguments.getBoolean(ARG_SUPPORT_STOCK_PHOTOS); if (activity != null) { if (supportStockPhotos) { String packageName = activity.getApplication().getPackageName(); int stockMediaResourceId = getResources().getIdentifier("photo_picker_stock_media", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_STOCK_MEDIA, getString(stockMediaResourceId))); } } else { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity is null"); } return otherMediaOptions; }
Source:
<code>public Response<BlobProperties> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, Context context) { Context updatedContext = context == null ? Context.NONE.addData(CoreConstants.DISABLE_BUFFER_COPY, true) <START> : context.addData("disable-buffer-copy", true); <END> Mono<Response<BlobProperties>> download = client.downloadToFileWithResponse(filePath, range, parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, openOptions, updatedContext); return blockWithOptionalTimeout(download, timeout); }</code><technical_language>nit; Context.NONE.addData(CoreConstants.DISABLE_BUFFER_COPY, true)</technical_language>

Target:
public Response<BlobProperties> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, Context context) { Mono<Response<BlobProperties>> download = client.downloadToFileWithResponse(filePath, range, parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, openOptions, context); return blockWithOptionalTimeout(download, timeout); }
Source:
<code>void updateTimeWithValue(ByteBuffer buf, int position, long time) { buf.putLong(position, time); <START> putValue(buf, position); <END> buf.put(position + NULL_OFFSET, RHS_NOT_NULL); }</code><technical_language>nit: follow ordering in buffer, move putValue call null marker setting</technical_language>

Target:
void updateTimeWithValue(ByteBuffer buf, int position, long time) { buf.putLong(position, time); buf.put(position + NULL_OFFSET, NullHandling.IS_NOT_NULL_BYTE); putValue(buf, position + VALUE_OFFSET); }
Source:
<code>public static void removeMatchingBuckets(List<Integer> mismatchingBuckets, BlockReport report){ for(int i = 0; i < report.getBuckets().length; i++){ <START> if(!mismatchingBuckets.contains(i)){ <END> report.getBuckets()[i].setBlocks(BlockListAsLongs.EMPTY); report.getBuckets()[i].setSkip(true); } } }</code><technical_language>contains a list is efficient, type of mismatchingBuckets a set</technical_language>

Target:
public static void removeMatchingBuckets(List<Integer> mismatchingBuckets, BlockReport report){ HashSet mismatchingBucketsSet = new HashSet(mismatchingBuckets); for(int i = 0; i < report.getBuckets().length; i++){ if(!mismatchingBucketsSet.contains(i)){ report.getBuckets()[i].setBlocks(BlockListAsLongs.EMPTY); report.getBuckets()[i].setSkip(true); } } }
Source:
<code><START> @Override protected void beforeTestsStarted() throws Exception { <END> assert testsCfgInjected != null; testsCfg = testsCfgInjected; if (Ignition.allGrids().size() != testsCfg.gridCount()) { info("All nodes will be stopped, new " + testsCfg.gridCount() + " nodes will be started."); Ignition.stopAll(true); FileUtils.deleteDirectory(workDir); info("Ignite's 'work' directory has been cleaned."); startGrids(testsCfg.gridCount()); for (int i = 0; i < testsCfg.gridCount(); i++) info("Grid " + i + ": " + grid(i).localNode().id()); } assert testsCfg.testedNodeIndex() >= 0 : "testedNodeIdx: " + testedNodeIdx; testedNodeIdx = testsCfg.testedNodeIndex(); if (testsCfg.withClients()) { for (int i = 0; i < gridCount(); i++) assertEquals("i: " + i, expectedClient(getTestIgniteInstanceName(i)), (boolean)grid(i).configuration().isClientMode()); } }</code><technical_language>testsCfg is assigned tests in a class. change assigned test method execution. please explain works expected</technical_language>

Target:
@Override protected void beforeTestsStarted() throws Exception { assert testsCfg != null; if (Ignition.allGrids().size() != testsCfg.gridCount()) { info("All nodes will be stopped, new " + testsCfg.gridCount() + " nodes will be started."); Ignition.stopAll(true); FileUtils.deleteDirectory(workDir); info("Ignite's 'work' directory has been cleaned."); startGrids(testsCfg.gridCount()); for (int i = 0; i < testsCfg.gridCount(); i++) info("Grid " + i + ": " + grid(i).localNode().id()); } assert testsCfg.testedNodeIndex() >= 0 : "testedNodeIdx: " + testedNodeIdx; testedNodeIdx = testsCfg.testedNodeIndex(); if (testsCfg.withClients()) { for (int i = 0; i < gridCount(); i++) assertEquals("i: " + i, expectedClient(getTestIgniteInstanceName(i)), (boolean)grid(i).configuration().isClientMode()); } }
Source:
<code>public void addFlowRunnerManagerMetrics(final FlowRunnerManager flowRunnerManager) { this.metricsManager .addGauge("EXEC-NumRunningFlows", flowRunnerManager::getNumRunningFlows); this.metricsManager .addGauge("EXEC-NumQueuedFlows", flowRunnerManager::getNumQueuedFlows); this.metricsManager <START> .addGauge("EXEC-ProjectDirCacheHitRatio", flowRunnerManager::getProjectDirHitRatio); <END> }</code><technical_language>Is name getProjectDirCacheHitRatio</technical_language>

Target:
public void addFlowRunnerManagerMetrics(final FlowRunnerManager flowRunnerManager) { this.metricsManager .addGauge("EXEC-NumRunningFlows", flowRunnerManager::getNumRunningFlows); this.metricsManager .addGauge("EXEC-NumQueuedFlows", flowRunnerManager::getNumQueuedFlows); this.metricsManager .addGauge("EXEC-ProjectDirCacheHitRatio", flowRunnerManager::getProjectDirCacheHitRatio); }
Source:
<code>private void checkIconNodeInvalidate(final SWTBotVSMEditor odesignEditor, SWTBotTree tree) { SWTBotUtils.waitAllUiEvents(); final SWTBotTreeItem node1treeItem = <START> tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default").getNode("node1").select(); <END> bot.waitUntil(new TreeItemWithImageCondition(node1treeItem, getNodeMappingWithInfoImage(), "An info must appear on overlay of the node mapping image.")); final SWTBotTreeItem node2TreeItem = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default").getNode("node2").select(); bot.waitUntil(new TreeItemWithImageCondition(node2TreeItem, getNodeMappingWithWarningImage(), "A warning must appear on overlay of the node mapping image.")); final SWTBotTreeItem node3TreeItem = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default").getNode("node3").select(); bot.waitUntil(new TreeItemWithImageCondition(node3TreeItem, getNodeMappingWithErrorImage(), "A red cross must appear on overlay of the node mapping image.")); }</code><technical_language>SWTbot's reliability tree items, this common part done once</technical_language>

Target:
private void checkIconNodeInvalidate(final SWTBotVSMEditor odesignEditor, SWTBotTree tree) { SWTBotUtils.waitAllUiEvents(); SWTBotTreeItem defaultNode = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default"); final SWTBotTreeItem node1treeItem = defaultNode.getNode("node1").select(); bot.waitUntil(new TreeItemWithImageCondition(node1treeItem, getNodeMappingWithInfoImage(), "An info must appear on overlay of the node mapping image.")); final SWTBotTreeItem node2TreeItem = defaultNode.getNode("node2").select(); bot.waitUntil(new TreeItemWithImageCondition(node2TreeItem, getNodeMappingWithWarningImage(), "A warning must appear on overlay of the node mapping image.")); final SWTBotTreeItem node3TreeItem = defaultNode.getNode("node3").select(); bot.waitUntil(new TreeItemWithImageCondition(node3TreeItem, getNodeMappingWithErrorImage(), "A red cross must appear on overlay of the node mapping image.")); }
Source:
<code>public String type() { <START> return "AzureBlobContainer"; <END> }</code><technical_language>this a constant</technical_language>

Target:
public String type() { return AZURE_FILE_STORE_TYPE; }
Source:
<code>public void startNativeTransport() { validateTransportsCanStart(); if (nativeServer == null) <START> throw new IllegalStateException("setup() must be called first for CassandraDaemon"); <END> else nativeServer.start(); }</code><technical_language>"native transport set started"</technical_language>

Target:
public void startNativeTransport() { validateTransportsCanStart(); if (nativeServer == null) throw new IllegalStateException("native transport should be set up before it can be started"); nativeServer.start(); }
Source:
<code>public URI getServerKey() { URI uri = this.physicalUri.getURI(); try { <START> return new URI( <END> uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null); } catch (URISyntaxException error) { throw new IllegalArgumentException( lenientFormat("physicalAddress %s cannot be parsed as a server-based authority", uri), error); } }</code><technical_language>is getServerKey() invoked for request? Is pre-compute cache URI? I new URI toString string parsing is CPU intensive</technical_language>

Target:
public URI getServerKey() { return RntbdUtils.getServerKey(this.physicalUri.getURI()); }
Source:
<code>private void updateResult(JobInstance job) { <START> latestCompletedCache.flush(); <END> getSqlMapClientTemplate().update("updateResult", job); }</code><technical_language>this done in transaction afterCommit block? Else, is a chance while job-result is updated, a get call (latestCompletedJobs), causing cache updated a supposedly stale object invalidated</technical_language>

Target:
private void updateResult(JobInstance job) { latestCompletedCache.flushOnCommit(); getSqlMapClientTemplate().update("updateResult", job); }
Source:
<code><START> public void open() throws EDBException { <END> if (dbname == null) { throw new EDBException( "There is no database name defined. Unable to connect to unknown database"); } if (type == null) { throw new EDBException("The database type have to be set for a jpa connection"); } Properties props = null; try { props = type.getPropertiesForDatabaseType(); String connectionUrl = type.getConnectionPrefix() + dbname; props.setProperty("openjpa.ConnectionURL", connectionUrl); } catch (NotImplementedException ex) { throw new EDBException("this type of jpa connection isn't implemented", ex); } emf = Persistence.createEntityManagerFactory("openjpa", props); em = emf.createEntityManager(); utx = em.getTransaction(); Query q = em.createQuery("SELECT max(h.timestamp) FROM JPAHead h"); Number max = (Number) q.getSingleResult(); if (max != null && max.longValue() > 0) { head = loadHead(max.longValue()); } }</code><technical_language>typically this done bluepritn</technical_language>

Target:
public void open() throws EDBException { LOGGER.debug("starting to open EDB for testing via JPA"); Properties props = new Properties(); emf = Persistence.createEntityManagerFactory("edb-test", props); entityManager = emf.createEntityManager(); utx = entityManager.getTransaction(); dao = new DefaultJPADao(entityManager); LOGGER.debug("starting of EDB successful"); Number max = dao.getNewestJPAHeadNumber(); if (max != null && max.longValue() > 0) { LOGGER.debug("loading JPA Head with timestamp " + max.longValue()); head = loadHead(max.longValue()); } }
Source:
<code>public void whenConnectionIsClosedByClientNakadiRecognizesIt() throws Exception { final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); client.start(); waitFor(() -> assertThat(client.getBatches(), hasSize(1))); client.close(); <START> Thread.sleep(10000); <END> final TestStreamingClient anotherClient = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); anotherClient.start(); waitFor(() -> assertThat(anotherClient.getBatches(), hasSize(1))); }</code><technical_language>increased significantly? I understand in this PR added new property batch, I expected increase timeouts etc</technical_language>

Target:
public void whenConnectionIsClosedByClientNakadiRecognizesIt() throws Exception { final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); client.start(); waitFor(() -> assertThat(client.getBatches(), hasSize(1))); client.close(); Thread.sleep(2000); final TestStreamingClient anotherClient = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); anotherClient.start(); waitFor(() -> assertThat(anotherClient.getBatches(), hasSize(1))); }
Source:
<code>protected void ensureValuesCapacity(int numAdded) { int newSize = numValues + numAdded * 2; if (presentStream != null && valueIsNull == null) { valueIsNull = new boolean[newSize]; } if (valueIsNull != null && valueIsNull.length < numValues + numAdded) { <START> valueIsNull = Arrays.copyOf(valueIsNull, newSize); <END> } if (elementOffset == null) { elementOffset = new int[newSize]; } else if (elementOffset.length < numValues + numAdded + 1) { elementOffset = Arrays.copyOf(elementOffset, newSize); } }</code><technical_language>new utility methods</technical_language>

Target:
protected void ensureValuesCapacity(int numAdded) { if (valueIsNull == null || valueIsNull.length < numValues + numAdded) { valueIsNull = resize(valueIsNull, numValues + numAdded); } if (elementOffset == null || elementOffset.length < numValues + numAdded + 1) { elementOffset = resize(elementOffset, numValues + numAdded + 1); } }
Source:
<code>public AttachmentInfo generateAttachmentInfo( InputStream inputStream, String contentType, String submittedFilename) { <START> String filename; <END> try { if (inputStream != null && inputStream.available() == 0) { inputStream.reset(); } } catch (IOException e) { LOGGER.info("IOException reading stream from file attachment in multipart body", e); } filename = submittedFilename; if (StringUtils.isEmpty(filename)) { LOGGER.debug("No filename parameter provided - generating default filename"); String fileExtension = DEFAULT_FILE_EXTENSION; try { fileExtension = mimeTypeMapper.getFileExtensionForMimeType(contentType); if (StringUtils.isEmpty(fileExtension)) { fileExtension = DEFAULT_FILE_EXTENSION; } } catch (MimeTypeResolutionException e) { LOGGER.debug("Exception getting file extension for contentType = {}", contentType); } filename = DEFAULT_FILE_NAME + "." + fileExtension; LOGGER.debug("No filename parameter provided - default to {}", filename); } else { filename = FilenameUtils.getName(filename); if (StringUtils.isEmpty(contentType) || REFINEABLE_MIME_TYPES.contains(contentType)) { contentType = contentTypeFromFilename(filename); } } return new AttachmentInfoImpl(inputStream, filename, contentType); }</code><technical_language>Declare & initialize in line try/catch block</technical_language>

Target:
public AttachmentInfo generateAttachmentInfo( InputStream inputStream, String contentType, String submittedFilename) { try { if (inputStream != null && inputStream.available() == 0) { inputStream.reset(); } } catch (IOException e) { LOGGER.debug("IOException reading stream from file attachment in multipart body", e); } String filename = submittedFilename; if (StringUtils.isEmpty(filename)) { LOGGER.debug( "No filename parameter provided - generating default filename: fileExtension={}", DEFAULT_FILE_EXTENSION); String fileExtension = DEFAULT_FILE_EXTENSION; try { fileExtension = mimeTypeMapper.getFileExtensionForMimeType(contentType); if (StringUtils.isEmpty(fileExtension)) { fileExtension = DEFAULT_FILE_EXTENSION; } } catch (MimeTypeResolutionException e) { LOGGER.debug("Exception getting file extension for contentType = {}", contentType); } filename = DEFAULT_FILE_NAME + "." + fileExtension; LOGGER.debug("No filename parameter provided - default to {}", filename); } else { filename = FilenameUtils.getName(filename); if (StringUtils.isEmpty(contentType) || REFINEABLE_MIME_TYPES.contains(contentType)) { contentType = contentTypeFromFilename(filename); } } return new AttachmentInfoImpl(inputStream, filename, contentType); }
Source:
<code>static void validateOwnLabelAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { <START> throw new MolgenisValidationException(new ConstraintViolation( <END> format("Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] of entity type [%s] is not a non-nillable attribute", ownLabelAttr.getName(), entityType.getId()))); } } }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove this of "MolgenisValidationException"; is deprecated. [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
static void validateOwnLabelAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } }
Source:
<code><START> private static int timeSearch( <END> final NumericColumn timeColumn, final long timestamp, final int startIndex, final int endIndex ) { final long prevTimestamp = timestamp - 1; int minIndex = startIndex; int maxIndex = endIndex - 1; while (minIndex <= maxIndex) { if (maxIndex - minIndex < TOO_CLOSE_FOR_MISSILES) { break; } final int currIndex = (minIndex + maxIndex) >>> 1; final long currValue = timeColumn.getLongSingleValueRow(currIndex); if (currValue < prevTimestamp) { minIndex = currIndex + 1; } else if (currValue > prevTimestamp) { maxIndex = currIndex - 1; } else { minIndex = currIndex; break; } } for (; minIndex < endIndex; minIndex++) { final long currValue = timeColumn.getLongSingleValueRow(minIndex); if (currValue == timestamp) { return minIndex; } else if (currValue > timestamp) { return -(minIndex + 1); } } return -(endIndex + 1); }</code><technical_language>a unit test for method</technical_language>

Target:
static int timeSearch( final NumericColumn timeColumn, final long timestamp, final int startIndex, final int endIndex ) { final long prevTimestamp = timestamp - 1; int minIndex = startIndex; int maxIndex = endIndex - 1; while (minIndex <= maxIndex) { final int currIndex = (minIndex + maxIndex) >>> 1; final long currValue = timeColumn.getLongSingleValueRow(currIndex); if (currValue < prevTimestamp) { minIndex = currIndex + 1; } else if (currValue > prevTimestamp) { maxIndex = currIndex - 1; } else { minIndex = currIndex; break; } } for (; minIndex < endIndex; minIndex++) { final long currValue = timeColumn.getLongSingleValueRow(minIndex); if (currValue >= timestamp) { return minIndex; } } return endIndex; }
Source:
<code>@Test public void missingNamedArgument() { try { <START> Map<String, Object> map = new HashMap<>(); <END> CodeBlock block = CodeBlock.builder().addNamed("$text:S", map).build(); fail(); } catch(IllegalArgumentException expected) { assertThat(expected).hasMessage("Missing named argument for $text"); } }</code><technical_language>supernit: HashMap is [dead](<LINK_0> me, dead too. LinkedHashMap is live</technical_language>

Target:
@Test public void missingNamedArgument() { try { Map<String, Object> map = new LinkedHashMap<>(); CodeBlock.builder().addNamed("$text:S", map).build(); fail(); } catch(IllegalArgumentException expected) { assertThat(expected).hasMessage("Missing named argument for $text"); } }
Source:
<code><START> private String getMouseButtonName() { <END> return button.getName(); }</code><technical_language>This other similar change in this class API violations access is lessened. apparent usages, apparent need for change :-)</technical_language>

Target:
public String getMouseButtonName() { return button.getName(); }
Source:
<code>public void testIterator() { CallsiteAnalysis module = <START> TmfTraceUtils.getAnalysisModuleOfClass(fTrace, CallsiteAnalysis.class, <END> CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = fTrace.getUUID(); assertNotNull(uuid); ITmfCallsiteIterator iter = module.iterator(uuid.toString(), "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for(int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), "elephant", 42); evaluateEmptyIterator(iter); }</code><technical_language>I a null warning. Mabye add a assertNotNull() before</technical_language>

Target:
public void testIterator() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = trace.getUUID(); assertNotNull(uuid); ITmfCallsiteIterator iter = module.iterator(uuid.toString(), "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for(int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), "elephant", 42); evaluateEmptyIterator(iter); }
Source:
<code>public void reset() { if (isBreakRequest()) { toggleBreakRequest(); } if (isBreakResponse()) { toggleBreakResponse(); } if (isBreakAll()) { toggleBreakAll(); } <START> setBreakOnJavaScript(isBreakOnJavaScript); setBreakOnCSSAndFonts(isBreakOnCSSAndFonts); setBreakOnMultimedia(isBreakOnMultimedia); setOnlyBreakOnScope(isOnlyBreakOnScope); <END> setContinue(true); }</code><technical_language>needed, state of buttons need reset</technical_language>

Target:
public void reset() { if (isBreakRequest()) { toggleBreakRequest(); } if (isBreakResponse()) { toggleBreakResponse(); } if (isBreakAll()) { toggleBreakAll(); } setContinue(true); }
Source:
<code>private ChunkCache newChunkCacheToPosRedirect(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn, BlockPos target) { int x1 = (int) entity.posX; int y1 = (int) entity.posY; int z1 = (int) entity.posZ; int x2 = target.getX(); int y2 = target.getY(); int z2 = target.getZ(); return new ChunkCache(worldIn, new BlockPos(Math.min(x1, x2), Math.min(y1, y2), Math.min(z1, z2)), <START> new BlockPos(Math.max(x1, x2), Math.max(y1, y2), Math.max(z1, z2)), 1); <END> }</code><technical_language>this MC access parts of ChunkCache there? reasonable expect get blocks of range target current position get some obstacles</technical_language>

Target:
private ChunkCache newChunkCacheToPosRedirect(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn, BlockPos target) { int x1 = (int) entity.posX; int y1 = (int) entity.posY; int z1 = (int) entity.posZ; int x2 = target.getX(); int y2 = target.getY(); int z2 = target.getZ(); return new ChunkCache(worldIn, new BlockPos(Math.min(x1, x2), Math.min(y1, y2), Math.min(z1, z2)), new BlockPos(Math.max(x1, x2), Math.max(y1, y2), Math.max(z1, z2)), 4); }
Source:
<code>public String toString() { int pos = -1; for (int i = 0; i < fContent.length; i++) { if (fContent[i] == 0) { pos = i; break; } } <START> return new String((pos != -1) ? (Arrays.copyOf(fContent, pos)) : fContent); <END> }</code><technical_language>define array ?: check a separate line, clearer. Creating a String + a new array *every* time this method is called heavy. saving String in a lazy-loaded class field</technical_language>

Target:
public String toString() { int pos = -1; for (int i = 0; i < fContent.length; i++) { if (fContent[i] == 0) { pos = i; break; } } byte[] bytes = (pos != -1) ? (Arrays.copyOf(fContent, pos)) : fContent; return new String(bytes); }
Source:
<code>public Subscription anonymize() { <START> if (endpoint != null && getEndpoint().containsCredentials() || hasOAuthPolicy()) { <END> return new Subscription( topicName, name, endpoint.anonymize(), state, description, deliveryType == DeliveryType.BATCH ? batchSubscriptionPolicy : serialSubscriptionPolicy, trackingEnabled, trackingMode, owner, supportTeam, monitoringDetails, contentType, deliveryType, filters, mode, headers, endpointAddressResolverMetadata, oAuthPolicy != null ? oAuthPolicy.anonymize() : null, http2Enabled, subscriptionIdentityHeadersEnabled ); } return this; }</code><technical_language>**Nice have**: Direct access endpoint field is consistent existing code style. I suggest getEndpoint()</technical_language>

Target:
public Subscription anonymize() { if (getEndpoint() != null && getEndpoint().containsCredentials() || hasOAuthPolicy()) { return new Subscription( topicName, name, endpoint.anonymize(), state, description, deliveryType == DeliveryType.BATCH ? batchSubscriptionPolicy : serialSubscriptionPolicy, trackingEnabled, trackingMode, owner, supportTeam, monitoringDetails, contentType, deliveryType, filters, mode, headers, endpointAddressResolverMetadata, oAuthPolicy != null ? oAuthPolicy.anonymize() : null, http2Enabled, subscriptionIdentityHeadersEnabled ); } return this; }
Source:
<code>private static String getClientPath() { Properties properties = new Properties(); try { <START> InputStream inputStream = <END> FileOpenSaveDialog.class.getClassLoader().getResourceAsStream( "project.properties" ); properties.load( inputStream ); } catch ( IOException e ) { e.printStackTrace(); } return properties.getProperty( "CLIENT_PATH" ); }</code><technical_language>this stream need closed</technical_language>

Target:
private static String getClientPath() { Properties properties = new Properties(); try ( InputStream inputStream = FileOpenSaveDialog.class.getClassLoader() .getResourceAsStream( "project.properties" ) ) { properties.load( inputStream ); } catch ( IOException e ) { e.printStackTrace(); } return properties.getProperty( "CLIENT_PATH" ); }
Source:
<code>public void testAsyncReceiveWholeBytesFailed() throws Exception { <START> org.junit.Assume.assumeFalse(System.getProperty("os.name").startsWith("Windows")); <END> EXCEPTIONS.clear(); Socket socket = new Socket(); socket.connect(DefaultServer.getDefaultServerAddress()); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10000; ++i) { sb.append("hello world\r\n"); } String request = "POST /fullbytes HTTP/1.1\r\nHost:localhost\r\nContent-Length:" + sb.length() + 100 + "\r\n\r\n" + sb.toString(); OutputStream outputStream = socket.getOutputStream(); outputStream.write(request.getBytes("US-ASCII")); socket.getInputStream().close(); outputStream.close(); IOException e = EXCEPTIONS.poll(2, TimeUnit.SECONDS); Assert.assertNotNull(e); }</code><technical_language>I this ignores http/1.x variants well, is intentional? want lines: java assumeFalse(DefaultServer.isH2() && SystemUtils.IS_OS_WINDOWS);</technical_language>

Target:
public void testAsyncReceiveWholeBytesFailed() throws Exception { org.junit.Assume.assumeFalse(DefaultServer.isH2() && org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS); EXCEPTIONS.clear(); Socket socket = new Socket(); socket.connect(DefaultServer.getDefaultServerAddress()); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 10000; ++i) { sb.append("hello world\r\n"); } String request = "POST /fullbytes HTTP/1.1\r\nHost:localhost\r\nContent-Length:" + sb.length() + 100 + "\r\n\r\n" + sb.toString(); OutputStream outputStream = socket.getOutputStream(); outputStream.write(request.getBytes("US-ASCII")); socket.getInputStream().close(); outputStream.close(); IOException e = EXCEPTIONS.poll(2, TimeUnit.SECONDS); Assert.assertNotNull(e); }
Source:
<code><START> private static void processParseException(ParseException e, SensorContext context, CompatibleInputFile inputFile, Optional<RuleKey> parsingErrorKey) { <END> reportAnalysisError(e, context, inputFile); if (parsingErrorKey.isPresent()) { NewIssue newIssue = context.newIssue(); NewIssueLocation primaryLocation = newIssue.newLocation() .message("Parse error: " + e.getMessage()) .on(inputFile.wrapped()); newIssue .forRule(parsingErrorKey.get()) .at(primaryLocation) .save(); } else { LOG.warn("Unable to parse file {}", inputFile.absolutePath()); LOG.warn("Cause: {}", e.getMessage()); } }</code><technical_language>![MINOR](<LINK_0> 'Severity: MINOR') a "RuleKey" parameter instead. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static void processParseException(ParseException e, SensorContext context, CompatibleInputFile inputFile, Optional<RuleKey> parsingErrorKey) { reportAnalysisError(e, context, inputFile); LOG.warn("Unable to parse file {}", inputFile.absolutePath()); LOG.warn("Cause: {}", e.getMessage()); if (parsingErrorKey.isPresent()) { NewIssue newIssue = context.newIssue(); NewIssueLocation primaryLocation = newIssue.newLocation() .message("Parse error: " + e.getMessage()) .on(inputFile.wrapped()); newIssue .forRule(parsingErrorKey.get()) .at(primaryLocation) .save(); } }
Source:
<code>public void setup() throws IOException { if (!created) { final String repositoryName = getRepositoryName(); final String path = createTempDirectory().getAbsolutePath(); System.setProperty("org.uberfire.nio.git.dir", path); System.setProperty("org.uberfire.nio.git.daemon.enabled", "false"); System.setProperty("org.uberfire.nio.git.ssh.enabled", "false"); System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true"); System.setProperty(ServerType.SERVER_TYPE_PROPERTY, <START> "false"); <END> System.out.println(".niogit: " + path); final URI newRepo = URI.create("git://" + repositoryName); try { IOService ioService = ioService(); ioService.newFileSystem(newRepo, new HashMap<>()); basePath = getDirectoryPath().resolveSibling("someNewOtherPath"); Path dummyFile = basePath.resolve("dummy"); ioService.createDirectory(dummyFile); } catch (final Exception e) { e.printStackTrace(); logger.warn("Failed to initialize IOService instance: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e); } finally { created = true; } final Instance<NamedQuery> namedQueriesProducer = mock(Instance.class); when(namedQueriesProducer.iterator()).thenReturn(getQueries().iterator()); service = new RefactoringQueryServiceImpl(config, new NamedQueries(namedQueriesProducer)); service.init(); } }</code><technical_language>Is this correct Server Type is enum? <LINK_0></technical_language>

Target:
public void setup() throws IOException { if (!created) { final String repositoryName = getRepositoryName(); final String path = createTempDirectory().getAbsolutePath(); System.setProperty("org.uberfire.nio.git.dir", path); System.setProperty("org.uberfire.nio.git.daemon.enabled", "false"); System.setProperty("org.uberfire.nio.git.ssh.enabled", "false"); System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true"); System.setProperty(FileSystemUtils.SIMPLIFIED_MONITORING_ENABLED, "false"); System.out.println(".niogit: " + path); final URI newRepo = URI.create("git://" + repositoryName); try { IOService ioService = ioService(); ioService.newFileSystem(newRepo, new HashMap<>()); basePath = getDirectoryPath().resolveSibling("someNewOtherPath"); Path dummyFile = basePath.resolve("dummy"); ioService.createDirectory(dummyFile); } catch (final Exception e) { e.printStackTrace(); logger.warn("Failed to initialize IOService instance: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e); } finally { created = true; } final Instance<NamedQuery> namedQueriesProducer = mock(Instance.class); when(namedQueriesProducer.iterator()).thenReturn(getQueries().iterator()); service = new RefactoringQueryServiceImpl(config, new NamedQueries(namedQueriesProducer)); service.init(); } }
Source:
<code><START> public boolean isStoredValueAvailable() { <END> return cacheEvals && cachedValue != null && !cachedValue.isNull(); }</code><technical_language>hard care a stored current, this method is in ImmutableComputableGraph::statusToString, is used</technical_language>

Target:
public boolean isStoredValueAvailable() { return cacheEvals && cachedValue != null && !cachedValue.hasValue(); }
Source:
<code>public void execute() { if (isLocalNodeExecutionTarget()) { invokeLocally(); } else { if (trace) log.tracef("Sending %s to remote execution at node %s", f, getExecutionTarget()); try { rpc.invokeRemotelyInFuture(Collections.singletonList(getExecutionTarget()), getCommand(), <START> rpc.getRpcOptionsBuilder().timeout(getOwningTask().timeout(), TimeUnit.MILLISECONDS).build(), <END> (DistributedTaskPart<Object>) this); } catch (Throwable e) { log.remoteExecutionFailed(getExecutionTarget(), e); } } }</code><technical_language>I this async invocation, is sync instead</technical_language>

Target:
public void execute() { if (isLocalNodeExecutionTarget()) { invokeLocally(); } else { if (trace) log.tracef("Sending %s to remote execution at node %s", f, getExecutionTarget()); try { rpc.invokeRemotelyInFuture(Collections.singletonList(getExecutionTarget()), getCommand(), rpc.getRpcOptionsBuilder(ResponseMode.SYNCHRONOUS) .timeout(getOwningTask().timeout(), TimeUnit.MILLISECONDS).build(), (DistributedTaskPart<Object>) this); } catch (Throwable e) { log.remoteExecutionFailed(getExecutionTarget(), e); } } }
Source:
<code>public synchronized void close() { if ( !closed ) { closed = true; db.unregisterTransactionEventHandler( fulltextTransactionEventUpdater ); nodeIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { <START> e.printStackTrace(); <END> } } ); relationshipIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { e.printStackTrace(); } } ); } }</code><technical_language>i log errors instead of printing</technical_language>

Target:
public void close() { db.unregisterTransactionEventHandler( fulltextTransactionEventUpdater ); nodeIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { log.error( "Unable to close fulltext node index.", e ); } } ); relationshipIndices.values().forEach( luceneFulltextIndex -> { try { luceneFulltextIndex.close(); } catch ( IOException e ) { log.error( "Unable to close fulltext relationship index.", e ); } } ); }
Source:
<code>public void onChangeTextSize(ChangeTextSizeEvent event) { if (curPageFragment != null && curPageFragment.getWebView() != null) { themeChooser.updateButtonState(true); curPageFragment.updateFontSize(); Handler uiThread = new Handler(Looper.getMainLooper()); uiThread.postDelayed(new Runnable() { @Override public void run() { themeChooser.updateButtonState(false); } <START> }, (long)Math.ceil(0.75 * DateUtils.SECOND_IN_MILLIS)); <END> } }</code><technical_language>I drop calculation, Math.ceil() call</technical_language>

Target:
public void onChangeTextSize(ChangeTextSizeEvent event) { if (curPageFragment != null && curPageFragment.getWebView() != null) { themeChooser.updateButtonState(true); curPageFragment.updateFontSize(); Handler uiThread = new Handler(Looper.getMainLooper()); uiThread.postDelayed(new Runnable() { @Override public void run() { themeChooser.updateButtonState(false); } }, (long)(0.75 * DateUtils.SECOND_IN_MILLIS)); } }
Source:
<code>private static void ackingProducerSimulation() { WaitStrategyPark ws = new WaitStrategyPark(100); StormMetricRegistry registry = new StormMetricRegistry(); <START> JCQueue spoutQ = new JCQueue("spoutQ", 1024, 0, 100, ws, "test", "test", getTaskIds(), 1000, registry); <END> JCQueue ackQ = new JCQueue("ackQ", 1024, 0, 100, ws, "test", "test", getTaskIds(), 1000, registry); final AckingProducer ackingProducer = new AckingProducer(spoutQ, ackQ); final Acker acker = new Acker(ackQ, spoutQ); runAllThds(ackingProducer, acker); }</code><technical_language>simplified Collections.singletonList(100)</technical_language>

Target:
private static void ackingProducerSimulation() { WaitStrategyPark ws = new WaitStrategyPark(100); StormMetricRegistry registry = new StormMetricRegistry(); JCQueue spoutQ = new JCQueue("spoutQ", 1024, 0, 100, ws, "test", "test", Collections.singletonList(1000), 1000, registry); JCQueue ackQ = new JCQueue("ackQ", 1024, 0, 100, ws, "test", "test", Collections.singletonList(1000), 1000, registry); final AckingProducer ackingProducer = new AckingProducer(spoutQ, ackQ); final Acker acker = new Acker(ackQ, spoutQ); runAllThds(ackingProducer, acker); }
Source:
<code>public String getComputedValue(String name, String prefix, BaseCollection object, XWikiContext context) { String script = getScript(); try { ScriptContext scontext = Utils.getComponent(ScriptContextManager.class).getCurrentScriptContext(); scontext.setAttribute("name", name, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("prefix", prefix, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("object", new com.xpn.xwiki.api.Object((BaseObject) object, context), ScriptContext.ENGINE_SCOPE); XWikiDocument classDocument = object.getXClass(context).getOwnerDocument(); return renderContentInContext(script, classDocument.getSyntax().toIdString(), classDocument.getAuthorReference(), classDocument.getDocumentReference(), context); } catch (Exception e) { <START> return e.getMessage(); <END> } }</code><technical_language>previous TODO returning exception message is great</technical_language>

Target:
public String getComputedValue(String name, String prefix, BaseCollection object, XWikiContext context) throws Exception { String script = getScript(); ScriptContext scontext = Utils.getComponent(ScriptContextManager.class).getCurrentScriptContext(); scontext.setAttribute("name", name, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("prefix", prefix, ScriptContext.ENGINE_SCOPE); scontext.setAttribute("object", new com.xpn.xwiki.api.Object((BaseObject) object, context), ScriptContext.ENGINE_SCOPE); XWikiDocument classDocument = object.getXClass(context).getOwnerDocument(); return renderContentInContext(script, classDocument.getSyntax().toIdString(), classDocument.getAuthorReference(), classDocument.getDocumentReference(), context); }
Source:
<code><START> public Optional<RuleAnnotationClauseColumn> getUiModelColumn() { <END> return uiModelColumn; }</code><technical_language>this package protected? this class test</technical_language>

Target:
Optional<RuleAnnotationClauseColumn> getUiModelColumn() { return uiModelColumn; }
Source:
<code>public ConfigDaoImpl(Configuration appConfig) throws ClassNotFoundException, SQLException, ConfigurationException, ConnectException, XPathExpressionException { valueColumn = appConfig.getString("configColumnValue"); configTable = appConfig.getString("configTable"); nameColumn = appConfig.getString("configColumnName"); versionColumn = appConfig.getString("configColumnVersion"); defaultColumn = appConfig.getString("configColumnDefault"); selectSql = MessageFormat.format("select {0} from {1} where {2}=? and {3} =?", valueColumn, configTable, nameColumn, versionColumn); updateSql = MessageFormat.format("update {0} set {1}=? where {2}=? and {3}=?", configTable, valueColumn, nameColumn, versionColumn); selectKeysForNameSql = MessageFormat.format("select * from {0} where {1}=? ", configTable, nameColumn); <START> getConfigDiff = "SELECT option_name, option_value, default_value, version\n" <END> + " FROM vdc_options\n" + " WHERE option_value != default_value"; ds = new StandaloneDataSource(); }</code><technical_language>Please rename selectConfigDiffSql</technical_language>

Target:
public ConfigDaoImpl(Configuration appConfig) throws ClassNotFoundException, SQLException, ConfigurationException, ConnectException, XPathExpressionException { valueColumn = appConfig.getString("configColumnValue"); configTable = appConfig.getString("configTable"); nameColumn = appConfig.getString("configColumnName"); versionColumn = appConfig.getString("configColumnVersion"); defaultColumn = appConfig.getString("configColumnDefault"); selectSql = MessageFormat.format("select {0} from {1} where {2}=? and {3} =?", valueColumn, configTable, nameColumn, versionColumn); updateSql = MessageFormat.format("update {0} set {1}=? where {2}=? and {3}=?", configTable, valueColumn, nameColumn, versionColumn); selectKeysForNameSql = MessageFormat.format("select * from {0} where {1}=? ", configTable, nameColumn); selectConfigDiff = MessageFormat.format("SELECT {0}, {1}, {2}, {3} FROM {4} WHERE {5} != {6}", nameColumn, valueColumn, defaultColumn, versionColumn, configTable, valueColumn, defaultColumn); System.out.println(selectConfigDiff); ds = new StandaloneDataSource(); }
Source:
<code><START> public static ThreadPoolExecutor newBlockingSingleThreaded(final String nameFormat, final int capacity) <END> { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }</code><technical_language>ExecutorService</technical_language>

Target:
public static ExecutorService newBlockingSingleThreaded(final String nameFormat, final int capacity) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }
Source:
<code>protected TrustManager[] getTrustManagers( KeyStore trustStore, Collection<? extends CRL> crls ) throws Exception { TrustManager[] trustManagers = super.getTrustManagers(trustStore, crls); TrustManager[] newTrustManagers = new TrustManager[trustManagers.length]; for (int i = 0; i < trustManagers.length; i++) { <START> if (trustManagers[i] instanceof X509ExtendedTrustManager) { <END> newTrustManagers[i] = new CustomCheckX509TrustManager( (X509ExtendedTrustManager) trustManagers[i], certificateChecker, tlsServerConfig.isValidateHostnames() ); } } return newTrustManagers; }</code><technical_language>harmful leave X509ExtendedTrustManager implementations in this list else wrap in CustomCheckX509TrustManager adds newTrustManagers is</technical_language>

Target:
protected TrustManager[] getTrustManagers( KeyStore trustStore, Collection<? extends CRL> crls ) throws Exception { TrustManager[] trustManagers = super.getTrustManagers(trustStore, crls); TrustManager[] newTrustManagers = new TrustManager[trustManagers.length]; for (int i = 0; i < trustManagers.length; i++) { if (trustManagers[i] instanceof X509ExtendedTrustManager) { newTrustManagers[i] = new CustomCheckX509TrustManager( (X509ExtendedTrustManager) trustManagers[i], certificateChecker, tlsServerConfig.isValidateHostnames() ); } else { newTrustManagers[i] = trustManagers[i]; log.info("Encountered non-X509ExtendedTrustManager: " + trustManagers[i].getClass()); } } return newTrustManagers; }