auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Filter newCorsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.setAllowedOrigins(stormpathCorsAllowedOrigins()); config.setAllowedHeaders(Arrays.asList("Content-Type", "Accept", "X-Requested-With", "remember-me")); <START> config.setAllowedMethods(Arrays.asList("POST", "GET", "OPTIONS", "DELETE")); <END> source.registerCorsConfiguration("/**", config); return new CorsFilter(source); }</code><technical_language>this configurable</technical_language>

Target:
public Filter newCorsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(true); config.setAllowedOrigins(stormpathCorsAllowedOrigins()); config.setAllowedHeaders(stormpathCorsAllowedHeaders()); config.setAllowedMethods(stormpathCorsAllowedMethods()); source.registerCorsConfiguration("/**", config); return new CorsFilter(source); }
Source:
<code>public void cacheUpdateNewerResponse() throws Exception { final Map<String, String> headers = Collections.singletonMap( LastModifiedCachingWire.LAST_MODIFIED, LastModifiedCachingWireTest.LONG_AGO ); final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, headers.entrySet(), BODY.getBytes() ) ) .next(new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_MODIFIED)) .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, headers.entrySet(), BODY_UPDATED.getBytes() ) ) .next(new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_MODIFIED)) .start(); try { final Request req = new JdkRequest(container.home()) .through(LastModifiedCachingWire.class); for (int idx = 0; idx < 2; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) <START> .assertBody(Matchers.equalTo(BODY)); <END> } for (int idx = 0; idx < 2; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody(Matchers.equalTo(BODY_UPDATED)); } MatcherAssert.assertThat( container.queries(), Matchers.equalTo(2 + 2) ); } finally { container.stop(); } }</code><technical_language>@piddubnyi full path for static variables</technical_language>

Target:
public void cacheUpdateNewerResponse() throws Exception { final Map<String, String> headers = Collections.singletonMap( LastModifiedCachingWire.LAST_MODIFIED, "Wed, 16 Nov 1995 04:58:08 GMT" ); final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, headers.entrySet(), LastModifiedCachingWireTest.BODY.getBytes() ) ) .next(new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_MODIFIED)) .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, headers.entrySet(), LastModifiedCachingWireTest.BODY_UPDATED.getBytes() ) ) .next(new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_MODIFIED)) .start(); try { final Request req = new JdkRequest(container.home()) .through(LastModifiedCachingWire.class); for (int idx = 0; idx < 2; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody( Matchers.equalTo(LastModifiedCachingWireTest.BODY) ); } for (int idx = 0; idx < 2; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody( Matchers.equalTo( LastModifiedCachingWireTest.BODY_UPDATED ) ); } MatcherAssert.assertThat( container.queries(), Matchers.equalTo(2 + 2) ); } finally { container.stop(); } }
Source:
<code>public Poller<CertificateOperation> createCertificate(String name, CertificatePolicy policy, Map<String, String> tags) { <START> return new Poller<CertificateOperation>(Duration.ofSeconds(1), createPollOperation(name), actvationOperation(name, policy, tags), cancelOperation(name)); <END> }</code><technical_language>Polling second</technical_language>

Target:
public Poller<CertificateOperation> createCertificate(String name, CertificatePolicy policy, Map<String, String> tags) { return new Poller<CertificateOperation>(Duration.ofSeconds(1), createPollOperation(name), activationOperation(name, policy, tags), cancelOperation(name)); }
Source:
<code>private InterpreterResult executeQuery(String sql) throws IOException { HttpResponse response = prepareRequest(sql); String result; try { int code = response.getStatusLine().getStatusCode(); result = IOUtils.toString(response.getEntity().getContent(), "UTF-8"); if (code != 200) { StringBuilder errorMessage = new StringBuilder("Failed : HTTP error code " + code); logger.error("Failed to execute query: " + result); KylinErrorResponse kylinErrorResponse = KylinErrorResponse.fromJson(result); if (kylinErrorResponse == null) { logger.error("Cannot get json from string: " + result); if (code == 401) { errorMessage.append(". Error message: Unauthorized. This request requires " + "HTTP authentication. Please make sure your have set your credentials" + " correctly."); } else { errorMessage.append(". Error message: " + result); } } else { String exception = kylinErrorResponse.getException(); logger.error("The exception is " + exception); errorMessage.append(". Error message: " + exception); } return new InterpreterResult(InterpreterResult.Code.ERROR, errorMessage.toString()); } <START> } catch (NullPointerException | IOException e) { <END> throw new IOException(e); } return new InterpreterResult(InterpreterResult.Code.SUCCESS, formatResult(result)); }</code><technical_language>NullPointerException happen then, if kylinErrorResponse == null is checked</technical_language>

Target:
private InterpreterResult executeQuery(String sql) throws IOException { HttpResponse response = prepareRequest(sql); String result; try { int code = response.getStatusLine().getStatusCode(); result = IOUtils.toString(response.getEntity().getContent(), "UTF-8"); if (code != 200) { StringBuilder errorMessage = new StringBuilder("Failed : HTTP error code " + code + " ."); logger.error("Failed to execute query: " + result); KylinErrorResponse kylinErrorResponse = KylinErrorResponse.fromJson(result); if (kylinErrorResponse == null) { logger.error("Cannot get json from string: " + result); if (code == 401) { errorMessage.append(" Error message: Unauthorized. This request requires " + "HTTP authentication. Please make sure your have set your credentials " + "correctly."); } else { errorMessage.append(" Error message: " + result + " ."); } } else { String exception = kylinErrorResponse.getException(); logger.error("The exception is " + exception); errorMessage.append(" Error message: " + exception + " ."); } return new InterpreterResult(InterpreterResult.Code.ERROR, errorMessage.toString()); } } catch (NullPointerException | IOException e) { throw new IOException(e); } return new InterpreterResult(InterpreterResult.Code.SUCCESS, formatResult(result)); }
Source:
<code>private synchronized RequestFuture<ByteBuffer> initiateJoinGroup() { if (joinFuture == null) { disableHeartbeatThread(); state = MemberState.REBALANCING; <START> if (lastRebalanceStartMs == -1L) <END> lastRebalanceStartMs = time.milliseconds(); joinFuture = sendJoinGroupRequest(); joinFuture.addListener(new RequestFutureListener<ByteBuffer>() { @Override public void onSuccess(ByteBuffer value) { synchronized (AbstractCoordinator.this) { log.info("Successfully joined group with generation {}", generation.generationId); state = MemberState.STABLE; rejoinNeeded = false; lastRebalanceEndMs = time.milliseconds(); sensors.rebalanceLatency.record(lastRebalanceEndMs - lastRebalanceStartMs); lastRebalanceStartMs = -1L; if (heartbeatThread != null) heartbeatThread.enable(); } } @Override public void onFailure(RuntimeException e) { synchronized (AbstractCoordinator.this) { state = MemberState.UNJOINED; } } }); } return joinFuture; }</code><technical_language>if useful add a "failed rebalances" metric</technical_language>

Target:
private synchronized RequestFuture<ByteBuffer> initiateJoinGroup() { if (joinFuture == null) { disableHeartbeatThread(); state = MemberState.REBALANCING; if (lastRebalanceStartMs == -1L) lastRebalanceStartMs = time.milliseconds(); joinFuture = sendJoinGroupRequest(); joinFuture.addListener(new RequestFutureListener<ByteBuffer>() { @Override public void onSuccess(ByteBuffer value) { synchronized (AbstractCoordinator.this) { log.info("Successfully joined group with generation {}", generation.generationId); state = MemberState.STABLE; rejoinNeeded = false; lastRebalanceEndMs = time.milliseconds(); sensors.successfulRebalanceSensor.record(lastRebalanceEndMs - lastRebalanceStartMs); lastRebalanceStartMs = -1L; if (heartbeatThread != null) heartbeatThread.enable(); } } @Override public void onFailure(RuntimeException e) { synchronized (AbstractCoordinator.this) { state = MemberState.UNJOINED; sensors.failedRebalanceSensor.record(); } } }); } return joinFuture; }
Source:
<code><START> public static Type fromValue(String type) { <END> return types.get(type); }</code><technical_language>In alignment valueOf, name this valueOfType fromType</technical_language>

Target:
public static Type fromValue(String type) { if (type != null) { for (Type value : Type.values()) { if (type.equals(value.type)) { return value; } } return UNRECOGNIZED; } return null; }
Source:
<code>private static <T> ImmutableList<ImmutableList<T>> toImmutables(List<List<T>> lists) { ImmutableList.Builder<ImmutableList<T>> builder = ImmutableList.builder(); for (List<T> innerList : lists) { <START> if (innerList instanceof ImmutableList) { <END> builder.add((ImmutableList<T>) innerList); } else { builder.add(ImmutableList.copyOf(innerList)); } } return builder.build(); }</code><technical_language>need for this logic - Guava anyway. call copyOf. This method reduce a single stream operation</technical_language>

Target:
private static <T> ImmutableList<ImmutableList<T>> toImmutables(List<List<T>> lists) { return lists.stream() .map(ImmutableList::copyOf) .collect(Guavate.toImmutableList()); }
Source:
<code>public Navigator getNavigator() { <START> return BaseUI.getCurrent().getNavigator(); <END> }</code><technical_language>getCurrentNavigator</technical_language>

Target:
public Navigator getNavigator() { return BaseUI.getCurrentNavigator(); }
Source:
<code>private String replaceEscapedLiterals(String resolvedMessage) { resolvedMessage = LEFT_BRACE.matcher(resolvedMessage).replaceAll("{"); resolvedMessage = RIGHT_BRACE.matcher(resolvedMessage).replaceAll("}"); <START> resolvedMessage = SLASH.matcher(resolvedMessage).replaceAll("\\"); <END> resolvedMessage = DOLLAR.matcher(resolvedMessage).replaceAll("$"); return resolvedMessage; }</code><technical_language>I this line test failures. some of them</technical_language>

Target:
private String replaceEscapedLiterals(String resolvedMessage) { resolvedMessage = LEFT_BRACE.matcher(resolvedMessage).replaceAll("{"); resolvedMessage = RIGHT_BRACE.matcher(resolvedMessage).replaceAll("}"); resolvedMessage = SLASH.matcher(resolvedMessage).replaceAll(Matcher.quoteReplacement("\\")); resolvedMessage = DOLLAR.matcher(resolvedMessage).replaceAll(Matcher.quoteReplacement("$")); return resolvedMessage; }
Source:
<code>private void addDepsAndFolder( IJFolderFactory folderFactory, DependencyType dependencyType, TargetNode<T, ?> targetNode, boolean wantsPackagePrefix, ModuleBuildContext context) { ImmutableMultimap<Path, Path> foldersToInputsIndex = getSourceFoldersToInputsIndex(targetNode.getInputs()); <START> if (targetNode.getConstructorArg() instanceof JavaLibraryDescriptionArg) { <END> JavaLibraryDescriptionArg javaLibraryArg = (JavaLibraryDescriptionArg) targetNode.getConstructorArg(); Optional<Path> resourcesRoot = javaLibraryArg.getResourcesRoot(); if (resourcesRoot.isPresent()) { ImmutableSet<Path> resources = javaLibraryArg.getResources().stream() .map(sourcePath -> (sourcePath instanceof PathSourcePath) ? ((PathSourcePath) sourcePath).getRelativePath() : null) .filter(Objects::nonNull) .filter(path -> path.startsWith(resourcesRoot.get())) .collect(MoreCollectors.toImmutableSet()); foldersToInputsIndex = foldersToInputsIndex.entries().stream() .filter(entry -> !resources.contains(entry.getValue())) .collect(MoreCollectors.toImmutableMultimap(Map.Entry::getKey, Map.Entry::getValue)); addSourceFolders( JavaResourceFolder.getFactoryWithResourcesRoot(resourcesRoot.get()), getSourceFoldersToInputsIndex(resources), wantsPackagePrefix, context); } } addSourceFolders(folderFactory, foldersToInputsIndex, wantsPackagePrefix, context); addDeps(foldersToInputsIndex, targetNode, dependencyType, context); addGeneratedOutputIfNeeded(folderFactory, targetNode, context); if (targetNode.getConstructorArg() instanceof JvmLibraryArg) { addAnnotationOutputIfNeeded(folderFactory, targetNode, context); } }</code><technical_language>This needs in JavaLibraryModuleRule</technical_language>

Target:
private void addDepsAndFolder( IJFolderFactory folderFactory, DependencyType dependencyType, TargetNode<T, ?> targetNode, boolean wantsPackagePrefix, ModuleBuildContext context) { addDepsAndFolder( folderFactory, dependencyType, targetNode, wantsPackagePrefix, context, ImmutableSet.of()); }
Source:
<code>private void buildIndexItem(String deweyID, String type, String[] result, String parentPath) { IndexElement test = new IndexElement(deweyID, type, result[1]); String path = test.epath(); path = StringUtils.replace(path, parentPath, ""); parentPath = parentPath.replaceAll("/", "."); if (!type.equals("doc")) { <START> int colon = path.indexOf("/"); <END> path = path.replaceFirst("/", ":"); } else { parentPath = ""; } path = path.replaceAll("/", "."); String fullItem = parentPath + path + "." + test.type(); results.add(new ComplexItem(new StringField("item", fullItem, Field.Store.YES), test.id())); }</code><technical_language>Is colon used</technical_language>

Target:
private void buildIndexItem(String deweyID, String type, String[] result, String parentPath) { IndexElement test = new IndexElement(deweyID, type, result[1]); String path = test.epath(); path = StringUtils.replace(path, parentPath, ""); String luceneParentPath = parentPath.replaceAll("/", "."); if (!type.equals("doc")) { path = path.replaceFirst("/", ":"); } else { luceneParentPath = ""; } path = path.replaceAll("/", "."); String fullItem = luceneParentPath + path + "." + test.type(); results.add(new ComplexItem(new StringField("item", fullItem, Field.Store.YES), test.id())); }
Source:
<code>public void typeProcessingStart() { try { super.typeProcessingStart(); initChecker(); if (this.messager == null) { messager = processingEnv.getMessager(); messager.printMessage( Kind.WARNING, "You have forgotten to call super.initChecker in your " + "subclass of SourceChecker, " + this.getClass() + "! Please ensure your checker is properly initialized."); } if (shouldAddShutdownHook()) { Runtime.getRuntime() .addShutdownHook( new Thread() { @Override public void run() { shutdownHook(); } }); } if (hasOption("version")) { String version = getCheckerVersion(); if (version == null) { messager.printMessage(Kind.NOTE, "Version info not available!"); } else { <START> messager.printMessage(Kind.NOTE, "checker-framework " + version); <END> } } } catch (UserError ce) { logUserError(ce); } catch (TypeSystemError ce) { logTypeSystemError(ce); } catch (BugInCF ce) { logBugInCF(ce); } catch (Throwable t) { logBugInCF(wrapThrowableAsBugInCF("SourceChecker.typeProcessingStart", t, null)); } }</code><technical_language>correct name for Checker Framework</technical_language>

Target:
public void typeProcessingStart() { try { super.typeProcessingStart(); initChecker(); if (this.messager == null) { messager = processingEnv.getMessager(); messager.printMessage( Kind.WARNING, "You have forgotten to call super.initChecker in your " + "subclass of SourceChecker, " + this.getClass() + "! Please ensure your checker is properly initialized."); } if (shouldAddShutdownHook()) { Runtime.getRuntime() .addShutdownHook( new Thread() { @Override public void run() { shutdownHook(); } }); } if (hasOption("version")) { messager.printMessage(Kind.NOTE, "Checker Framework " + getCheckerVersion()); } } catch (UserError ce) { logUserError(ce); } catch (TypeSystemError ce) { logTypeSystemError(ce); } catch (BugInCF ce) { logBugInCF(ce); } catch (Throwable t) { logBugInCF(wrapThrowableAsBugInCF("SourceChecker.typeProcessingStart", t, null)); } }
Source:
<code>public void accept(Model.Update update) { if (DEBUG) Log.d(TAG, "Received model update. Loading=" + mModel.isLoading()); mProgressBar.setVisibility(mModel.isLoading() ? View.VISIBLE : View.GONE); updateLayout(mState.derivedMode); mAdapter.notifyDataSetChanged(); if (mRestoredSelection != null) { mSelectionMgr.restoreSelection(mRestoredSelection); mRestoredSelection = null; } final SparseArray<Parcelable> container = mState.dirConfigs.remove(mLocalState.getConfigKey()); final int curSortedDimensionId = mState.sortModel.getSortedDimensionId(); final SortDimension curSortedDimension = mState.sortModel.getDimensionById(curSortedDimensionId); if (container != null && !getArguments().getBoolean(Shared.EXTRA_IGNORE_STATE, false)) { getView().restoreHierarchyState(container); } else if (mLocalState.mLastSortDimensionId != curSortedDimension.getId() || mLocalState.mLastSortDimensionId == SortModel.SORT_DIMENSION_ID_UNKNOWN || mLocalState.mLastSortDirection != curSortedDimension.getSortDirection()) { mRecView.smoothScrollToPosition(0); } mLocalState.mLastSortDimensionId = curSortedDimension.getId(); mLocalState.mLastSortDirection = curSortedDimension.getSortDirection(); if (mRefreshLayout.isRefreshing()) { new Handler().postDelayed( () -> mRefreshLayout.setRefreshing(false), REFRESH_SPINNER_TIMEOUT); } if (!mModel.isLoading()) { mActivity.notifyDirectoryLoaded( mModel.doc != null ? mModel.doc.derivedUri : null); <START> getActivity().invalidateOptionsMenu(); <END> } }</code><technical_language>reasonable invalidate options menu update. Move this line of method</technical_language>

Target:
public void accept(Model.Update update) { if (DEBUG) Log.d(TAG, "Received model update. Loading=" + mModel.isLoading()); mProgressBar.setVisibility(mModel.isLoading() ? View.VISIBLE : View.GONE); updateLayout(mState.derivedMode); mAdapter.notifyDataSetChanged(); if (mRestoredSelection != null) { mSelectionMgr.restoreSelection(mRestoredSelection); mRestoredSelection = null; } final SparseArray<Parcelable> container = mState.dirConfigs.remove(mLocalState.getConfigKey()); final int curSortedDimensionId = mState.sortModel.getSortedDimensionId(); final SortDimension curSortedDimension = mState.sortModel.getDimensionById(curSortedDimensionId); if (container != null && !getArguments().getBoolean(Shared.EXTRA_IGNORE_STATE, false)) { getView().restoreHierarchyState(container); } else if (mLocalState.mLastSortDimensionId != curSortedDimension.getId() || mLocalState.mLastSortDimensionId == SortModel.SORT_DIMENSION_ID_UNKNOWN || mLocalState.mLastSortDirection != curSortedDimension.getSortDirection()) { mRecView.smoothScrollToPosition(0); } mLocalState.mLastSortDimensionId = curSortedDimension.getId(); mLocalState.mLastSortDirection = curSortedDimension.getSortDirection(); if (mRefreshLayout.isRefreshing()) { new Handler().postDelayed( () -> mRefreshLayout.setRefreshing(false), REFRESH_SPINNER_TIMEOUT); } if (!mModel.isLoading()) { mActivity.notifyDirectoryLoaded( mModel.doc != null ? mModel.doc.derivedUri : null); if (mModel.doc == null) { mActivity.invalidateOptionsMenu(); } } }
Source:
<code>public static float toCores(String cpuString) { final Matcher matcher; if ((matcher = HUMAN_SIZE_CPU_PATTERN.matcher(cpuString)).matches()) { final float size = Float.parseFloat(matcher.group(1)); final String suffix = matcher.group(2); if (suffix == null) { return size; } <START> switch (suffix.toLowerCase()) { <END> case "m": return size / K; } } throw new IllegalArgumentException("Invalid Kubernetes CPU size format provided: " + cpuString); }</code><technical_language>point of this switch? technically single if</technical_language>

Target:
public static float toCores(String cpuString) { final Matcher matcher; if ((matcher = HUMAN_SIZE_CPU_PATTERN.matcher(cpuString)).matches()) { final float size = Float.parseFloat(matcher.group(1)); final String suffix = matcher.group(2); if (suffix == null) { return size; } if (suffix.toLowerCase().equals("m")) { return size / K; } } throw new IllegalArgumentException("Invalid Kubernetes CPU size format provided: " + cpuString); }
Source:
<code><START> private static Namespace of(List<String> values) { <END> return new Namespace(values); }</code><technical_language>need this function, constructor</technical_language>

Target:
public static Namespace of(List<String> values) { return new Namespace(values); }
Source:
<code><START> public UsbSerialDeviceInformation generateDeviceInfo() { <END> int i = deviceInfoCounter.getAndIncrement(); return new UsbSerialDeviceInformation(i, i, "serialNumber-" + i, "manufacturer-" + i, "product-" + i, "ttyUSB" + i); }</code><technical_language>UsbSerialDeviceInformationGenerator</technical_language>

Target:
private UsbSerialDeviceInformation generateDeviceInfo() { return usbSerialDeviceInformationGenerator.generate(); }
Source:
<code><START> long yearsUntil(final InternationalFixedDate end) { <END> long startYear = getProlepticYear() * 512L + getDayOfYear(); long endYear = end.getProlepticYear() * 512L + end.getDayOfYear(); return (endYear - startYear) / 512L; }</code><technical_language>Method used. day-of-year anyways, leap-day behave strangely</technical_language>

Target:
long yearsUntil(final InternationalFixedDate end) { long startYear = this.prolepticYear * 512L + this.getInternalDayOfYear(); long endYear = end.prolepticYear * 512L + end.getInternalDayOfYear(); return (endYear - startYear) / 512L; }
Source:
<code>private static ByteBuf serializeProtobuf(MessageLite msg, ByteBufAllocator allocator) { int size = msg.getSerializedSize(); ByteBuf buf = allocator.heapBuffer(size, size); try { <START> msg.writeTo(new ByteBufOutputStream(buf)); <END> } catch (IOException e) { throw new RuntimeException(e); } buf.writerIndex(buf.capacity()); return buf; }</code><technical_language>Is this a race corruption time? Change fine, I understand actual issue current code corruption happening</technical_language>

Target:
private static ByteBuf serializeProtobuf(MessageLite msg, ByteBufAllocator allocator) { int size = msg.getSerializedSize(); ByteBuf buf = allocator.heapBuffer(size, size); try { msg.writeTo(new ByteBufOutputStream(buf)); } catch (IOException e) { throw new RuntimeException(e); } return buf; }
Source:
<code>public static RangeValue parse(final String input) { final RangeValue rangeValue = new RangeValue(); if (Objects.isNull(input)) { return rangeValue; } <START> final String _input = input.trim(); <END> if (!(_input.startsWith(INCLUDE_START) || _input.startsWith(EXCLUDE_START))) { return rangeValue; } if (!(_input.endsWith(INCLUDE_END) || _input.endsWith(EXCLUDE_END))) { return rangeValue; } boolean inQuotes = false; boolean includeStartValue = _input.startsWith(INCLUDE_START); boolean includeEndValue = _input.endsWith(INCLUDE_END); String startValue = ""; String endValue = ""; for (int current = 0; current < _input.length(); current++) { if (_input.charAt(current) == '\"') { inQuotes = !inQuotes; } if (!inQuotes && _input.substring(current, current + 2).equals("..")) { startValue = _input.substring(1, current).trim(); endValue = _input.substring(current + 2, _input.length() - 1).trim(); break; } } if (StringUtils.isEmpty(startValue) || StringUtils.isEmpty(endValue)) { return rangeValue; } rangeValue.setIncludeStartValue(includeStartValue); rangeValue.setStartValue(startValue); rangeValue.setIncludeEndValue(includeEndValue); rangeValue.setEndValue(endValue); return rangeValue; }</code><technical_language>I _input is variable name. is trimmedInput point of view facilitate code reading. do think</technical_language>

Target:
public static RangeValue parse(final String input) { final RangeValue rangeValue = new RangeValue(); if (Objects.isNull(input)) { return rangeValue; } final String trimmedInput = input.trim(); if (!(trimmedInput.startsWith(INCLUDE_START) || trimmedInput.startsWith(EXCLUDE_START))) { return rangeValue; } if (!(trimmedInput.endsWith(INCLUDE_END) || trimmedInput.endsWith(EXCLUDE_END))) { return rangeValue; } boolean inQuotes = false; boolean includeStartValue = trimmedInput.startsWith(INCLUDE_START); boolean includeEndValue = trimmedInput.endsWith(INCLUDE_END); String startValue = ""; String endValue = ""; for (int current = 0; current < trimmedInput.length(); current++) { if (trimmedInput.charAt(current) == '\"') { inQuotes = !inQuotes; } if (isSeparator(current, inQuotes, trimmedInput)) { startValue = trimmedInput.substring(1, current).trim(); endValue = trimmedInput.substring(current + SEPARATOR_LENGTH, trimmedInput.length() - 1).trim(); break; } } if (StringUtils.isEmpty(startValue) || StringUtils.isEmpty(endValue)) { return rangeValue; } rangeValue.setIncludeStartValue(includeStartValue); rangeValue.setStartValue(startValue); rangeValue.setIncludeEndValue(includeEndValue); rangeValue.setEndValue(endValue); return rangeValue; }
Source:
<code>private void cleanLRUProjects() throws IOException { if (shouldCleanup(FlowRunnerManager.this.projectDirectory)) { final List<ProjectVersion> projectVersionList = new ArrayList<>( FlowRunnerManager.this.installedProjects.values()); projectVersionList.sort((o1, o2) -> { try { final long creationTime1 = creationTime(o1.getInstalledDir()); final long creationTime2 = creationTime(o2.getInstalledDir()); if (creationTime1 < creationTime2) { return -1; } else if (creationTime1 > creationTime2) { return 1; } else { return 0; } } catch (final IOException ex) { logger.error("error reading project dir", ex); return 0; } }); <START> for (final ProjectVersion version : projectVersionList) { <END> if (!isActiveProject(version) && shouldKeepCleanup(FlowRunnerManager.this .projectDirectory)) { delete(version); } } } }</code><technical_language>a long time calculate project cache directory size big? called shouldKeepCleanup method executed for project version in for loop. more efficient do some batch cleaning</technical_language>

Target:
private void cleanLRUProjects() throws IOException { if (shouldCleanup(FlowRunnerManager.this.projectDirectory)) { final List<ProjectVersion> projectVersionList = new ArrayList<>( FlowRunnerManager.this.installedProjects.values()); projectVersionList.sort((o1, o2) -> { try { final long creationTime1 = getCreationTime(o1.getInstalledDir()); final long creationTime2 = getCreationTime(o2.getInstalledDir()); if (creationTime1 < creationTime2) { return -1; } else if (creationTime1 > creationTime2) { return 1; } else { return 0; } } catch (final IOException ex) { logger.error("error reading project dir", ex); return 0; } }); for (final ProjectVersion version : projectVersionList) { if (!isActiveProject(version) && shouldKeepCleanup(FlowRunnerManager.this .projectDirectory)) { delete(version); } } } }
Source:
<code>public final void dispose() { <START> for (Binding binding : bindings) { binding.dispose(); } for (ValidationStatusProvider statusProvider : validationStatusProviders) { if (!statusProvider.isDisposed()) { statusProvider.dispose(); } <END> } }</code><technical_language>is a change in behaviour introduces a bug. Binding.dispose calls DataBindingContext.remove, modifies bindings collection. This lead a ConcurrentModificationException. a unit test for this; apparently is not. avoid this problem bindings validationStatusProviders lists copied this change. this a more, I copy operations in other places preserved</technical_language>

Target:
public final void dispose() { Binding[] bindingArray = bindings.toArray(new Binding[bindings.size()]); for (Binding binding : bindingArray) { binding.dispose(); } ValidationStatusProvider[] statusProviderArray = validationStatusProviders .toArray(new ValidationStatusProvider[validationStatusProviders .size()]); for (ValidationStatusProvider statusProvider : statusProviderArray) { if (!statusProvider.isDisposed()) { statusProvider.dispose(); } } }
Source:
<code>public List<? extends Module> getJacksonModules() { return Collections.<Module>singletonList( new SimpleModule("FirehoseModule") .registerSubtypes( new NamedType(ClippedFirehoseFactory.class, "clipped"), new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(LocalFirehoseFactory.class, "local"), new NamedType(HttpFirehoseFactory.class, "http"), new NamedType(EventReceiverFirehoseFactory.class, "receiver"), new NamedType(CombiningFirehoseFactory.class, "combining"), new NamedType(FixedCountFirehoseFactory.class, "fixedCount"), new NamedType(SqlFirehoseFactory.class, "sql"), new NamedType(InlineFirehoseFactory.class, "inline"), <START> new NamedType(SqlInputSource.class, "sql") <END> ) ); }</code><technical_language>this part of new module InputSource replacement for firehose related interfaces</technical_language>

Target:
public List<? extends Module> getJacksonModules() { return Collections.<Module>singletonList( new SimpleModule("FirehoseModule") .registerSubtypes( new NamedType(ClippedFirehoseFactory.class, "clipped"), new NamedType(TimedShutoffFirehoseFactory.class, "timed"), new NamedType(LocalFirehoseFactory.class, "local"), new NamedType(HttpFirehoseFactory.class, "http"), new NamedType(EventReceiverFirehoseFactory.class, "receiver"), new NamedType(CombiningFirehoseFactory.class, "combining"), new NamedType(FixedCountFirehoseFactory.class, "fixedCount"), new NamedType(SqlFirehoseFactory.class, "sql"), new NamedType(InlineFirehoseFactory.class, "inline") ) ); }
Source:
<code>public void run() { try { <START> depageLock.lock(); <END> depage(scheduleExpiry); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorDelivering(e); } finally { depageLock.unlock(); } }</code><technical_language>move depageLock.lock() right try statement</technical_language>

Target:
public void run() { depageLock.lock(); try { depage(scheduleExpiry); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorDelivering(e); } finally { depageLock.unlock(); } }
Source:
<code>public MessageCorrectExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { String jidMessageToReplace; <START> jidMessageToReplace = parser.getAttributeValue("", ID_TAG); <END> return new MessageCorrectExtension(jidMessageToReplace); }</code><technical_language>Instead of defining ID_TAG again, simply reuse ID_TAG MessageCorrectExtension making public</technical_language>

Target:
public MessageCorrectExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { String idMessageToReplace = parser.getAttributeValue("", MessageCorrectExtension.ID_TAG); return new MessageCorrectExtension(idMessageToReplace); }
Source:
<code>public void testMultipleTags() { createServer(binder -> { binder.bind(ReportedObject.class); reportBinder(binder).export(ReportedObject.class) .withNamePrefix("TestObject") .withTags(ImmutableMap.of("foo", "bar")); binder.bind(ReportedObject.class).annotatedWith(Names.named("second")).to(ReportedObject.class); reportBinder(binder).export(ReportedObject.class) .annotatedWith(Names.named("second")) .withNamePrefix("TestObject") .withTags(ImmutableMap.of("baz", "quux", "a", "b", "c", "d\"\\\n")); }); StringResponse response = client.execute( prepareGet().setUri(uriFor("/metrics")).build(), createStringResponseHandler()); assertEquals(response.getStatusCode(), 200); assertEquals(response.getBody(), "#TYPE ReportCollector_NumMetrics gauge\n" + "ReportCollector_NumMetrics 2\n" + "#TYPE TestObject_Metric gauge\n" + "TestObject_Metric{a=\"b\",baz=\"quux\",c=\"d\\\"\\\\\\n\"} 2\n" + <START> "TestObject_Metric{foo=\"bar\"} 2\n"); <END> }</code><technical_language>Minor: Do care testing proper handling of labels invalid chars well</technical_language>

Target:
public void testMultipleTags() { createServer(binder -> { binder.bind(ReportedObject.class); reportBinder(binder).export(ReportedObject.class) .withNamePrefix("TestObject") .withTags(ImmutableMap.of("foo", "bar")); binder.bind(ReportedObject.class).annotatedWith(Names.named("second")).to(ReportedObject.class); reportBinder(binder).export(ReportedObject.class) .annotatedWith(Names.named("second")) .withNamePrefix("TestObject") .withTags(ImmutableMap.of("baz", "quux", "a", "b", "c", "d\"\\\n")); }); StringResponse response = client.execute( prepareGet().setUri(uriFor("/metrics")).build(), createStringResponseHandler()); assertEquals(response.getStatusCode(), 200); assertEquals(response.getBody(), "#TYPE ReportCollector_NumMetrics gauge\n" + "ReportCollector_NumMetrics{" + EXPECTED_INSTANCE_TAGS + "} 2\n" + "#TYPE TestObject_Metric gauge\n" + "TestObject_Metric{a=\"b\",baz=\"quux\",c=\"d\\\"\\\\\\n\"," + EXPECTED_INSTANCE_TAGS + "} 2\n" + "TestObject_Metric{foo=\"bar\"," + EXPECTED_INSTANCE_TAGS + "} 2\n"); }
Source:
<code>private void handleBlockExplosion(GlowBlock block) { if (block.getType() == Material.AIR) { return; } else if (block.getType() == Material.TNT) { <START> ((BlockTNT) itemTable.getBlock(Material.TNT)).explodeTNTBlock(block); <END> return; } block.breakNaturally(yield); }</code><technical_language>wiki: fuse lasts 40 redstone ticks (4 seconds/80 game ticks) if activated redstone fire, a random number 10 30 game ticks (.5 1.5 seconds) if destroyed explosion. In other words, right number of ticks needs passed explosion objects (setFuseTicks). recommendation is add overloaded method explodeBlock accepts a boolean: blownUp (name is a suggestion). If boolean is true, this 'random' tick count is applied, standard is used. I boolean propagate explosion object holds fuse ticks magic numbers place</technical_language>

Target:
private void handleBlockExplosion(GlowBlock block) { if (block.getType() == Material.AIR) { return; } else if (block.getType() == Material.TNT) { ((BlockTNT) itemTable.getBlock(Material.TNT)).explodeBlock(block, true); return; } block.breakNaturally(yield); }
Source:
<code>protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception { byte msgMark = byteBuf.readByte(); if (msgMark == LEGACY_CORFU_MSG_MARK) { list.add(CorfuMsg.deserialize(byteBuf)); } else if (msgMark == PROTO_CORFU_REQUEST_MSG_MARK){ ByteBufInputStream msgInputStream = new ByteBufInputStream(byteBuf); <START> try { <END> RequestMsg request = RequestMsg.parseFrom(msgInputStream); list.add(request); } catch (Exception e) { log.error("decode: An exception occurred during parsing request from ByteBufInputStream of byteBuf.", e); } finally { msgInputStream.close(); } } else if (msgMark == PROTO_CORFU_RESPONSE_MSG_MARK){ ByteBufInputStream msgInputStream = new ByteBufInputStream(byteBuf); try { ResponseMsg response = ResponseMsg.parseFrom(msgInputStream); list.add(response); } catch (Exception e) { log.error("decode: An exception occurred during parsing response from ByteBufInputStream.", e); } finally { msgInputStream.close(); } } else { throw new IllegalStateException("decode: Received an incorrectly marked message."); } }</code><technical_language>Try-with-resource a approach: try (ByteBufInputStream msgInputStream = new ByteBufInputStream(byteBuf)) {</technical_language>

Target:
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception { byte msgMark = byteBuf.readByte(); switch (MessageMarker.typeMap.get(msgMark)) { case LEGACY_MSG_MARK: list.add(CorfuMsg.deserialize(byteBuf)); break; case PROTO_REQUEST_MSG_MARK: try (ByteBufInputStream msgInputStream = new ByteBufInputStream(byteBuf)) { try { RequestMsg request = RequestMsg.parseFrom(msgInputStream); list.add(request); } catch (IOException e) { log.error("decode: An exception occurred during parsing request " + "from ByteBufInputStream.", e); } } break; case PROTO_RESPONSE_MSG_MARK: try (ByteBufInputStream msgInputStream = new ByteBufInputStream(byteBuf)) { try { ResponseMsg response = ResponseMsg.parseFrom(msgInputStream); list.add(response); } catch (IOException e) { log.error("decode: An exception occurred during parsing response " + "from ByteBufInputStream.", e); } } break; default: throw new IllegalStateException("decode: Received an incorrectly marked message."); } }
Source:
<code>public User update(User user) { return performUpdate(user, new QueryIdResolver<>(QueryType.GetDbUserByUserId, IdQueryParameters.class), <START> ActionType.AddUser, <END> new UpdateParametersProvider()); }</code><technical_language>I call UpdateUser action here</technical_language>

Target:
public User update(User user) { return performUpdate(user, new QueryIdResolver<>(QueryType.GetDbUserByUserId, IdQueryParameters.class), ActionType.UpdateUser, new UpdateParametersProvider()); }
Source:
<code>public String getUID() { <START> return asString("metadata.uid"); <END> }</code><technical_language>consider adding this identifier com.openshift.internal.restclient.model.properties.ResourcePropertyKeys</technical_language>

Target:
public String getUID() { return asString(METADATA_UID); }
Source:
<code>public static @NonNull Set<ITmfTrace> getTraceSetWithExperiment(ITmfTrace trace) { if (trace == null) { <START> return new HashSet<>(); <END> } if (trace instanceof TmfExperiment) { TmfExperiment exp = (TmfExperiment) trace; ITmfTrace[] traces = exp.getTraces(); Set<ITmfTrace> alltraces = new LinkedHashSet<>(Arrays.asList(traces)); alltraces.add(exp); return alltraces; } @SuppressWarnings("null") @NonNull Set<ITmfTrace> singleton = Collections.singleton(trace); return singleton; }</code><technical_language>Collections.EMPTY_SET</technical_language>

Target:
public static @NonNull Set<ITmfTrace> getTraceSetWithExperiment(ITmfTrace trace) { if (trace == null) { @SuppressWarnings("null") @NonNull Set<ITmfTrace> emptySet = Collections.EMPTY_SET; return emptySet; } if (trace instanceof TmfExperiment) { TmfExperiment exp = (TmfExperiment) trace; ITmfTrace[] traces = exp.getTraces(); Set<ITmfTrace> alltraces = new LinkedHashSet<>(Arrays.asList(traces)); alltraces.add(exp); return alltraces; } @SuppressWarnings("null") @NonNull Set<ITmfTrace> singleton = Collections.singleton(trace); return singleton; }
Source:
<code>protected boolean isPostZero() { <START> return false; <END> }</code><technical_language>false of vm's disks true for this</technical_language>

Target:
protected boolean isPostZero() { if (cachedPostZero == null) { cachedPostZero = vm.getDiskMap().values().contains(new Object() { @Override public boolean equals(Object obj) { return ((Disk) obj).isWipeAfterDelete(); } }); } return cachedPostZero; }
Source:
<code>public void deactivate() { <START> logger.debug("Plex binding deactived"); <END> if (connector != null) connector.close(); }</code><technical_language>please decrease remove this statement</technical_language>

Target:
public void deactivate() { logger.trace("Plex binding deactived"); if (connector != null) { connector.close(); } }
Source:
<code>public void handshake( final AgentClientMetadata agentClientMetadata ) throws HandshakeException { final HandshakeRequest request; try { request = jobServiceProtoConverter.toHandshakeRequest(agentClientMetadata); } catch (final GenieConversionException e) { throw new HandshakeException("Failed to construct request from parameters", e); } final HandshakeResponse response = handleResponseFuture(this.client.handshake(request)); switch (response.getType()) { case ALLOWED: log.info("Successfully shook hand with server"); break; <START> case REJECTED: <END> throw new HandshakeException("Server rejected client: " + response.getMessage()); default: throw new GenieRuntimeException( "Error during handshake: " + response.getType().name() + " - " + response.getMessage() ); } }</code><technical_language>want log relying upstream logging it</technical_language>

Target:
public void handshake( final AgentClientMetadata agentClientMetadata ) throws HandshakeException { final HandshakeRequest request; try { request = jobServiceProtoConverter.toHandshakeRequest(agentClientMetadata); } catch (final GenieConversionException e) { throw new HandshakeException("Failed to construct request from parameters", e); } final HandshakeResponse response = handleResponseFuture(this.client.handshake(request)); switch (response.getType()) { case ALLOWED: log.info("Successfully shook hand with server"); break; case REJECTED: log.warn("Server rejected handshake with this agent"); throw new HandshakeException("Server rejected client: " + response.getMessage()); default: throw new GenieRuntimeException( "Error during handshake: " + response.getType().name() + " - " + response.getMessage() ); } }
Source:
<code>public static Map<String, Symbol> readTypeShedSymbols(String fileName, String moduleName) { Map<String, Symbol> typeShedSymbols = new HashMap<>(); <START> typeShedSymbols.put(NONE_TYPE, new ClassSymbolImpl(NONE_TYPE, NONE_TYPE)); <END> InputStream resource = TypeShed.class.getResourceAsStream(fileName); if (resource == null) { return null; } PythonFile file = new TypeShedPythonFile(resource, moduleName); AstNode astNode = PythonParser.create().parse(file.content()); FileInput fileInput = new PythonTreeMaker().fileInput(astNode); new SymbolTableBuilder("", file, builtinGlobalSymbols).visitFileInput(fileInput); for (Symbol globalVariable : fileInput.globalVariables()) { typeShedSymbols.put(globalVariable.fullyQualifiedName(), globalVariable); } ReturnTypeVisitor visitor = new ReturnTypeVisitor(builtins); fileInput.accept(visitor); return Collections.unmodifiableMap(typeShedSymbols); }</code><technical_language>I don' this necessary. added in builtinGlobalSymbols</technical_language>

Target:
public static Map<String, Symbol> readTypeShedSymbols(String fileName, String moduleName) { Map<String, Symbol> typeShedSymbols = new HashMap<>(); InputStream resource = TypeShed.class.getResourceAsStream(fileName); if (resource == null) { return null; } PythonFile file = new TypeShedPythonFile(resource, moduleName); AstNode astNode = PythonParser.create().parse(file.content()); FileInput fileInput = new PythonTreeMaker().fileInput(astNode); new SymbolTableBuilder("", file, builtinGlobalSymbols).visitFileInput(fileInput); for (Symbol globalVariable : fileInput.globalVariables()) { typeShedSymbols.put(globalVariable.fullyQualifiedName(), globalVariable); } fileInput.accept(new ReturnTypeVisitor()); return Collections.unmodifiableMap(typeShedSymbols); }
Source:
<code>private void encodeStrokeDasharray( List<Expression> expressions) { if (expressions == null) return; AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "name", "name", "", "stroke-dasharray"); start("CssParameter", attributes); <START> for (Expression expression : expressions) { <END> filterTranslator.encode(expression); } end("CssParameter"); }</code><technical_language>This problematic. If starts a SLD standard dasharray text, "10 10" encoder return same, roll mixed mode expressions if expressions literals. idea is if get a OGC compliant SLD in, compliant rewrite it,</technical_language>

Target:
private void encodeStrokeDasharray(List<Expression> expressions) { if (expressions == null || expressions.isEmpty()) return; boolean isLiteral = true; for (Expression expression : expressions) { if(!(expression instanceof Literal)) isLiteral = false; } if(isLiteral) encodeLiteralStrokeDasharray(expressions); else encodeMixedStrokeDasharray(expressions); }
Source:
<code>if (OpenCvLoader.isOpenCvLoaded()) { try { if (System.getProperty("os.arch").equals("amd64") || System.getProperty("os.arch").equals("x86_64")) { System.loadLibrary("opencv_ffmpeg2413_64"); } else { System.loadLibrary("opencv_ffmpeg2413"); } tempFfmpegLoaded = true; } catch (UnsatisfiedLinkError e) { tempFfmpegLoaded = false; LOGGER.log(Level.SEVERE, "opencv_ffmepeg code library failed to load", e); <START> MessageNotifyUtil.Notify.show("OpenCV FFMpeg", "OpenCV FFMpeg library failed to load, see log for more details", MessageNotifyUtil.MessageType.WARNING); <END> } }</code><technical_language>This a bundle message displayed user</technical_language>

Target:
if (OpenCvLoader.isOpenCvLoaded()) { try { if (System.getProperty("os.arch").equals("amd64") || System.getProperty("os.arch").equals("x86_64")) { System.loadLibrary("opencv_ffmpeg2413_64"); } else { System.loadLibrary("opencv_ffmpeg2413"); } tempFfmpegLoaded = true; } catch (UnsatisfiedLinkError e) { tempFfmpegLoaded = false; LOGGER.log(Level.SEVERE, Bundle.ImageUtils_ffmpegLoadedError_msg(), e); MessageNotifyUtil.Notify.show(Bundle.ImageUtils_ffmpegLoadedError_title(), Bundle.ImageUtils_ffmpegLoadedError_msg(), MessageNotifyUtil.MessageType.WARNING); } }
Source:
<code>public void updateExecutionContext(IndexedRecord indexedRecord) { final MessageHeader messageHeader = this.messageHeaderExtractor.extractHeader(indexedRecord); <START> this.correlationIdSetter.setCurrentCorrelationId(messageHeader.getCorrelationId()); <END> this.tenantIdSetter.setCurrentTenantId(messageHeader.getTenantId()); this.userIdSetter.setCurrentUserId(messageHeader.getUserId()); this.securityTokenSetter.setCurrentSecurityToken(messageHeader.getSecurityToken()); }</code><technical_language>a builder great happen if correlationIdSetter is null, if tenantIdSetter is null, etc..</technical_language>

Target:
public void updateExecutionContext(IndexedRecord indexedRecord) { final MessageHeader messageHeader = this.messageHeaderExtractor.extractHeader(indexedRecord); if (this.correlationIdSetter != null) { this.correlationIdSetter.setCurrentCorrelationId(messageHeader.getCorrelationId()); } if (this.tenantIdSetter != null) { this.tenantIdSetter.setCurrentTenantId(messageHeader.getTenantId()); } if (this.userIdSetter != null) { this.userIdSetter.setCurrentUserId(messageHeader.getUserId()); } if (this.securityTokenSetter != null) { this.securityTokenSetter.setCurrentSecurityToken(messageHeader.getSecurityToken()); } }
Source:
<code>List<Map<String, Object>> parseDisks(XmlDocument document, List<VmDevice> devices) { List<VmDevice> dbDevices = filterDevices(devices, VmDeviceGeneralType.DISK, VmDeviceGeneralType.HOSTDEV); MemoizingSupplier<Map<Guid, String>> <START> diskToLunSupplier = <END> new MemoizingSupplier<>( () -> diskLunMapDao.getAll().stream().collect(Collectors.toMap( DiskLunMap::getDiskId, DiskLunMap::getLunId))); List<Map<String, Object>> result = new ArrayList<>(); for (XmlNode node : selectNodes(document, VmDeviceGeneralType.DISK)) { Map<String, Object> dev = new HashMap<>(); dev.put(VdsProperties.Type, VmDeviceGeneralType.DISK.getValue()); String diskType = DomainXmlUtils.parseAttribute(node, DEVICE); dev.put(VdsProperties.Device, diskType); dev.put(VdsProperties.Address, DomainXmlUtils.parseAddress(node)); dev.put(VdsProperties.Alias, parseAlias(node)); String path = DomainXmlUtils.parseDiskPath(node); Optional<VmDevice> dbDev = correlate(dev, dbDevices); if (!dbDev.isPresent()) { log.warn("unmanaged disk with path '{}' is ignored", path); continue; } dbDevices.remove(dbDev.get()); dev.put(VdsProperties.ImageId, parseImageIdFromPath(path)); dev.put(VdsProperties.DeviceId, dbDev.get().getDeviceId().toString()); dev.put(VdsProperties.SpecParams, dbDev.get().getSpecParams()); List<Map<String, Object>> volumeChain = parseVolumeChain(node); if (!volumeChain.isEmpty()) { dev.put(VdsProperties.VolumeChain, volumeChain.toArray()); } result.add(dev); } return result; }</code><technical_language>Is anywhere</technical_language>

Target:
List<Map<String, Object>> parseDisks(XmlDocument document, List<VmDevice> devices) { List<VmDevice> dbDevices = filterDevices(devices, VmDeviceGeneralType.DISK, VmDeviceGeneralType.HOSTDEV); List<Map<String, Object>> result = new ArrayList<>(); for (XmlNode node : selectNodes(document, VmDeviceGeneralType.DISK)) { Map<String, Object> dev = new HashMap<>(); dev.put(VdsProperties.Type, VmDeviceGeneralType.DISK.getValue()); String diskType = DomainXmlUtils.parseAttribute(node, DEVICE); dev.put(VdsProperties.Device, diskType); dev.put(VdsProperties.Address, DomainXmlUtils.parseAddress(node)); dev.put(VdsProperties.Alias, parseAlias(node)); String path = DomainXmlUtils.parseDiskPath(node); Optional<VmDevice> dbDev = correlate(dev, dbDevices); if (!dbDev.isPresent()) { log.warn("unmanaged disk with path '{}' is ignored", path); continue; } dbDevices.remove(dbDev.get()); dev.put(VdsProperties.ImageId, parseImageIdFromPath(path)); dev.put(VdsProperties.DeviceId, dbDev.get().getDeviceId().toString()); dev.put(VdsProperties.SpecParams, dbDev.get().getSpecParams()); List<Map<String, Object>> volumeChain = parseVolumeChain(node); if (!volumeChain.isEmpty()) { dev.put(VdsProperties.VolumeChain, volumeChain.toArray()); } result.add(dev); } return result; }