auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Optional<RequestConfig> addJerseyRequestConfig(Configuration configuration) { <START> RequestConfig.Builder requestConfig = RequestConfig.copy(client.getDefaultRequestConfig()); <END> boolean modified = false; final Integer timeout = (Integer) configuration.getProperty(ClientProperties.READ_TIMEOUT); if (timeout != null) { requestConfig.setSocketTimeout(timeout); modified = true; } final Integer connectTimeout = (Integer) configuration.getProperty(ClientProperties.CONNECT_TIMEOUT); if (connectTimeout != null) { requestConfig.setConnectTimeout(connectTimeout); modified = true; } final Boolean followRedirects = (Boolean) configuration.getProperty(ClientProperties.FOLLOW_REDIRECTS); if (followRedirects != null) { requestConfig.setRedirectsEnabled(followRedirects); modified = true; } if (modified) { return Optional.of(requestConfig.build()); } return Optional.absent(); }</code><technical_language>I a copy lazily, in a case if changes in configuration. this: java if (timeout != null || connectTimeout != null || followRedirects != null) { RequestConfig.Builder requestConfig = RequestConfig.copy(configuredClient.getDefaultRequestConfig()); if (timeout != null) { requestConfig.setSocketTimeout(timeout); } if (connectTimeout != null) { requestConfig.setConnectTimeout(connectTimeout); } if (followRedirects != null) { requestConfig.setRedirectsEnabled(followRedirects); } return Optional.of(requestConfig.build()); } return Optional.absent();</technical_language>

Target:
private Optional<RequestConfig> addJerseyRequestConfig(Configuration configuration) { final Integer timeout = (Integer) configuration.getProperty(ClientProperties.READ_TIMEOUT); final Integer connectTimeout = (Integer) configuration.getProperty(ClientProperties.CONNECT_TIMEOUT); final Boolean followRedirects = (Boolean) configuration.getProperty(ClientProperties.FOLLOW_REDIRECTS); if (timeout != null || connectTimeout != null || followRedirects != null) { RequestConfig.Builder requestConfig = RequestConfig.copy(defaultRequestConfig); if (timeout != null) { requestConfig.setSocketTimeout(timeout); } if (connectTimeout != null) { requestConfig.setConnectTimeout(connectTimeout); } if (followRedirects != null) { requestConfig.setRedirectsEnabled(followRedirects); } return Optional.of(requestConfig.build()); } return Optional.absent(); }
Source:
<code>public void setCellDataValueByPosition(final int row, final int col, final String text) { assertIsLegalCell(row, col); assertNotNull(text); waitForEnabled(); <START> if (hasStyle(widget, SWT.READ_ONLY)) <END> throw new RuntimeException("This Nattable is read-only."); asyncExec(new VoidResult() { public void run() { click(row, col); ICellEditor editor = widget.getActiveCellEditor(); editor.setEditorValue(text); } }); notify(SWT.Modify); }</code><technical_language>Assert.isTrue()</technical_language>

Target:
public void setCellDataValueByPosition(final int row, final int col, final String text) { assertIsLegalCell(row, col); Assert.isNotNull(text); waitForEnabled(); Assert.isTrue(hasStyle(widget, SWT.READ_ONLY)); asyncExec(new VoidResult() { public void run() { click(row, col); ICellEditor editor = widget.getActiveCellEditor(); editor.setEditorValue(text); } }); notify(SWT.Modify); }
Source:
<code>private void validatePage() { String message = null; if (userText.getText().trim().length() == 0) message = Messages.CredentialsWizardPage_ErrorUser; <START> if (message == null && passwordText.getText().trim().length() == 0) <END> message = Messages.CredentialsWizardPage_ErrorPassword; setErrorMessage(message); setPageComplete(message == null); }</code><technical_language>Suggestion: else-if for provide missing braces. instead of length() == 0 isEmpty()</technical_language>

Target:
private void validatePage() { String message = null; if (userText.getText().trim().isEmpty()) { message = Messages.CredentialsWizardPage_ErrorUser; } else if (passwordText.getText().trim().isEmpty()) { message = Messages.CredentialsWizardPage_ErrorPassword; } setErrorMessage(message); setPageComplete(message == null); }
Source:
<code>private static void alignStreamNode(StreamNode streamNode, StreamGraph streamGraph) { <START> if (streamNode.getOperatorName().equals(KEYED_STREAM_VALUE_OPERATOR_NAME)) { StreamEdge downStreamEdge = streamNode.getOutEdges().get(0); StreamNode downStreamNode = streamGraph.getStreamNode(downStreamEdge.getTargetId()); downStreamEdge.setPartitioner(new ForwardPartitioner()); streamNode.setParallelism(downStreamNode.getParallelism()); streamNode.setCoLocationGroup(downStreamNode.getCoLocationGroup()); streamNode.setSlotSharingGroup(downStreamNode.getSlotSharingGroup()); } if (streamNode.getOperatorName().equals(STREAM_KEY_BY_MAP_OPERATOR_NAME)) { StreamEdge upStreamEdge = streamNode.getInEdges().get(0); StreamNode upStreamNode = streamGraph.getStreamNode(upStreamEdge.getSourceId()); upStreamEdge.setPartitioner(new ForwardPartitioner<>()); streamNode.setParallelism(upStreamNode.getParallelism()); streamNode.setSlotSharingGroup(upStreamNode.getSlotSharingGroup()); streamNode.setCoLocationGroup(upStreamNode.getCoLocationGroup()); <END> } }</code><technical_language>Another method extracted avoid code duplication</technical_language>

Target:
private static void alignStreamNode(StreamNode streamNode, StreamGraph streamGraph) { if (streamNode.getOperatorName().equals(KEYED_STREAM_VALUE_OPERATOR_NAME)) { StreamEdge downStreamEdge = streamNode.getOutEdges().get(0); StreamNode downStreamNode = streamGraph.getStreamNode(downStreamEdge.getTargetId()); chainStreamNode(downStreamEdge, streamNode, downStreamNode); downStreamEdge.setPartitioner(new ForwardPartitioner()); } if (streamNode.getOperatorName().equals(STREAM_KEY_BY_MAP_OPERATOR_NAME)) { StreamEdge upStreamEdge = streamNode.getInEdges().get(0); StreamNode upStreamNode = streamGraph.getStreamNode(upStreamEdge.getSourceId()); chainStreamNode(upStreamEdge, streamNode, upStreamNode); } }
Source:
<code>static Optional<DataType> findDataType( CallContext callContext, boolean throwOnFailure, DataType actualDataType, LogicalTypeRoot expectedRoot, @Nullable Boolean expectedNullability) { final LogicalType actualType = actualDataType.getLogicalType(); return Optional.ofNullable(findDataTypeOfRoot(actualDataType, expectedRoot)) .map(newDataType -> { if (Objects.equals(expectedNullability, Boolean.TRUE)) { return newDataType.nullable(); } else if (Objects.equals(expectedNullability, Boolean.FALSE)) { return newDataType.notNull(); } return newDataType; }) .map(newDataType -> { final Class<?> clazz = actualDataType.getConversionClass(); final LogicalType newType = newDataType.getLogicalType(); <START> if (newType.supportsInputConversion(clazz)) { <END> return newDataType.bridgedTo(clazz); } return newDataType; }) .filter(newDataType -> { if (supportsImplicitCast(actualType, newDataType.getLogicalType())) { return true; } if (throwOnFailure) { throw callContext.newValidationError( "Unsupported argument type. Expected type root '%s' but actual type was '%s'.", expectedRoot, actualType); } return false; }); }</code><technical_language>OutputConversionClass ? Arguments of a UDF "outputs of table ecosystem</technical_language>

Target:
static Optional<DataType> findDataType( CallContext callContext, boolean throwOnFailure, DataType actualDataType, LogicalTypeRoot expectedRoot, @Nullable Boolean expectedNullability) { final LogicalType actualType = actualDataType.getLogicalType(); return Optional.ofNullable(findDataTypeOfRoot(actualDataType, expectedRoot)) .map(newDataType -> { if (Objects.equals(expectedNullability, Boolean.TRUE)) { return newDataType.nullable(); } else if (Objects.equals(expectedNullability, Boolean.FALSE)) { return newDataType.notNull(); } else if (actualType.isNullable()) { return newDataType.nullable(); } return newDataType.notNull(); }) .map(newDataType -> { final Class<?> clazz = actualDataType.getConversionClass(); final LogicalType newType = newDataType.getLogicalType(); if (newType.supportsOutputConversion(clazz)) { return newDataType.bridgedTo(clazz); } return newDataType; }) .filter(newDataType -> { if (supportsImplicitCast(actualType, newDataType.getLogicalType())) { return true; } if (throwOnFailure) { throw callContext.newValidationError( "Unsupported argument type. Expected type root '%s' but actual type was '%s'.", expectedRoot, actualType); } return false; }); }
Source:
<code>public void testGroupInheritance() { SuperCar superCar = new SuperCar( "Morris", "DD-AB-123", 1 ); Set<String> messages = getMessages( validator.validate( superCar ) ); assertTrue( messages.contains( "must be greater than or equal to 2" ) ); messages = getMessages( validator.validate( superCar, RaceCarChecks.class ) ); assertTrue( messages.contains( "must be greater than or equal to 2" ) ); assertTrue( messages.contains( "Race car must have a safety belt" ) ); <START> <END> }</code><technical_language>Please remove empty line</technical_language>

Target:
public void testGroupInheritance() { SuperCar superCar = new SuperCar( "Morris", "DD-AB-123", 1 ); assertEquals( "must be greater than or equal to 2", validator.validate( superCar ).iterator().next().getMessage() ); Iterator<ConstraintViolation<SuperCar>> iterator = validator.validate( superCar, RaceCarChecks.class ).iterator(); assertEquals( "Race car must have a safety belt", iterator.next().getMessage() ); assertEquals( "must be greater than or equal to 2", iterator.next().getMessage() ); }
Source:
<code><START> private Map<String, String> extractOptions(URI dsnUri) { <END> String query = dsnUri.getQuery(); if (query == null || query.isEmpty()) return Collections.emptyMap(); Map<String, String> queryOptions = new HashMap<>(); for (String optionPair : query.split("&")) { try { String[] pairDetails = optionPair.split("="); String key = URLDecoder.decode(pairDetails[0], "UTF-8"); String value = pairDetails.length > 1 ? URLDecoder.decode(pairDetails[1], "UTF-8") : null; queryOptions.put(key, value); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Impossible to decode the query parameter '" + optionPair + "'", e); } } return queryOptions; }</code><technical_language>static</technical_language>

Target:
private static Map<String, String> extractOptions(URI dsnUri) { String query = dsnUri.getQuery(); if (query == null || query.isEmpty()) return Collections.emptyMap(); Map<String, String> queryOptions = new HashMap<>(); for (String optionPair : query.split("&")) { try { String[] pairDetails = optionPair.split("="); String key = URLDecoder.decode(pairDetails[0], "UTF-8"); String value = pairDetails.length > 1 ? URLDecoder.decode(pairDetails[1], "UTF-8") : null; queryOptions.put(key, value); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Impossible to decode the query parameter '" + optionPair + "'", e); } } return queryOptions; }
Source:
<code>private FileMetadata putSingleFile(File inputFile, String dropboxPath, DropboxUploadMode mode) throws Exception { FileInputStream inputStream = new FileInputStream(inputFile); FileMetadata uploadedFile; try { WriteMode uploadMode; if (mode == DropboxUploadMode.force) { uploadMode = WriteMode.OVERWRITE; } else { uploadMode = WriteMode.ADD; } <START> uploadedFile = client.files().upload(dropboxPath).uploadAndFinish(inputStream, inputFile.length()); <END> return uploadedFile; } finally { IOHelper.close(inputStream); } }</code><technical_language>uploadBuilder allows uploadMode</technical_language>

Target:
private FileMetadata putSingleFile(File inputFile, String dropboxPath, DropboxUploadMode mode) throws Exception { FileInputStream inputStream = new FileInputStream(inputFile); FileMetadata uploadedFile; try { WriteMode uploadMode; if (mode == DropboxUploadMode.force) { uploadMode = WriteMode.OVERWRITE; } else { uploadMode = WriteMode.ADD; } uploadedFile = client.files().uploadBuilder(dropboxPath).withMode(uploadMode).uploadAndFinish(inputStream, inputFile.length()); return uploadedFile; } finally { IOHelper.close(inputStream); } }
Source:
<code>public void checkIPAdress() { Set<ConstraintViolation<VmNic>> validate = validator.validate(createVmNic(), groups); assertEquals(validMacAddress, validate.isEmpty()); if (validMacAddress) { assertTrue(validate.isEmpty()); } else { assertEquals(1, validate.size()); <START> assertTrue(validate.iterator().next().getMessage().equals(message)); <END> } }</code><technical_language>assertEquals</technical_language>

Target:
public void checkIPAdress() { Set<ConstraintViolation<VmNic>> validate = validator.validate(createVmNic(), groups); assertEquals(validMacAddress, validate.isEmpty()); if (validMacAddress) { assertTrue(validate.isEmpty()); } else { assertEquals(1, validate.size()); assertEquals(message, validate.iterator().next().getMessage()); } }
Source:
<code>public static Map<String,Set<String>> addTagToTags(Map<String, Set<String>> tags, String name, String value) { if(tags == null){ tags = new HashMap<>(); } Set<String> values; <START> if(!tags.containsKey(name)){ values = new HashSet<>(); }else{ values = tags.get(name); } values.add(value); tags.put(name, values); <END> return tags; }</code><technical_language>simpler more readable java if(!tags.containsKey(name)){ tags.put(name, new HashSet<>()); } tags.get(name).add(value);</technical_language>

Target:
public static Map<String,Set<String>> addTagToTags(Map<String, Set<String>> tags, String name, String value) { if(tags == null){ tags = new HashMap<>(); } if(!tags.containsKey(name)){ tags.put(name, new HashSet<>()); } tags.get(name).add(value); return tags; }
Source:
<code>private static Object getValueFromRow(final Row row, final String column) { if (column.equals(ColumnHolder.TIME_COLUMN_NAME)) { return row.getTimestampFromEpoch(); } else { Object raw = row.getRaw(column); if (raw instanceof List) { <START> return ExpressionSelectors.coerceListDimToStringArray((List) raw); <END> } return raw; } }</code><technical_language>Is fair assume Lists Lists of Strings? if expression selector returns a long array</technical_language>

Target:
private static Object getValueFromRow(final Row row, final String column) { if (column.equals(ColumnHolder.TIME_COLUMN_NAME)) { return row.getTimestampFromEpoch(); } else { Object raw = row.getRaw(column); if (raw instanceof List) { return ExpressionSelectors.coerceListToArray((List) raw); } return raw; } }
Source:
<code>public SyncHash.Tree getTreeHash(@Context UriInfo uriInfo) throws Exception { CanonicalPath path = CanonicalPath.fromPartiallyUntypedString(getPath(uriInfo, "/treeHash".length()), getTenantPath(), AbstractElement.class); <START> if (path.getSegment().getElementType() == SegmentType.e) { <END> throw new BadRequestException("Cannot get treeHash for environment"); } return inventory.inspect(path, Synced.Single.class).treeHash(); }</code><technical_language>Another non-synced type is tenant. A generic test for this, would, I guess, like: java Syncable.class.isAssignableFrom(Inventory.types().byPath(path).getElementType())</technical_language>

Target:
public SyncHash.Tree getTreeHash(@Context UriInfo uriInfo) throws Exception { CanonicalPath path = CanonicalPath.fromPartiallyUntypedString(getPath(uriInfo, "/treeHash".length()), getTenantPath(), AbstractElement.class); Class<?> eltType = Inventory.types().byPath(path).getElementType(); if (!Syncable.class.isAssignableFrom(eltType)) { throw new BadRequestException("Element not syncable - cannot get treeHash for path " + path); } return inventory.inspect(path, Synced.Single.class).treeHash(); }
Source:
<code>public static Map<SimpleString, Consumer> groupMap(int groupBuckets) { if (groupBuckets == -1) { <START> return new HashMap<>(); <END> } else if (groupBuckets == 0) { return new NoOpMap<>(); } else { return new BucketMap<>(groupBuckets); } }</code><technical_language>IntObjMap</technical_language>

Target:
public static MessageGroups<Consumer> groupMap(int groupBuckets) { if (groupBuckets == -1) { return new SimpleMessageGroups<>(); } else if (groupBuckets == 0) { return DisabledMessageGroups.instance(); } else { return new BucketMessageGroups<>(groupBuckets); } }
Source:
<code>public static BinLogPositionSourceOffset parse(String offset) { String[] a = offset.split(":"); String filename = a[0]; <START> long position = Long.valueOf(a[1]); <END> return new BinLogPositionSourceOffset(filename, position); }</code><technical_language>prefer Long.parseLong() require unboxing</technical_language>

Target:
public static BinLogPositionSourceOffset parse(String offset) { String[] a = offset.split(":"); String filename = a[0]; long position = Long.parseLong(a[1]); return new BinLogPositionSourceOffset(filename, position); }
Source:
<code>public AppiumParallelMethodTestListener() throws Exception { try { reportManager = new ReportManager(); appiumServerManager = new AppiumServerManager(); prop = ConfigFileManager.getInstance(); deviceAllocationManager = DeviceAllocationManager.getInstance(); appiumDriverManager = new AppiumDriverManager(); mongoDbUrl = CapabilityManager.getInstance() <START> .getMongoDbHostAndPort().get("atdHost"); <END> mongoDbPort = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdPort"); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>ATDServiceHost</technical_language>

Target:
public AppiumParallelMethodTestListener() throws Exception { try { reportManager = new ReportManager(); appiumServerManager = new AppiumServerManager(); deviceAllocationManager = DeviceAllocationManager.getInstance(); appiumDriverManager = new AppiumDriverManager(); atdHost = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdHost"); atdPort = CapabilityManager.getInstance() .getMongoDbHostAndPort().get("atdPort"); } catch (IOException e) { e.printStackTrace(); } }
Source:
<code>protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { <START> ITmfEventAspect<?> groupAspect = TmfTraceUtils.getEventAspectOfClassForEvent(event.getTrace(), Objects.requireNonNull(groupClass), event); <END> if (groupAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, groupClass.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(groupAspect.resolve(event))); } } handleCounterAspect(event, ss, aspect, quark); }</code><technical_language>lookup in multimap</technical_language>

Target:
protected void handleGroupedCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { int quark = rootQuark; for (Class<? extends ITmfEventAspect<?>> groupClass : aspect.getGroups()) { ITmfEventAspect<?> parentAspect = fAspectImpls.get(groupClass); if (parentAspect != null) { quark = ss.getQuarkRelativeAndAdd(quark, parentAspect.getName()); quark = ss.getQuarkRelativeAndAdd(quark, String.valueOf(parentAspect.resolve(event))); } } handleCounterAspect(event, ss, aspect, quark); }
Source:
<code>public MockitoSessionBuilder strictness(Strictness strictness) { <START> if (strictness==null){ <END> strictness = STRICT_STUBS; } this.strictness = strictness; return this; }</code><technical_language>Spaces ==</technical_language>

Target:
public MockitoSessionBuilder strictness(Strictness strictness) { this.strictness = strictness; return this; }
Source:
<code>public void end() { if (isInTransaction()) { if (transactionType().equals(WRITE)) { log.warn("end() called for WRITE transaction without commit or abort having been called causing a forced abort"); _abort() ; } finishTransaction(); <START> return ; <END> } }</code><technical_language>"naked" return here</technical_language>

Target:
public void end() { if (isInTransaction()) { if (transactionType().equals(WRITE)) { log.warn("end() called for WRITE transaction without commit or abort having been called causing a forced abort"); _abort() ; } else { _end() ; } finishTransaction(); } }
Source:
<code><START> public Boolean getIsDeleted() { <END> return isDeleted; }</code><technical_language>@tumijacob a biggie, this method return remain original primitive boolean. do prefer primitives - a concern original is a primitive null</technical_language>

Target:
public boolean getIsDeleted() { return isDeleted; }
Source:
<code>public void writeData(ObjectDataOutput out) throws IOException { out.writeLong(creationTime); out.writeLong(expirationTime); out.writeLong(lastAccessTime); out.writeLong(accessHit); out.writeData(key); out.writeData(value); if (out.getVersion().isGreaterOrEqual(Version.of("3.11"))) { <START> out.writeData(expiryPolicy); <END> } }</code><technical_language>constant Versions instead</technical_language>

Target:
public void writeData(ObjectDataOutput out) throws IOException { out.writeLong(creationTime); out.writeLong(expirationTime); out.writeLong(lastAccessTime); out.writeLong(accessHit); out.writeData(key); out.writeData(value); if (out.getVersion().isGreaterOrEqual(Versions.V3_11)) { out.writeData(expiryPolicy); } }
Source:
<code>public DatalakeDrStatusResponse getRestoreStatusByRestoreId(String datalakeName, String restoreId, String actorCrn) { checkNotNull(datalakeName); checkNotNull(actorCrn); checkNotNull(restoreId); <START> actorCrn = "crn:altus:iam:us-west-1:9d74eee4-1cad-45d7-b645-7ccf9edbb73d:user:8d1e890c-8a2e-4cf9-96bd-d50478bc027e"; <END> datalakeName = "biglauer-az-dr-4-dl"; try (ManagedChannelWrapper channelWrapper = makeWrapper()) { RestoreDatalakeStatusRequest.Builder builder = RestoreDatalakeStatusRequest.newBuilder() .setDatalakeName(datalakeName); return statusConverter.convert( newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn) .restoreDatalakeStatus(builder.build()) ); } }</code><technical_language>I guess removed</technical_language>

Target:
public DatalakeDrStatusResponse getRestoreStatusByRestoreId(String datalakeName, String restoreId, String actorCrn) { if (!datalakeDrConfig.isConfigured()) { return missingConnectorResponse(); } checkNotNull(datalakeName); checkNotNull(actorCrn); checkNotNull(restoreId); try (ManagedChannelWrapper channelWrapper = makeWrapper()) { RestoreDatalakeStatusRequest.Builder builder = RestoreDatalakeStatusRequest.newBuilder() .setDatalakeName(datalakeName) .setRestoreId(restoreId); return statusConverter.convert( newStub(channelWrapper.getChannel(), UUID.randomUUID().toString(), actorCrn) .restoreDatalakeStatus(builder.build()) ); } }
Source:
<code>private void logSkippedTypes() { <START> List<Type> skippedTypes = getSkippedTypes(); if (skippedTypes.isEmpty()) { return; } List<String> skippedTypesAsStrings = skippedTypes.stream().map(Type::toString).collect(Collectors.toList()); getLog().info("Formatting is skipped for types: " + String.join(", ", skippedTypesAsStrings)); <END> }</code><technical_language>suggestion List<Type> skippedTypes = getSkippedTypes(); if (skippedTypes.isEmpty()) { return; } String skippedTypes = skippedTypes.stream().map(Type::toString).collect(Collectors.joining(", ")); getLog().info("Formatting is skipped for types: " + skippedTypes);</technical_language>

Target:
private void logSkippedTypes() { List<Type> skippedTypes = getSkippedTypes(); if (skippedTypes.isEmpty()) { return; } String skippedTypesStr = skippedTypes.stream().map(Type::toString).collect(Collectors.joining(", ")); getLog().info("Formatting is skipped for types: " + skippedTypesStr); }
Source:
<code><START> public @NonNull PersistedList<BranchSource> getSourcesList() { <END> return sources; }</code><technical_language>in middle :bug: code style</technical_language>

Target:
public PersistedList<BranchSource> getSourcesList() { return sources; }
Source:
<code>public RxDocumentServiceResponse(StoreResponse response) { String[] headerNames = response.getResponseHeaderNames(); String[] headerValues = response.getResponseHeaderValues(); <START> this.headersMap = new HttpHeaders(); <END> for (int i = 0; i < headerNames.length; i++) { headersMap.put(headerNames[i], headerValues[i]); } this.statusCode = response.getStatus(); this.storeResponse = response; }</code><technical_language>previously do this this.headersMap = new HashMap<>(headerNames.length); prevented growing hashmap. this perf impact</technical_language>

Target:
public RxDocumentServiceResponse(StoreResponse response) { this.statusCode = response.getStatus(); this.storeResponse = response; this.headersMap = response.getHeaders(); }
Source:
<code>public static GlusterBrickEntity findBrick(Collection<GlusterBrickEntity> bricks, Guid serverId, String brickDir) { <START> for (GlusterBrickEntity brick : bricks) { <END> if (brick.getServerId() != null && brick.getServerId().equals(serverId) && brick.getBrickDirectory().equals(brickDir)) { return brick; } } return null; }</code><technical_language>ObjectUtils.objectsEqual(a, b) here</technical_language>

Target:
public static GlusterBrickEntity findBrick(Collection<GlusterBrickEntity> bricks, Guid serverId, String brickDir) { for (GlusterBrickEntity brick : bricks) { if (Objects.equals(brick.getServerId(), serverId) && brick.getBrickDirectory().equals(brickDir)) { return brick; } } return null; }
Source:
<code>protected RemoteCallback<List<String>> getRemoteCallback(Consumer<List<KieAssetsDropdownItem>> assetListConsumer) { return response -> { List<KieAssetsDropdownItem> toAccept = response.stream() .map(this::getKieAssetsDropdownItem) <START> .filter(this::filterTargetDirectory) <END> .sorted(Comparator.comparing(KieAssetsDropdownItem::getText, String.CASE_INSENSITIVE_ORDER)) .collect(Collectors.toList()); assetListConsumer.accept(toAccept); }; }</code><technical_language>Is a more advanced regexpr [here](<LINK_0> instead of filter target after? I expect enough similar src/**/*.*dmn</technical_language>

Target:
protected RemoteCallback<List<String>> getRemoteCallback(Consumer<List<KieAssetsDropdownItem>> assetListConsumer) { return response -> { List<KieAssetsDropdownItem> toAccept = response.stream() .map(this::getKieAssetsDropdownItem) .sorted(Comparator.comparing(KieAssetsDropdownItem::getText, String.CASE_INSENSITIVE_ORDER)) .collect(Collectors.toList()); assetListConsumer.accept(toAccept); }; }
Source:
<code>private static ValueMismatch of(Message expected, Message actual, Message newValue, int version) { <START> checkNotNull(expected); <END> checkNotNull(actual); checkNotNull(newValue); final ValueMismatch.Builder builder = ValueMismatch.newBuilder() .setExpected(pack(expected)) .setActual(pack(actual)) .setNewValue(pack(newValue)) .setVersion(version); return builder.build(); }</code><technical_language>do do for a private static method? I a common issue code changes. Please address</technical_language>

Target:
private static ValueMismatch of(Message expected, Message actual, Message newValue, int version) { final ValueMismatch.Builder builder = ValueMismatch.newBuilder() .setExpected(pack(expected)) .setActual(pack(actual)) .setNewValue(pack(newValue)) .setVersion(version); return builder.build(); }
Source:
<code><START> private static StringBuilder getQueryFilteringExpression(boolean hasUser, boolean hasTag, <END> boolean hasDateFrom, boolean hasDateTo, SortSpecifierContainer sortParams) { StringBuilder result = new StringBuilder(); result.append("T.jobData.removedTime = -1 "); if (hasDateFrom && hasDateTo) { result.append("and ( ( startTime >= :dateFrom and startTime <= :dateTo ) " + "or ( scheduledTime >= :dateFrom and scheduledTime <= :dateTo ) " + "or ( finishedTime >= :dateFrom and finishedTime <= :dateTo ) ) "); } else if (hasDateFrom && !hasDateTo) { result.append("and ( startTime >= :dateFrom or finishedTime >= :dateFrom or scheduledTime >= :dateFrom ) "); } else if (!hasDateFrom && hasDateTo) { result.append("and ( startTime <= :dateTo or finishedTime <= :dateTo or scheduledTime >= :dateTo ) "); } else { } if (hasUser) { result.append("and T.jobData.owner = :user "); } if (hasTag) { result.append("and tag = :taskTag "); } result.append("and taskStatus in (:taskStatus) "); if (sortParams != null && !sortParams.getSortParameters().isEmpty()) { result.append("order by "); List<SortSpecifierContainer.SortSpecifierItem> items = sortParams.getSortParameters(); for (int i = 0; i < items.size(); i++) { SortSpecifierContainer.SortSpecifierItem item = items.get(i); String order = "ascending".compareTo(item.getOrder().toString()) == 0 ? "ASC" : "DESC"; result.append("T." + item.getField() + " " + order); if (i < items.size() - 1) result.append(","); } result.append(" "); } return result; }</code><technical_language>![MAJOR](<LINK_0> Cyclomatic Complexity of this method "getQueryFilteringExpression" is 13 is greater 10 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static StringBuilder getQueryFilteringExpression(boolean hasUser, boolean hasTag, boolean hasDateFrom, boolean hasDateTo, SortSpecifierContainer sortParams) { StringBuilder result = new StringBuilder(); result.append("T.jobData.removedTime = -1 "); if (hasDateFrom && hasDateTo) { result.append("and ( ( startTime >= :dateFrom and startTime <= :dateTo ) " + "or ( scheduledTime >= :dateFrom and scheduledTime <= :dateTo ) " + "or ( finishedTime >= :dateFrom and finishedTime <= :dateTo ) ) "); } else if (hasDateFrom && !hasDateTo) { result.append("and ( startTime >= :dateFrom or finishedTime >= :dateFrom or scheduledTime >= :dateFrom ) "); } else if (!hasDateFrom && hasDateTo) { result.append("and ( startTime <= :dateTo or finishedTime <= :dateTo or scheduledTime >= :dateTo ) "); } else { } if (hasUser) { result.append("and T.jobData.owner = :user "); } if (hasTag) { result.append("and tag = :taskTag "); } result.append("and taskStatus in (:taskStatus) "); if (!sortParams.getSortParameters().isEmpty()) { result.append("order by "); List<SortSpecifierContainer.SortSpecifierItem> items = sortParams.getSortParameters(); for (int i = 0; i < items.size(); i++) { SortSpecifierContainer.SortSpecifierItem item = items.get(i); String order = "ascending".compareTo(item.getOrder().toString()) == 0 ? "ASC" : "DESC"; result.append("T." + item.getField() + " " + order); if (i < items.size() - 1) result.append(","); } result.append(" "); } return result; }
Source:
<code>public void testLayerEnabledServiceResponse() throws Exception { enableWFS(); String layerName = "cite:RoadSegments"; LayerInfo linfo = getCatalog().getLayerByName(layerName); ResourceInfo ri = linfo.getResource(); ri.setServiceConfiguration(false); <START> ri.setDisabledServices(new ArrayList<>()); <END> getCatalog().save(ri); getCatalog().save(linfo); Document doc = getAsDOM( "wfs?request=GetFeature&typeName=" + layerName + "&version=1.0.0&service=wfs"); assertXpathEvaluatesTo("1", "count( }</code><technical_language>If need manually clear end of test, a manual System.setProperty a @After call a System.clearProperty... not</technical_language>

Target:
public void testLayerEnabledServiceResponse() throws Exception { enableWFS(); String layerName = "cite:RoadSegments"; FeatureTypeInfo ftinfo = getCatalog().getFeatureTypeByName(layerName); ftinfo.setServiceConfiguration(false); ftinfo.setDisabledServices(new ArrayList<>()); getCatalog().save(ftinfo); Document doc = getAsDOM( "wfs?request=GetFeature&typeName=" + layerName + "&version=1.0.0&service=wfs"); assertXpathEvaluatesTo("1", "count( doc = getAsDOM("wfs?service=WFS&version=1.1.0&request=getCapabilities"); XMLAssert.assertXpathExists( " }
Source:
<code>public static boolean isJava8BelowUpdate45() { <START> if(!JAVA_VERSION.equals("1.8")) { <END> return false; } int beginIndex = JVM_VERSION.indexOf('_'); int endIndex = JVM_VERSION.indexOf('b'); if(beginIndex == -1 || endIndex == -1) { return false; } String updateVersion = JVM_VERSION.substring(beginIndex + 1, endIndex - 1); return 45 > Integer.valueOf(updateVersion); }</code><technical_language>Space if</technical_language>

Target:
public static boolean isJava8BelowUpdate45() { return isJava8BelowUpdate45(JVM_VERSION); }
Source:
<code>public static void beforeClass() { ports = AvailablePortHelper.getRandomAvailableTCPPorts(2); Properties redisProps = new Properties(); <START> redisProps.put(DistributionConfig.REDIS_BIND_ADDRESS_NAME, "localhost"); <END> MemberVM locator = cluster.startLocatorVM(0); redisProps.put(DistributionConfig.REDIS_PORT_NAME, Integer.toString(ports[0])); server1 = cluster.startServerVM(1, redisProps, locator.getPort()); redisProps.put(DistributionConfig.REDIS_PORT_NAME, Integer.toString(ports[1])); server2 = cluster.startServerVM(2, redisProps, locator.getPort()); }</code><technical_language>internal properties? Redis module set of public properties</technical_language>

Target:
public static void beforeClass() { ports = AvailablePortHelper.getRandomAvailableTCPPorts(2); Properties redisProps = new Properties(); redisProps.put(ConfigurationProperties.REDIS_BIND_ADDRESS, "localhost"); MemberVM locator = cluster.startLocatorVM(0); redisProps.put(ConfigurationProperties.REDIS_PORT, Integer.toString(ports[0])); server1 = cluster.startServerVM(1, redisProps, locator.getPort()); redisProps.put(ConfigurationProperties.REDIS_PORT, Integer.toString(ports[1])); server2 = cluster.startServerVM(2, redisProps, locator.getPort()); }
Source:
<code>public boolean isMissingHookConflict() { <START> return (this.conflictStatus & MISSING_HOOK.getValue()) == MISSING_HOOK.getValue(); <END> }</code><technical_language>avoid this in cases</technical_language>

Target:
public boolean isMissingHookConflict() { return (conflictStatus & MISSING_HOOK.getValue()) == MISSING_HOOK.getValue(); }
Source:
<code>public Response getRowStats( @Context final HttpServletRequest req, @QueryParam("full") String full ) { IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper); Map<String, Object> returnMap = Maps.newHashMap(); Map<String, Object> totalsMap = Maps.newHashMap(); Map<String, Object> averagesMap = Maps.newHashMap(); boolean needsDeterminePartitions = false; boolean needsBuildSegments = false; if (full != null) { needsDeterminePartitions = true; needsBuildSegments = true; } else { switch (ingestionState) { case DETERMINE_PARTITIONS: needsDeterminePartitions = true; break; case BUILD_SEGMENTS: case COMPLETED: needsBuildSegments = true; break; default: break; } } if (needsDeterminePartitions) { if (determinePartitionsMeters != null) { totalsMap.put( "determinePartitions", determinePartitionsMeters.getTotals() ); averagesMap.put( "determinePartitions", determinePartitionsMeters.getMovingAverages() ); } } if (needsBuildSegments) { if (buildSegmentsMeters != null) { totalsMap.put( "buildSegments", buildSegmentsMeters.getTotals() ); averagesMap.put( "buildSegments", buildSegmentsMeters.getMovingAverages() ); } } returnMap.put("totals", totalsMap); <START> returnMap.put("averages", averagesMap); <END> return Response.ok(returnMap).build(); }</code><technical_language>movingAverages</technical_language>

Target:
public Response getRowStats( @Context final HttpServletRequest req, @QueryParam("full") String full ) { IndexTaskUtils.datasourceAuthorizationCheck(req, Action.READ, getDataSource(), authorizerMapper); Map<String, Object> returnMap = Maps.newHashMap(); Map<String, Object> totalsMap = Maps.newHashMap(); Map<String, Object> averagesMap = Maps.newHashMap(); boolean needsDeterminePartitions = false; boolean needsBuildSegments = false; if (full != null) { needsDeterminePartitions = true; needsBuildSegments = true; } else { switch (ingestionState) { case DETERMINE_PARTITIONS: needsDeterminePartitions = true; break; case BUILD_SEGMENTS: case COMPLETED: needsBuildSegments = true; break; default: break; } } if (needsDeterminePartitions) { totalsMap.put( RowIngestionMeters.DETERMINE_PARTITIONS, determinePartitionsMeters.getTotals() ); averagesMap.put( RowIngestionMeters.DETERMINE_PARTITIONS, determinePartitionsMeters.getMovingAverages() ); } if (needsBuildSegments) { totalsMap.put( RowIngestionMeters.BUILD_SEGMENTS, buildSegmentsMeters.getTotals() ); averagesMap.put( RowIngestionMeters.BUILD_SEGMENTS, buildSegmentsMeters.getMovingAverages() ); } returnMap.put("totals", totalsMap); returnMap.put("movingAverages", averagesMap); return Response.ok(returnMap).build(); }
Source:
<code>private static void attach(String cameraId, UseCase useCase) { <START> checkInitialized(); BaseCamera camera = sCameraX.getCameraRepository().getCamera(cameraId); <END> if (camera == null) { throw new IllegalArgumentException("Invalid camera: " + cameraId); } useCase.addStateChangeListener(camera); useCase.attachCameraControl(cameraId, camera.getCameraControlInternal()); }</code><technical_language>checkInitialized() sCameraX in this guarantee thread safety. need consider synchronizing access sCameraX. want move this synchronization checkInitialized return CameraX instance. operate local-scoped CameraX instance</technical_language>

Target:
private static void attach(String cameraId, UseCase useCase) { CameraX cameraX = checkInitialized(); BaseCamera camera = cameraX.getCameraRepository().getCamera(cameraId); if (camera == null) { throw new IllegalArgumentException("Invalid camera: " + cameraId); } useCase.addStateChangeListener(camera); useCase.attachCameraControl(cameraId, camera.getCameraControlInternal()); }
Source:
<code>public OAuthClientService getOAuthClientService(String handle) { OAuthClientServiceImpl clientImpl = null; try { clientImpl = oauthClientServiceCache.get(handle); if (clientImpl == null || clientImpl.isClosed()) { clientImpl = OAuthClientServiceImpl.getInstance(handle, oAuthStoreHandler, tokenExpiresInBuffer, httpClientFactory); oauthClientServiceCache.put(handle, clientImpl); } } catch (OAuthException e) { <START> logger.error("Cannot get OAuth client service by handle {}", handle, e); <END> } return clientImpl; }</code><technical_language>Null expected return value, if is handle - logging DEBUG level do ERROR here. Alternatively, change method signature throw OAuthException, callers deal it</technical_language>

Target:
public OAuthClientService getOAuthClientService(String handle) throws OAuthException { OAuthClientServiceImpl clientImpl = null; clientImpl = oauthClientServiceCache.get(handle); if (clientImpl == null || clientImpl.isClosed()) { clientImpl = OAuthClientServiceImpl.getInstance(handle, oAuthStoreHandler, tokenExpiresInBuffer, httpClientFactory); oauthClientServiceCache.put(handle, clientImpl); } return clientImpl; }
Source:
<code>public void getNext(JCas aJCas) throws IOException, CollectionException { Resource res = nextFile(); initCas(aJCas, res); InputStream is = null; try { is = new BufferedInputStream(res.getInputStream()); Iterable<CSVRecord> records = CSVFormat.DEFAULT.withIgnoreHeaderCase() .parse(new InputStreamReader(is, "UTF-8")); List<String> headers = new ArrayList<>(); for (CSVRecord record : records) { if (headers.isEmpty()) { String documentName = record.get(0); String annotator = record.get(1); headers.add(documentName); headers.add(annotator); for (int c = 2; c < record.size(); c++) { headers.add(record.get(c)); } } else { String text = record.get(record.size() - 1); if (null != text && null == aJCas.getDocumentText()) { aJCas.setDocumentText(text); } createCodebookAnnotations(aJCas, headers, record); } } } catch (Exception e) { throw new CollectionException(e); } <START> finally { <END> closeQuietly(is); } }</code><technical_language>try-with-resources</technical_language>

Target:
public void getNext(JCas aJCas) throws IOException, CollectionException { Resource res = nextFile(); initCas(aJCas, res); try (InputStream is = new BufferedInputStream(res.getInputStream())) { Iterable<CSVRecord> records = CSVFormat.DEFAULT.withIgnoreHeaderCase() .parse(new InputStreamReader(is, "UTF-8")); List<String> headers = new ArrayList<>(); for (CSVRecord record : records) { if (headers.isEmpty()) { String documentName = record.get(0); String annotator = record.get(1); headers.add(documentName); headers.add(annotator); for (int c = 2; c < record.size(); c++) { headers.add(record.get(c)); } } else { String text = record.get(record.size() - 1); if (null != text && null == aJCas.getDocumentText()) { aJCas.setDocumentText(text); } createCodebookAnnotations(aJCas, headers, record); } } } catch (Exception e) { throw new CollectionException(e); } }
Source:
<code>private boolean isVmRunning(VM vm) { <START> return vm != null && vm.getStatus() == VMStatus.Up && <END> vm.getRunOnVds() != null && !vm.getRunOnVds().equals(Guid.Empty); }</code><technical_language>get vm == null, removed here</technical_language>

Target:
private boolean isVmRunning(VM vm) { return vm.getStatus() == VMStatus.Up && vm.getRunOnVds() != null && !vm.getRunOnVds().equals(Guid.Empty); }
Source:
<code>private Group createAuthenticationGroup(final Composite parent) { final Group g = createGroup(parent, UIText.RepositorySelectionPage_groupAuthentication); newLabel(g, UIText.RepositorySelectionPage_promptUser + ":"); userText = new Text(g, SWT.BORDER); userText.setLayoutData(createFieldGridData()); userText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { Protocol protocol = getProtocol(); if (protocol != Protocol.HTTP && protocol != Protocol.HTTPS) setURI(uri.setUser(nullString(userText.getText()))); user = userText.getText(); } }); newLabel(g, UIText.RepositorySelectionPage_promptPassword + ":"); passText = new Text(g, SWT.BORDER | SWT.PASSWORD); passText.setLayoutData(createFieldGridData()); passText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { setURI(uri.setPass(null)); password = passText.getText(); } }); storeCheckbox = new Button(g, <START> SWT.CHECK); storeCheckbox <END> .setText(UIText.RepositorySelectionPage_storeInSecureStore); storeCheckbox.setSelection(storeInSecureStore); storeCheckbox.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } }); return g; }</code><technical_language>completely unrelated, if add GridDataFactory.fillDefaults().span(2, 1).applyTo(storeCheckbox); here, layout of authentication box improved a lot. labels wide checkbox underneath, wide widest of 2 labels</technical_language>

Target:
private Group createAuthenticationGroup(final Composite parent) { final Group g = createGroup(parent, UIText.RepositorySelectionPage_groupAuthentication); newLabel(g, UIText.RepositorySelectionPage_promptUser + ":"); userText = new Text(g, SWT.BORDER); userText.setLayoutData(createFieldGridData()); userText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { Protocol protocol = getProtocol(); if (protocol != Protocol.HTTP && protocol != Protocol.HTTPS) setURI(uri.setUser(nullString(userText.getText()))); user = userText.getText(); } }); newLabel(g, UIText.RepositorySelectionPage_promptPassword + ":"); passText = new Text(g, SWT.BORDER | SWT.PASSWORD); passText.setLayoutData(createFieldGridData()); passText.addModifyListener(new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { setURI(uri.setPass(null)); password = passText.getText(); } }); storeCheckbox = new Button(g, SWT.CHECK); GridDataFactory.fillDefaults().span(2, 1).applyTo(storeCheckbox); storeCheckbox .setText(UIText.RepositorySelectionPage_storeInSecureStore); storeCheckbox.setSelection(storeInSecureStore); storeCheckbox.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { storeInSecureStore = storeCheckbox.getSelection(); } }); return g; }
Source:
<code>public boolean inIndex(String path) throws IOException { String repoPath = getRepoRelativePath(path); DirCache dc = DirCache.read(repository.getIndexFile(), repository.getFS()); DirCacheEntry dcEntry = dc.getEntry(repoPath); if (dcEntry == null) return false; Ref headRef = repository.getRef(HEAD); RevCommit commit = new RevWalk(repository).parseCommit(headRef.getObjectId()); TreeWalk tw = TreeWalk.forPath(repository, repoPath, commit.getTree()); <START> return tw == null || !dcEntry.getObjectId().equals(tw.getObjectId(0)); <END> }</code><technical_language>change semantics of this method. Interestingly test cases work. implementation method name said. index contains repository tree staged files (<LINK_0> Please introduce a new method, isStaged, returns true if index content differs repo content</technical_language>

Target:
public boolean inIndex(String path) throws IOException { String repoPath = getRepoRelativePath(path); DirCache dc = DirCache.read(repository.getIndexFile(), repository.getFS()); return dc.getEntry(repoPath) != null; }
Source:
<code><START> public boolean add(VmNetworkInterface iface, CompensationContext compensationContext, boolean allocateMac) { <END> boolean macAdded = false; if (!allocateMac && getMacPoolManager().IsMacInUse(iface.getMacAddress())) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr", iface.getMacAddress()); logable.AddCustomValue("VmName", iface.getVmName()); log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE); } else { if (allocateMac) { iface.setMacAddress(MacPoolManager.getInstance().allocateNewMac()); } macAdded = getMacPoolManager().AddMac(iface.getMacAddress()); } getVmNetworkInterfaceDAO().save(iface); getVmNetworkStatisticsDAO().save(iface.getStatistics()); compensationContext.snapshotNewEntity(iface); compensationContext.snapshotNewEntity(iface.getStatistics()); return macAdded; }</code><technical_language>added a parameter this command is other places, this compilation failures</technical_language>

Target:
public boolean add(VmNetworkInterface iface, CompensationContext compensationContext, boolean allocateMac) { boolean macAdded = false; if (!allocateMac && getMacPoolManager().IsMacInUse(iface.getMacAddress())) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("MACAddr", iface.getMacAddress()); logable.AddCustomValue("VmName", iface.getVmName()); log(logable, AuditLogType.MAC_ADDRESS_IS_IN_USE); } else { if (allocateMac) { iface.setMacAddress(getMacPoolManager().allocateNewMac()); macAdded = true; } else { macAdded = getMacPoolManager().AddMac(iface.getMacAddress()); } } getVmNetworkInterfaceDAO().save(iface); getVmNetworkStatisticsDAO().save(iface.getStatistics()); compensationContext.snapshotNewEntity(iface); compensationContext.snapshotNewEntity(iface.getStatistics()); return macAdded; }