auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public XStream getConfiguredXStream(XStream xs) { Class<AzureBlobStoreInfo> clazz = AzureBlobStoreInfo.class; xs.alias("AzureBlobStore", clazz); <START> xs.registerLocalConverter(clazz, "maxConnections", EnvironmentStringConverter); <END> xs.registerLocalConverter(clazz, "proxyPort", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "useHTTPS", EnvironmentNullableBooleanConverter); xs.registerLocalConverter(clazz, "container", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "accountName", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "accountKey", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "prefix", EnvironmentStringConverter); xs.registerLocalConverter(clazz, "proxyHost", EnvironmentStringConverter); xs.registerLocalConverter( BlobStoreInfo.class, "enabled", EnvironmentNullableBooleanConverter); xs.aliasField("id", clazz, "name"); return xs; }</code><technical_language>need register custom converters longer, default behavior do (please check)</technical_language>

Target:
public XStream getConfiguredXStream(XStream xs) { Class<AzureBlobStoreInfo> clazz = AzureBlobStoreInfo.class; xs.alias("AzureBlobStore", clazz); xs.aliasField("id", clazz, "name"); return xs; }
Source:
<code>protected boolean probeForDirectoryListing(Repository repository, String path) { String filePath = path.replaceAll("/", Matcher.quoteReplacement(File.separator)); String dir = repository.getBasedir() + File.separator + filePath; File file = new File(dir); <START> if ((repository.getLayout().equals(RepositoryLayoutEnum.MAVEN_2.getLayout()) && path.startsWith(".index")) <END> || (!file.isHidden() && !path.startsWith(".") && !path.contains("/."))) { if (file.exists() && file.isDirectory()) { return true; } file = new File(dir + File.separator); return file.exists() && file.isDirectory(); } else { return false; } }</code><technical_language>mind extracting a template method override in org.carlspring.strongbox.controllers.maven.MavenArtifactController ? leave org.carlspring.strongbox.controllers.BaseArtifactController more generic repository layout specific information</technical_language>

Target:
protected boolean probeForDirectoryListing(Repository repository, String path) { String filePath = path.replaceAll("/", Matcher.quoteReplacement(File.separator)); String dir = repository.getBasedir() + File.separator + filePath; File file = new File(dir); if (isPermittedForDirectoryListing(file, path)) { if (file.exists() && file.isDirectory()) { return true; } file = new File(dir + File.separator); return file.exists() && file.isDirectory(); } else { return false; } }
Source:
<code><START> public Map<String, String> toPartitionParameters() <END> { ImmutableMap.Builder<String, String> properties = ImmutableMap.builder(); fileCount.ifPresent(fileCount -> properties.put(NUM_FILES, Long.toString(fileCount))); rowCount.ifPresent(fileCount -> properties.put(NUM_ROWS, Long.toString(fileCount))); rawDataSize.ifPresent(fileCount -> properties.put(RAW_DATA_SIZE, Long.toString(fileCount))); totalSize.ifPresent(fileCount -> properties.put(TOTAL_SIZE, Long.toString(fileCount))); return properties.build(); }</code><technical_language>redundant else</technical_language>

Target:
public Map<String, String> toPartitionParameters() { ImmutableMap.Builder<String, String> properties = ImmutableMap.builder(); fileCount.ifPresent(count -> properties.put(NUM_FILES, Long.toString(count))); rowCount.ifPresent(count -> properties.put(NUM_ROWS, Long.toString(count))); inMemoryDataSizeInBytes.ifPresent(size -> properties.put(RAW_DATA_SIZE, Long.toString(size))); onDiskDataSizeInBytes.ifPresent(size -> properties.put(TOTAL_SIZE, Long.toString(size))); return properties.build(); }
Source:
<code><START> private static List<AuthMethod> getAuthMethods(AgentProxy agent) throws Exception { <END> Identity[] identities = agent.getIdentities(); List<AuthMethod> result = Lists.newArrayList(); for (Identity identity : identities) { result.add(new AuthAgent(agent, identity)); } return result; }</code><technical_language>Narrow list of exception types thrown here</technical_language>

Target:
private static List<AuthMethod> getAuthMethods(AgentProxy agent) throws BufferException { ImmutableList.Builder<AuthMethod> identities = ImmutableList.builder(); for (Identity identity : agent.getIdentities()) { identities.add(new AuthAgent(agent, identity)); } return identities.build(); }
Source:
<code>public void setValue(String content) { <START> this.content = Optional.fromNullable(content); <END> }</code><technical_language>Optional in interfaces. null internal value</technical_language>

Target:
public void setValue(String content) { this.content = content; }
Source:
<code>private AllSensorSampleList adjustTimeSeriesAllSensors (final AllSensorSampleList allSensorSampleList, final String senseId) { if (!this.hasDustSmoothEnabled(senseId)) { return allSensorSampleList; } <START> final AllSensorSampleList adjustedAllSensorSampleList = new AllSensorSampleList(); <END> adjustedAllSensorSampleList.add(Sensor.LIGHT, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.HUMIDITY, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.SOUND, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.TEMPERATURE, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.LIGHT, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.WAVE_COUNT, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.HOLD_COUNT, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.SOUND_NUM_DISTURBANCES, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.SOUND_PEAK_DISTURBANCE, allSensorSampleList.get(Sensor.LIGHT)); adjustedAllSensorSampleList.add(Sensor.PARTICULATES, SmoothSample.convert(allSensorSampleList.get(Sensor.PARTICULATES))); return adjustedAllSensorSampleList; }</code><technical_language>worth adding a override method AllSensorSampleList</technical_language>

Target:
private AllSensorSampleList adjustTimeSeriesAllSensors (final AllSensorSampleList allSensorSampleList, final String senseId) { if (!this.hasDustSmoothEnabled(senseId)) { return allSensorSampleList; } allSensorSampleList.update(Sensor.PARTICULATES, SmoothSample.convert(allSensorSampleList.get(Sensor.PARTICULATES))); return allSensorSampleList; }
Source:
<code>private void preloadEventTypes(final EventTypeRepository eventTypeRepository, final TimelineDbRepository timelineRepository) { final long start = System.currentTimeMillis(); rwLock.writeLock().lock(); try { final Map<String, List<Timeline>> eventTypeTimelines = timelineRepository.listTimelines().stream() .collect(Collectors.groupingBy(Timeline::getEventType)); <START> final List<Timeline> emptyList = Collections.unmodifiableList(new ArrayList<>()); <END> final Map<String, CachedValue> preloaded = eventTypeRepository.list().stream().collect(Collectors.toMap( EventType::getName, et -> new CachedValue( et, EventValidation.forType(et), eventTypeTimelines.getOrDefault(et.getName(), emptyList)) )); final Iterator<Map.Entry<String, CachedValue>> it = preloaded.entrySet().iterator(); while (it.hasNext()) { String eventTypeName = null; try { eventTypeName = it.next().getKey(); created(eventTypeName); } catch (final Exception e) { LOG.error("Failed to create node for {}", eventTypeName, e); it.remove(); } } this.eventTypeCache.putAll(preloaded); LOG.info("Cache preload complete, load event types within ms", preloaded.size(), System.currentTimeMillis() - start); } finally { rwLock.writeLock().unlock(); } }</code><technical_language>ImmutableList.of();</technical_language>

Target:
private void preloadEventTypes(final EventTypeRepository eventTypeRepository, final TimelineDbRepository timelineRepository) { final long start = System.currentTimeMillis(); rwLock.writeLock().lock(); try { final Map<String, List<Timeline>> eventTypeTimelines = timelineRepository.listTimelinesOrdered().stream() .collect(Collectors.groupingBy(Timeline::getEventType)); final List<Timeline> emptyList = ImmutableList.of(); final Map<String, CachedValue> preloaded = eventTypeRepository.list().stream().collect(Collectors.toMap( EventType::getName, et -> new CachedValue( et, EventValidation.forType(et), eventTypeTimelines.getOrDefault(et.getName(), emptyList)) )); final Iterator<Map.Entry<String, CachedValue>> it = preloaded.entrySet().iterator(); while (it.hasNext()) { String eventTypeName = null; try { eventTypeName = it.next().getKey(); created(eventTypeName); } catch (final Exception e) { LOG.error("Failed to create node for {}", eventTypeName, e); it.remove(); } } this.eventTypeCache.putAll(preloaded); LOG.info("Cache preload complete, load event types within ms", preloaded.size(), System.currentTimeMillis() - start); } finally { rwLock.writeLock().unlock(); } }
Source:
<code>public static boolean processIsRunning(String hostname, int vmPid) throws ToolsCoreException { Object host = Tools.getInstance().invokeGetMonitoredHost(hostname); Object vmId = Tools.getInstance().invokeVmIdentifier(String.format(IToolsConstants.VM_IDENTIFIRER, vmPid)); try { Object monitoredVm = Tools.getInstance().invokeGetMonitoredVm(host, vmId); return monitoredVm != null; <START> } catch(ToolsCoreException tce) { <END> return false; } }</code><technical_language>This code fix problem extra logging console side effects unpredictable, in cases able do support, piece of useful information missing. For example invokeGetMonitoredVm(host,vmId) call trigger 6 types of exceptions: java } catch (InvocationTargetException t) { } catch (IllegalAccessException e) { } catch (IllegalArgumentException e) { } catch (NoSuchMethodException e) { } catch (SecurityException e) { } catch (ClassNotFoundException e) { InvocationTargeException related linked issue other scenarios. For example throw ClassNotFoundException for monitor java < 1.5 (not if in list though). instead of showing warning supporting Java 1.5+ say: "OMG! Process is running", false statement</technical_language>

Target:
public static boolean processIsRunning(String hostname, int vmPid) throws ToolsCoreException { return processIsMonitorable(hostname, vmPid); }
Source:
<code>public MockSerializationResult(Proxifier proxifier, XStreamBuilder xstreambuilder, GsonSerializerBuilder gsonBuilder) { <START> super(proxifier); <END> this.response = new MockHttpServletResponse(); this.extractor = new DefaultTypeNameExtractor(); this.xstreambuilder = xstreambuilder; this.gsonBuilder = gsonBuilder; this.environment = new NullEnvironment(); }</code><technical_language>change this(proxifier, ...., new NullEnvironment())</technical_language>

Target:
public MockSerializationResult(Proxifier proxifier, XStreamBuilder xstreambuilder, GsonSerializerBuilder gsonBuilder) { this(proxifier, xstreambuilder, gsonBuilder, new NullEnvironment()); }
Source:
<code>public void onLinkClicked(QBAttachment qbAttachment, int position) { <START> if (!TextUtils.isEmpty(qbAttachment.getUrl())) { <END> AttachmentImageActivity.start(ChatActivity.this, qbAttachment.getUrl()); } else { String url = QBFile.getPrivateUrlForUID(qbAttachment.getId()); AttachmentImageActivity.start(ChatActivity.this, url); } }</code><technical_language>please code "else" block, QBAttachment format is iOS right</technical_language>

Target:
public void onLinkClicked(QBAttachment qbAttachment, int position) { if (qbAttachment != null) { String url = QBFile.getPrivateUrlForUID(qbAttachment.getId()); AttachmentImageActivity.start(ChatActivity.this, url); } }
Source:
<code>public boolean isSubtypeOf(Type superType) { if (((JavaType) superType).isTagged(TYPEVAR)) { return false; } <START> if(erasure() == superType.erasure()) { <END> if (((JavaType) superType).isParameterized()) { return checkSubstitutedTypesCompatibility((ParametrizedTypeJavaType) superType); } return true; } for (ClassJavaType classJavaType : symbol.superTypes()) { JavaType javaType = typeSubstitutionSolver.applySubstitution(classJavaType, this.typeSubstitution); if(javaType.isSubtypeOf(superType)) { return true; } } if (((JavaType) superType).isTagged(WILDCARD)) { return ((WildCardType) superType).isSubtypeOfBound(this); } return false; }</code><technical_language>![MAJOR](<LINK_1> Change this comparison equals method. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public boolean isSubtypeOf(Type superType) { if (((JavaType) superType).isTagged(TYPEVAR)) { return false; } if(erasure() == superType.erasure()) { if (((JavaType) superType).isParameterized()) { return checkSubstitutedTypesCompatibility((ParametrizedTypeJavaType) superType); } return true; } JavaType superclass = symbol.getSuperclass(); if(superclass != null) { superclass = typeSubstitutionSolver.applySubstitution(superclass, this.typeSubstitution); if(superclass.isSubtypeOf(superType)) { return true; } } for (JavaType superInterface : symbol.getInterfaces()) { superclass = typeSubstitutionSolver.applySubstitution(superInterface, this.typeSubstitution); if(superclass.isSubtypeOf(superType)) { return true; } } if (((JavaType) superType).isTagged(WILDCARD)) { return ((WildCardType) superType).isSubtypeOfBound(this); } return false; }
Source:
<code>public void getExecutionLog(ProcessExecutionDetail executionDetail, OutputStream outputStream) { <START> notNull(executionDetail, "executionDetail"); <END> try { final File tempFile = createTempFile("execution", ".log"); tempFile.deleteOnExit(); InputStream response = restTemplate.execute(executionDetail.getLogLink(), HttpMethod.GET, noopRequestCallback, new FileResponseExtractor(tempFile)); FileCopyUtils.copy(response, outputStream); } catch (IOException | GoodDataException | RestClientException e) { throw new GoodDataException("Unable to get process execution log " + executionDetail.getLogLink(), e); } }</code><technical_language>check outputStream != null</technical_language>

Target:
public void getExecutionLog(ProcessExecutionDetail executionDetail, OutputStream outputStream) { notNull(executionDetail, "executionDetail"); notNull(outputStream, "outputStream"); try { restTemplate.execute(executionDetail.getLogLink(), HttpMethod.GET, noopRequestCallback, new OutputStreamResponseExtractor(outputStream)); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to get process execution log " + executionDetail.getLogLink(), e); } }
Source:
<code>public boolean equals(Object other) { <START> EventListenerWrapper l2 = (EventListenerWrapper)other; <END> return listener.equals(l2.listener); }</code><technical_language>this triggers a findbugs error blindly casts assumes non-null</technical_language>

Target:
public boolean equals(Object other) { if (!(other instanceof EventListenerWrapper)) { return false; } EventListenerWrapper l2 = (EventListenerWrapper)other; return listener.equals(l2.listener); }
Source:
<code>public void testWildcard(String tenantId, String unit) throws Exception { SearchResult entry; List<SearchResult> results; results = elasticIO.search(tenantId, "one.two.*"); List<Locator> locators = locatorMap.get(tenantId); assertEquals(locators.size(), results.size()); for (Locator locator : locators) { entry = new SearchResult(tenantId, locator.getMetricName(), unit); boolean isFound = false; for(SearchResult item : results){ if((StringUtils.isNotEmpty(item.getMetricName()) && item.getMetricName().equalsIgnoreCase(entry.getMetricName())) && (StringUtils.isNotEmpty(item.getTenantId()) && item.getTenantId().equalsIgnoreCase(entry.getTenantId()))){ isFound = true; break; } } Assert.assertTrue(isFound); } <START> results = elasticIO.search(tenantId, "*.fourA.*"); <END> assertEquals(NUM_PARENT_ELEMENTS * NUM_GRANDCHILD_ELEMENTS, results.size()); for (int x = 0; x < NUM_PARENT_ELEMENTS; x++) { for (int z = 0; z < NUM_GRANDCHILD_ELEMENTS; z++) { entry = createExpectedResult(tenantId, x, "A", z, unit); Assert.assertTrue(results.contains(entry)); } } results = elasticIO.search(tenantId, "*.three1*.four*.five2"); assertEquals(10 * CHILD_ELEMENTS.size(), results.size()); for (int x = 10; x < 20; x++) { for (String y : CHILD_ELEMENTS) { entry = createExpectedResult(tenantId, x, y, 2, unit); Assert.assertTrue(results.contains(entry)); } } }</code><technical_language>longer running "elasticIO" version of tests. not</technical_language>

Target:
public void testWildcard(String tenantId, String unit) throws Exception { SearchResult entry; List<SearchResult> results; results = elasticIO.search(tenantId, "one.two.*"); List<Locator> locators = locatorMap.get(tenantId); assertEquals(locators.size(), results.size()); for (Locator locator : locators) { entry = new SearchResult(tenantId, locator.getMetricName(), unit); Assert.assertTrue((results.contains(entry))); } results = elasticIO.search(tenantId, "*.fourA.*"); assertEquals(NUM_PARENT_ELEMENTS * NUM_GRANDCHILD_ELEMENTS, results.size()); for (int x = 0; x < NUM_PARENT_ELEMENTS; x++) { for (int z = 0; z < NUM_GRANDCHILD_ELEMENTS; z++) { entry = createExpectedResult(tenantId, x, "A", z, unit); Assert.assertTrue(results.contains(entry)); } } results = elasticIO.search(tenantId, "*.three1*.four*.five2"); assertEquals(10 * CHILD_ELEMENTS.size(), results.size()); for (int x = 10; x < 20; x++) { for (String y : CHILD_ELEMENTS) { entry = createExpectedResult(tenantId, x, y, 2, unit); Assert.assertTrue(results.contains(entry)); } } }
Source:
<code><START> public static DirectoryEntry createDirectoryEntry(String directoryName, Map<String, String> properties) { <END> DirectoryEntry entry = new DirectoryEntry(); entry.setProperties(properties); entry = CLIENT.directoryManager().directory(directoryName).createEntry(entry); addDirectoryEntryToDelete(directoryName, entry.getId()); return entry; }</code><technical_language>I prefer propagate java client objects of this class. set String update updateDirectoryEntry(String, DirectoryEntry) updateDirectoryEntry(String, String, Map<String, String>) ? code: public static void updateDirectoryEntry(String directoryName, String entryId, Map<String, String> properties) { DirectoryEntry entry = new DirectoryEntry(); entry.setProperties(properties); entry.putIdProperty(entryId); CLIENT.directoryManager().directory(directoryName).updateEntry(entry); }</technical_language>

Target:
public static String createDirectoryEntry(String directoryName, Map<String, String> properties) { DirectoryEntry entry = new DirectoryEntry(); entry.setProperties(properties); entry = CLIENT.directoryManager().directory(directoryName).createEntry(entry); String entryId = entry.getId(); addDirectoryEntryToDelete(directoryName, entryId); return entryId; }
Source:
<code>public void testOverride() throws Exception { deployContrib("org.nuxeo.ecm.platform.usermanager.tests", "test-userservice-override-config.xml"); applyInlineDeployments(); <START> postSetUp(); <END> FakeUserManagerImpl fum = (FakeUserManagerImpl) userManager; assertEquals(Arrays.asList("tehroot", "bob", "bobette"), fum.defaultAdministratorIds); assertEquals(Arrays.asList("myAdministrators"), fum.administratorsGroups); assertEquals("id", userManager.getUserSortField()); assertEquals("search_only", userManager.getUserListingMode()); assertEquals("search_oh_yeah", userManager.getGroupListingMode()); assertEquals("defgr", userManager.getDefaultGroup()); assertEquals("sn", fum.groupSortField); assertNull(fum.anonymousUser); assertTrue(fum.virtualUsers.containsKey("MyCustomAdministrator")); VirtualUser customAdmin = fum.virtualUsers.get("MyCustomAdministrator"); assertNotNull(customAdmin); assertEquals("MyCustomAdministrator", customAdmin.getId()); assertEquals(1, customAdmin.getGroups().size()); assertTrue(customAdmin.getGroups().contains("administrators2")); assertEquals("secret2", customAdmin.getPassword()); Map<String, Serializable> props = new HashMap<String, Serializable>(); props.put("first", "My Custom 2"); props.put("last", "Administrator 2"); assertEquals(props, customAdmin.getProperties()); assertFalse(fum.virtualUsers.containsKey("MyCustomMember")); assertNull(fum.virtualUsers.get("MyCustomMember")); }</code><technical_language>postSetUp called applyInlineDeployments - pushInlineDeployments ? - of deployContrib a test contribution</technical_language>

Target:
public void testOverride() throws Exception { pushInlineDeployments("org.nuxeo.ecm.platform.usermanager.tests:test-userservice-override-config.xml"); FakeUserManagerImpl fum = (FakeUserManagerImpl) userManager; assertEquals(Arrays.asList("tehroot", "bob", "bobette"), fum.defaultAdministratorIds); assertEquals(Arrays.asList("myAdministrators"), fum.administratorsGroups); assertEquals("id", userManager.getUserSortField()); assertEquals("search_only", userManager.getUserListingMode()); assertEquals("search_oh_yeah", userManager.getGroupListingMode()); assertEquals("defgr", userManager.getDefaultGroup()); assertEquals("sn", fum.groupSortField); assertNull(fum.anonymousUser); assertTrue(fum.virtualUsers.containsKey("MyCustomAdministrator")); VirtualUser customAdmin = fum.virtualUsers.get("MyCustomAdministrator"); assertNotNull(customAdmin); assertEquals("MyCustomAdministrator", customAdmin.getId()); assertEquals(1, customAdmin.getGroups().size()); assertTrue(customAdmin.getGroups().contains("administrators2")); assertEquals("secret2", customAdmin.getPassword()); Map<String, Serializable> props = new HashMap<>(); props.put("first", "My Custom 2"); props.put("last", "Administrator 2"); assertEquals(props, customAdmin.getProperties()); assertFalse(fum.virtualUsers.containsKey("MyCustomMember")); assertNull(fum.virtualUsers.get("MyCustomMember")); }
Source:
<code>public static void setupTest() throws Exception { if (startCount++ > 0) { return; } addAppArtifact(APP_ARTIFACT_ID, ETLBatchApplication.class, BatchSource.class.getPackage().getName(), PipelineConfigurable.class.getPackage().getName(), "org.apache.avro.mapred", "org.apache.avro", "org.apache.avro.generic", "org.apache.avro.io", "parquet.hadoop.api", "parquet.hadoop", "parquet.schema", "parquet.io.api"); addPluginArtifact(Id.Artifact.from(Id.Namespace.DEFAULT, "batch-plugins", "1.0.0"), APP_ARTIFACT_ID, KVTableSource.class, StreamBatchSource.class, TableSource.class, TimePartitionedFileSetDatasetAvroSource.class, TimePartitionedFileSetDatasetParquetSource.class, AvroParquetInputFormat.class, BatchCubeSink.class, KVTableSink.class, TableSink.class, TimePartitionedFileSetDatasetAvroSink.class, AvroKeyOutputFormat.class, AvroKey.class, TimePartitionedFileSetDatasetParquetSink.class, AvroParquetOutputFormat.class, SnapshotFileBatchAvroSink.class, SnapshotFileBatchParquetSink.class, SnapshotFileBatchAvroSource.class, SnapshotFileBatchParquetSource.class, S3AvroBatchSink.class, S3ParquetBatchSink.class); addPluginArtifact(Id.Artifact.from(Id.Namespace.DEFAULT, "transforms", "1.0.0"), APP_ARTIFACT_ID, ProjectionTransform.class, ScriptFilterTransform.class, ValidatorTransform.class, CoreValidator.class, StructuredRecordToGenericRecordTransform.class, JavaScriptTransform.class, <START> PythonEvaluator.class, PythonInterpreter.class); <END> }</code><technical_language>do need add PythonInterpreter</technical_language>

Target:
public static void setupTest() throws Exception { if (startCount++ > 0) { return; } addAppArtifact(APP_ARTIFACT_ID, ETLBatchApplication.class, BatchSource.class.getPackage().getName(), PipelineConfigurable.class.getPackage().getName(), "org.apache.avro.mapred", "org.apache.avro", "org.apache.avro.generic", "org.apache.avro.io", "parquet.hadoop.api", "parquet.hadoop", "parquet.schema", "parquet.io.api"); addPluginArtifact(Id.Artifact.from(Id.Namespace.DEFAULT, "batch-plugins", "1.0.0"), APP_ARTIFACT_ID, KVTableSource.class, StreamBatchSource.class, TableSource.class, TimePartitionedFileSetDatasetAvroSource.class, TimePartitionedFileSetDatasetParquetSource.class, AvroParquetInputFormat.class, BatchCubeSink.class, KVTableSink.class, TableSink.class, TimePartitionedFileSetDatasetAvroSink.class, AvroKeyOutputFormat.class, AvroKey.class, TimePartitionedFileSetDatasetParquetSink.class, AvroParquetOutputFormat.class, SnapshotFileBatchAvroSink.class, SnapshotFileBatchParquetSink.class, SnapshotFileBatchAvroSource.class, SnapshotFileBatchParquetSource.class, S3AvroBatchSink.class, S3ParquetBatchSink.class); addPluginArtifact(Id.Artifact.from(Id.Namespace.DEFAULT, "transforms", "1.0.0"), APP_ARTIFACT_ID, ProjectionTransform.class, ScriptFilterTransform.class, ValidatorTransform.class, CoreValidator.class, StructuredRecordToGenericRecordTransform.class, JavaScriptTransform.class, PythonEvaluator.class); }
Source:
<code>public static final boolean isArrayAllZeros(final byte[] array) { int sum = 0; for (byte b : array) { <START> sum |= b; <END> } return sum == 0; }</code><technical_language>this complete faster early exiting if (b != 0) return false</technical_language>

Target:
public static final boolean isArrayAllZeros(final byte[] array) { return PlatformDependent.isZero(array, 0, array.length); }
Source:
<code>void unsetSuccessAndSendWriteRequest(int bookieIndex) { if (toSend == null) { return; } DistributionSchedule.WriteSet writeSet = lh.distributionSchedule.getWriteSet(entryId); try { if (!writeSet.contains(bookieIndex)) { lh.sendAddSuccessCallbacks(); return; } } finally { writeSet.recycle(); } if (callbackTriggered) { return; } <START> LOG.info("Unsetting success for ledger: " + lh.ledgerId + " entry: " + entryId + " bookie index: " <END> + bookieIndex); if (!ackSet.removeBookieAndCheck(bookieIndex)) { completed = false; } sendWriteRequest(bookieIndex); }</code><technical_language>I change this LOG.info. annoying. If want this information, change log4j properties log debug statements for PendingAddOp</technical_language>

Target:
void unsetSuccessAndSendWriteRequest(int bookieIndex) { if (toSend == null) { return; } DistributionSchedule.WriteSet writeSet = lh.distributionSchedule.getWriteSet(entryId); try { if (!writeSet.contains(bookieIndex)) { lh.sendAddSuccessCallbacks(); return; } } finally { writeSet.recycle(); } if (callbackTriggered) { return; } if (LOG.isDebugEnabled()) { LOG.debug("Unsetting success for ledger: " + lh.ledgerId + " entry: " + entryId + " bookie index: " + bookieIndex); } if (!ackSet.removeBookieAndCheck(bookieIndex)) { completed = false; } sendWriteRequest(bookieIndex); }
Source:
<code>public void testQueryParamAsFormParamDisabled() throws Exception { createServer(binder -> jaxrsBinder(binder).bind(FormParamResource.class), false); Request request = Request.builder() .setUri(uriBuilderFrom(server.getBaseUrl().resolve("/test")).addParameter("testParam", "foo").build()) .setMethod("POST") .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED) .build(); StringResponse response = client.execute(request, createStringResponseHandler()); <START> assertEquals(response.getStatusCode(), Status.BAD_REQUEST.getStatusCode()); <END> }</code><technical_language>This test care BAD_REQUEST framework resource. want narrow resource return OK distinguished in body</technical_language>

Target:
public void testQueryParamAsFormParamDisabled() throws Exception { createServer(binder -> jaxrsBinder(binder).bind(FormParamResource.class), false); Request request = Request.builder() .setUri(uriBuilderFrom(server.getBaseUrl().resolve("/test")).addParameter("testParam", "foo").build()) .setMethod("POST") .setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED) .build(); StringResponse response = client.execute(request, createStringResponseHandler()); assertEquals(response.getStatusCode(), Status.OK.getStatusCode()); assertEquals(response.getBody(), "Empty param"); }
Source:
<code>public List<Description> getTestRunsStarted() { <START> return fTestRunsStarted; <END> }</code><technical_language>I this code is "just for testing" wrap return Collections.unmodifiableList()</technical_language>

Target:
public List<Description> getTestRunsStarted() { return unmodifiableList(testRunsStarted); }
Source:
<code>void initialize(SpellingService spellingService, WorkbenchListManager workbenchListManager, UIPrefs uiPrefs) { userDictionary_ = workbenchListManager.getUserDictionaryList(); uiPrefs_ = uiPrefs; <START> ExternalJavaScriptLoader.Callback loadTypoCallback = () -> typoNative = new TypoNative("en_US"); <END> new ExternalJavaScriptLoader(TypoResources.INSTANCE.typojs().getSafeUri().asString()).addCallback(loadTypoCallback); }</code><technical_language>initialize methods purely for dependency injection. reason put this in constructor (where injector is called)</technical_language>

Target:
void initialize(SpellingService spellingService, WorkbenchListManager workbenchListManager, UIPrefs uiPrefs) { userDictionary_ = workbenchListManager.getUserDictionaryList(); uiPrefs_ = uiPrefs; loadDictionary(); }
Source:
<code>private void onNewTemplate() { UnitVmModel model = (UnitVmModel) getWindow(); VM vm = getSelectedItem(); if (vm == null) { cancel(); return; } if (model.getProgress() != null) { return; } if (!model.validate(false)) { model.setIsValid(false); } else if (model.getIsSubTemplate().getEntity()) { postNameUniqueCheck(); } else { String name = model.getName().getEntity(); AsyncDataProvider.getInstance().isTemplateNameUnique(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmListModel<Void> vmListModel = (VmListModel<Void>) target; boolean isNameUnique = (Boolean) returnValue; if (!isNameUnique) { UnitVmModel VmModel = (UnitVmModel) vmListModel.getWindow(); VmModel.getInvalidityReasons().clear(); VmModel.getName() .getInvalidityReasons() .add(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()); VmModel.getName().setIsValid(false); VmModel.setIsValid(false); } else { vmListModel.postNameUniqueCheck(); } } }), <START> name, model.getDataCenterWithClustersList().getSelectedItem().getDataCenter().getId()); <END> } }</code><technical_language>simplify this getSelectedDataCenter().getId()</technical_language>

Target:
private void onNewTemplate() { UnitVmModel model = (UnitVmModel) getWindow(); VM vm = getSelectedItem(); if (vm == null) { cancel(); return; } if (model.getProgress() != null) { return; } if (!model.validate(false)) { model.setIsValid(false); } else if (model.getIsSubTemplate().getEntity()) { postNameUniqueCheck(); } else { String name = model.getName().getEntity(); AsyncDataProvider.getInstance().isTemplateNameUnique(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { VmListModel<Void> vmListModel = (VmListModel<Void>) target; boolean isNameUnique = (Boolean) returnValue; if (!isNameUnique) { UnitVmModel VmModel = (UnitVmModel) vmListModel.getWindow(); VmModel.getInvalidityReasons().clear(); VmModel.getName() .getInvalidityReasons() .add(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()); VmModel.getName().setIsValid(false); VmModel.setIsValid(false); } else { vmListModel.postNameUniqueCheck(); } } }), name, model.getSelectedDataCenter().getId()); } }
Source:
<code>public int readDataBlocking(byte[] buffer) throws IOException { <START> int readBytes = 0; <END> if (getInputStream() != null) readBytes = getInputStream().read(buffer); return readBytes; }</code><technical_language>Check buffer null</technical_language>

Target:
public int readDataBlocking(byte[] buffer) throws IOException { if (buffer == null) throw new NullPointerException("Buffer cannot be null."); int readBytes = 0; if (getInputStream() != null) readBytes = getInputStream().read(buffer); return readBytes; }
Source:
<code><START> public void onGetSmeltingExperience(ItemStack stack, CallbackInfoReturnable<Float> cir) { <END> ItemStackSnapshot ingredient = ItemStackUtil.snapshotOf(stack); Optional<SmeltingResult> result = getCustomResult(ingredient); if (result.isPresent()) { float nativeResult = (float) result.get().getExperience(); cir.setReturnValue(nativeResult); } }</code><technical_language>is need this public</technical_language>

Target:
private void onGetSmeltingExperience(ItemStack stack, CallbackInfoReturnable<Float> cir) { ItemStackSnapshot ingredient = ItemStackUtil.snapshotOf(stack); Optional<SmeltingResult> result = getCustomResult(ingredient); if (result.isPresent()) { float nativeResult = (float) result.get().getExperience(); cir.setReturnValue(nativeResult); } }
Source:
<code>protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); saveInterval.loadDefault(); stickyCycleButton.setSelection(store.getBoolean(IPreferenceConstants.STICKY_CYCLE)); openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER); openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); singleClickButton.setSelection(openOnSingleClick); doubleClickButton.setSelection(!openOnSingleClick); selectOnHoverButton.setSelection(selectOnHover); openAfterDelayButton.setSelection(openAfterDelay); selectOnHoverButton.setEnabled(openOnSingleClick); openAfterDelayButton.setEnabled(openOnSingleClick); stickyCycleButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE)); showUserDialogButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.RUN_IN_BACKGROUND)); showHeapStatusButton.setSelection( PrefUtil.getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR)); <START> renameModeInline = true; <END> renameModeInlineButton.setSelection(renameModeInline); renameModeDialogButton.setSelection(!renameModeInline); super.performDefaults(); }</code><technical_language>this set inline mode. However, set default preference store (product customization value)</technical_language>

Target:
protected void performDefaults() { IPreferenceStore store = getPreferenceStore(); saveInterval.loadDefault(); stickyCycleButton.setSelection(store.getBoolean(IPreferenceConstants.STICKY_CYCLE)); openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER); openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); singleClickButton.setSelection(openOnSingleClick); doubleClickButton.setSelection(!openOnSingleClick); selectOnHoverButton.setSelection(selectOnHover); openAfterDelayButton.setSelection(openAfterDelay); selectOnHoverButton.setEnabled(openOnSingleClick); openAfterDelayButton.setEnabled(openOnSingleClick); stickyCycleButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.STICKY_CYCLE)); showUserDialogButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.RUN_IN_BACKGROUND)); showHeapStatusButton.setSelection( PrefUtil.getAPIPreferenceStore().getDefaultBoolean(IWorkbenchPreferenceConstants.SHOW_MEMORY_MONITOR)); String defaultRenameMode = store.getDefaultString(IWorkbenchPreferenceConstants.RESOURCE_RENAME_MODE); renameModeInline = !IWorkbenchPreferenceConstants.RESOURCE_RENAME_MODE_DIALOG.equals(defaultRenameMode); renameModeInlineButton.setSelection(renameModeInline); renameModeDialogButton.setSelection(!renameModeInline); super.performDefaults(); }
Source:
<code>private synchronized URI createNextResultsUri(String scheme, UriInfo uriInfo) { <START> return uriInfo.getBaseUriBuilder().replacePath("/v1/statement").path(queryId.toString()).path(String.valueOf(resultId.incrementAndGet())).replaceQuery("").scheme(scheme).build(); <END> }</code><technical_language>Replace scheme in URL. wrap this long: java return uriInfo.getBaseUriBuilder() .scheme(scheme) .replacePath("/v1/statement") .path(queryId.toString()) .path(String.valueOf(resultId.incrementAndGet())) .replaceQuery("") .build();</technical_language>

Target:
private synchronized URI createNextResultsUri(String scheme, UriInfo uriInfo) { return uriInfo.getBaseUriBuilder() .scheme(scheme) .replacePath("/v1/statement") .path(queryId.toString()) .path(String.valueOf(resultId.incrementAndGet())) .replaceQuery("") .build(); }
Source:
<code>public void logCurrentState() { <START> bareLockRpcClient.currentTimeMillis(); <END> }</code><technical_language>this bareLockRpcClient.logCurrentState() right</technical_language>

Target:
public void logCurrentState() { namespaceAgnosticLockRpcClient.logCurrentState(); }
Source:
<code>private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { List<String> itemStrings = new ArrayList<>(columns.size()); for (TableColumn viewColumn : <START> fTable.getColumns()) { <END> TmfEventTableColumn column = columns.get((int) viewColumn.getData(Key.INDEX)); ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } if (passedEvent == null || (!viewColumn.getResizable() && viewColumn.getWidth() == 0)) { itemStrings.add(EMPTY_STRING); } else { itemStrings.add(column.getItemString(passedEvent)); } } return itemStrings.toArray(new String[itemStrings.size()]); } }</code><technical_language>return string array in order received 'columns' parameter, in creation order</technical_language>

Target:
private String[] getItemStrings(List<TmfEventTableColumn> columns, ITmfEvent event) { if (event == null) { return EMPTY_STRING_ARRAY; } synchronized (columns) { Map<TmfEventTableColumn , String> itemStrings = new HashMap<>(); for (TableColumn viewColumn : fTable.getColumns()) { TmfEventTableColumn column = columns.get((int) viewColumn.getData(Key.INDEX)); ITmfEvent passedEvent = event; if (!(column instanceof TmfMarginColumn) && (event instanceof CachedEvent)) { passedEvent = ((CachedEvent) event).event; } if (passedEvent == null || (!viewColumn.getResizable() && viewColumn.getWidth() == 0)) { itemStrings.put(column ,EMPTY_STRING); } else { itemStrings.put(column ,column.getItemString(passedEvent)); } } String[] displayStrings = new String[columns.size()]; int i = 0; for (TmfEventTableColumn column : columns) { displayStrings[i] = itemStrings.get(column); i++; } return displayStrings; } }
Source:
<code>public void testDeleteLoadBalancer() throws SerializationException, StateAccessException, MappingStatusException, Rule.RuleIndexOutOfBoundsException { String path = pb.getPoolHealthMonitorMappingsPath(pool.id, healthMonitor.id); Assert.assertTrue(this.zk.exists(path)); <START> UUID lbId = this.dataClient.loadBalancersGetAll().get(0).getId(); <END> this.dataClient.loadBalancerDelete(lbId); Assert.assertFalse(this.zk.exists(path)); }</code><technical_language>Consider verifying is LB. Also, I this better: Pool mPool = this.dataClient.getPool(pool.id) LoadBalancer lb = this.dataClient.getLoadBalancer(mPool.loadBalancerId) this.dataClient.loadBalancerDelete(lb.id)</technical_language>

Target:
public void testDeleteLoadBalancer() throws SerializationException, StateAccessException, MappingStatusException, Rule.RuleIndexOutOfBoundsException { String path = pb.getPoolHealthMonitorMappingsPath(pool.id, healthMonitor.id); Assert.assertTrue(zk.exists(path)); Assert.assertTrue(dataClient.loadBalancersGetAll().size() == 1); UUID lbId = dataClient.poolGet(pool.id).getLoadBalancerId(); dataClient.loadBalancerDelete(lbId); Assert.assertFalse(zk.exists(path)); Assert.assertNull(dataClient.poolGet(pool.id)); Assert.assertNull(dataClient.healthMonitorGet(healthMonitor.id)); }
Source:
<code>public final Response createFolders(@Context final HttpServletRequest httpServletRequest, @Context final HttpServletResponse httpServletResponse, final List<String> paths, @PathParam("siteName") final String siteName) { final InitDataObject initData = new WebResource.InitBuilder(webResource) .requiredBackendUser(true) .requiredFrontendUser(false) .requestAndResponse(httpServletRequest, httpServletResponse) .init(); final User user = initData.getUser(); try { final List<Map<String, Object>> createdFolders = folderHelper.createFolders(paths, siteName, user); return Response.ok(new ResponseEntityView(createdFolders)).build(); } catch (Exception e) { Logger.error(this.getClass(),"Exception saving/creating folders.", e); <START> return ResponseUtil.mapExceptionResponse(e); <END> } }</code><technical_language>Exception Mapper</technical_language>

Target:
public final Response createFolders(@Context final HttpServletRequest httpServletRequest, @Context final HttpServletResponse httpServletResponse, final List<String> paths, @PathParam("siteName") final String siteName) throws DotSecurityException, DotDataException { final InitDataObject initData = new WebResource.InitBuilder(webResource) .requiredBackendUser(true) .requiredFrontendUser(false) .requestAndResponse(httpServletRequest, httpServletResponse) .init(); final User user = initData.getUser(); final List<Map<String, Object>> createdFolders = folderHelper.createFolders(paths, siteName, user); return Response.ok(new ResponseEntityView(createdFolders)).build(); }
Source:
<code>private void checkAndHandleChannelOnGateway(final SmartMeter gateway, final MbusChannelElementsResponseDto mbusChannelElementsResponseDto) throws FunctionalException { final List<SmartMeter> alreadyCoupled = this.smartMeteringDeviceRepository .getMbusDevicesForGateway(gateway.getId()); <START> <END> for (final SmartMeter coupledDevice : alreadyCoupled) { if (this.allReadyCoupledWithOtherDevice(gateway, coupledDevice, mbusChannelElementsResponseDto)) { LOGGER.info("There is already an M-bus device coupled to gateway on channel {}", coupledDevice.getDeviceIdentification(), gateway.getDeviceIdentification(), coupledDevice.getChannel()); throw new FunctionalException(FunctionalExceptionType.CHANNEL_ON_DEVICE_ALREADY_COUPLED, ComponentType.DOMAIN_SMART_METERING, new ChannelAlreadyOccupiedException(coupledDevice.getChannel())); } } }</code><technical_language>I a check needs done if alreadyCoupled contains mBusDeviceIdentification in mbusChannelElementsResponseDto. channel number is irrelevant. If a match is mBus device is coupled gateway device; a decouple needs done first</technical_language>

Target:
private void checkAndHandleChannelOnGateway(final SmartMeter gateway, final MbusChannelElementsResponseDto mbusChannelElementsResponseDto) throws FunctionalException { final List<SmartMeter> alreadyCoupled = this.smartMeteringDeviceRepository .getMbusDevicesForGateway(gateway.getId()); for (final SmartMeter coupledDevice : alreadyCoupled) { if (this.allReadyCoupledWithOtherDevice(coupledDevice, mbusChannelElementsResponseDto)) { LOGGER.warn("There is already an M-bus device coupled to gateway on channel {}, handling {}", coupledDevice.getDeviceIdentification(), gateway.getDeviceIdentification(), coupledDevice.getChannel(), mbusChannelElementsResponseDto); throw new FunctionalException(FunctionalExceptionType.CHANNEL_ON_DEVICE_ALREADY_COUPLED, ComponentType.DOMAIN_SMART_METERING, new ChannelAlreadyOccupiedException(coupledDevice.getChannel())); } } }
Source:
<code>public TwitterDocument next() { <START> <END> TwitterDocument doc = new TwitterDocument(); String raw = null; try { raw = bufferedReader.readLine(); } catch (IOException e) { e.printStackTrace(); } if (raw == null) { atEOF = true; return null; } try { doc = (TwitterDocument) doc.readNextRecord(raw); if (doc == null) { return null; } } catch (IOException e) { e.printStackTrace(); } return doc; }</code><technical_language>Remove this blank line</technical_language>

Target:
public TwitterDocument next() { TwitterDocument doc = new TwitterDocument(); String raw = null; try { raw = bufferedReader.readLine(); } catch (IOException e) { e.printStackTrace(); doc = null; } if (raw == null) { atEOF = true; return null; } try { doc = (TwitterDocument) doc.readNextRecord(raw, keepRetweets); if (doc == null) { return null; } } catch (IOException e) { e.printStackTrace(); doc = null; } return doc; }
Source:
<code>public void handleGET(CoapExchange exchange) { StringBuilder payload = new StringBuilder(); Request request = exchange.advanced().getRequest(); payload.append(String.format("Type: %d (%s)\nCode: %d (%s)\nMID: %d", request.getType().value, request.getType(), request.getCode().value, request.getCode(), request.getMID())); if (request.getToken() != null) { payload.append("\nToken: "); if (request.hasEmptyToken()) { payload.append("[]"); } else { for (byte b : request.getTokenBytes()) payload.append(String.format("%02x", b & 0xff)); <START> } <END> } if (payload.length() > 64) { payload.delete(62, payload.length()); payload.append('»'); } exchange.setMaxAge(30); exchange.respond(CONTENT, payload.toString(), TEXT_PLAIN); }</code><technical_language>I replace payload.append(request.getTokenString())</technical_language>

Target:
public void handleGET(CoapExchange exchange) { StringBuilder payload = new StringBuilder(); Request request = exchange.advanced().getRequest(); payload.append(String.format("Type: %d (%s)\nCode: %d (%s)\nMID: %d", request.getType().value, request.getType(), request.getCode().value, request.getCode(), request.getMID())); if (request.getToken() != null) { payload.append("\nToken: "); payload.append(request.getTokenString()); } if (payload.length() > 64) { payload.delete(62, payload.length()); payload.append('»'); } exchange.setMaxAge(30); exchange.respond(CONTENT, payload.toString(), TEXT_PLAIN); }
Source:
<code>public Response getContentTypeFieldById(@PathParam("typeId") final String typeId, @PathParam("fieldId") final String fieldId, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { <START> <END> Response response = null; try { Field field = fieldAPI.find(fieldId); response = Response.ok(new ResponseEntityView(new JsonFieldTransformer(field).mapObject())).build(); } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }</code><technical_language>this call webResource.init deleted</technical_language>

Target:
public Response getContentTypeFieldById(@PathParam("typeId") final String typeId, @PathParam("fieldId") final String fieldId, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { this.webResource.init(null, false, req, false, null); Response response = null; try { final Field field = fieldAPI.find(fieldId); response = Response.ok(new ResponseEntityView(new JsonFieldTransformer(field).mapObject())).build(); } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }