auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected MoveOrCopyImageGroupParameters createCopyParameters(DiskImage diskImage, Guid srcStorageDomainId, Guid srcImageGroupId, Guid srcImageId, VdcActionType parentCommandType) { MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(getVmId(), srcImageGroupId, srcImageId, diskImage.getId(), diskImage.getImageId(), diskImage.getStorageIds().get(0), ImageOperation.Copy); params.setAddImageDomainMapping(false); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setVolumeFormat(diskImage.getVolumeFormat()); params.setVolumeType(diskImage.getVolumeType()); params.setUseCopyCollapse(true); params.setSourceDomainId(srcStorageDomainId); <START> setStorageDomainId(srcStorageDomainId); <END> params.setWipeAfterDelete(ImagesHandler.shouldWipeAfterDelete( diskImage.isWipeAfterDelete(), getStorageDomain().getStorageType())); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); params.setParentParameters(getParameters()); params.setParentCommand(parentCommandType); return params; }</code><technical_language>Yikes! changing state of command for call passed. add a getStorageDomain(Guid id) method</technical_language>

Target:
protected MoveOrCopyImageGroupParameters createCopyParameters(DiskImage diskImage, Guid srcStorageDomainId, Guid srcImageGroupId, Guid srcImageId, VdcActionType parentCommandType) { MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(getVmId(), srcImageGroupId, srcImageId, diskImage.getId(), diskImage.getImageId(), diskImage.getStorageIds().get(0), ImageOperation.Copy); params.setAddImageDomainMapping(false); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setVolumeFormat(diskImage.getVolumeFormat()); params.setVolumeType(diskImage.getVolumeType()); params.setUseCopyCollapse(true); params.setSourceDomainId(srcStorageDomainId); params.setWipeAfterDelete(ImagesHandler.shouldWipeAfterDelete( diskImage.isWipeAfterDelete(), destStorages.get(params.getStorageDomainId()).getStorageType())); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); params.setParentParameters(getParameters()); params.setParentCommand(parentCommandType); return params; }
Source:
<code>public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getRemoveCommand()) { remove(); } else if ("OnRemove".equals(command.getName())) { onRemove(); } else if ("Upload".equals(command.getName())) { upload(); } else if ("CancelUpload".equals(command.getName())) { cancelUpload(); } else if ("OnCancelUpload".equals(command.getName())) { onCancelUpload(); } else if ("PauseUpload".equals(command.getName())) { pauseUpload(); } else if ("ResumeUpload".equals(command.getName())) { resumeUpload(); } else if ("Cancel".equals(command.getName())) { cancel(); } else if (command <START> == getDownloadCommand()) <END> { download(); } else if ("Move".equals(getMoveCommand().getName())) { move(); } }</code><technical_language>I style of this code requires some redesign rewrite. VmSnapshotListModel::executeCommand() is worse. "equals" vs. "==" currently working, is error-prone for future code modifications. magic strings for names (thus consistent classes - create other using). "if - else if - else if ....." style is OO, cleaner designs enums something</technical_language>

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getRemoveCommand()) { remove(); } else if ("OnRemove".equals(command.getName())) { onRemove(); } else if ("Upload".equals(command.getName())) { upload(); } else if ("CancelUpload".equals(command.getName())) { cancelUpload(); } else if ("OnCancelUpload".equals(command.getName())) { onCancelUpload(); } else if ("PauseUpload".equals(command.getName())) { pauseUpload(); } else if ("ResumeUpload".equals(command.getName())) { resumeUpload(); } else if ("Cancel".equals(command.getName())) { cancel(); } else if (command == getDownloadCommand()) { download(); } else if (MoveDiskModel.Move.equals(getMoveCommand().getName())) { diskOperationsHelper.move(this, getSelectedItems()); } else if (CopyDiskModel.Copy.equals(getCopyCommand().getName())) { diskOperationsHelper.copy(this, getSelectedItems()); } }
Source:
<code>void onJoinGame() { GameInfoBean gameInfoBean = gameService.getByUid(playerInfoBean.getGameUID()); <START> gameService.joinGame(gameInfoBean,null,new Callback<Void>() { <END> @Override public void success(Void result) { } @Override public void error(Throwable e) { logger.warn("Game could not be joined", e); } }); }</code><technical_language>Please enable settings in commit dialog: - Reformat code - Rearrange code - Optimize imports</technical_language>

Target:
void onJoinGame() { GameInfoBean gameInfoBean = gameService.getByUid(playerInfoBean.getGameUid()); gameService.joinGame(gameInfoBean, null) .exceptionally(throwable -> { logger.warn("Game could not be joined", throwable); return null; }); }
Source:
<code>public boolean equals(Object o) { if (this == o) <START> return true; <END> if (o == null || getClass() != o.getClass()) return false; Record record = (Record) o; return watermark == record.watermark && Objects.equals(flags, record.flags) && Objects.equals(key, record.key) && Arrays.equals(data, record.data); }</code><technical_language>{ } for if statements</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Record record = (Record) o; return watermark == record.watermark && Objects.equals(flags, record.flags) && Objects.equals(key, record.key) && Arrays.equals(data, record.data); }
Source:
<code><START> protected PatternParsingResults parse(InputStream in, URI uriToUse, Map<?, ?> options, ResourceSet resourceSet) { <END> Resource resource = resource(in, uriToUse, options, resourceSet); EList<EObject> contents = resource.getContents(); DiagnosticCollector collector = new DiagnosticCollector(); for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : resource.getErrors()) { converter.convertResourceDiagnostic(diagnostic, Severity.ERROR, collector); } if (contents.isEmpty()) { return new PatternParsingResults(collector); } else { List<Pattern> patterns = Lists.newArrayList(); for (EObject eObject : contents) { BasicDiagnostic diagnosticChain = new BasicDiagnostic(); diagnostician.validate(eObject, diagnosticChain); for (Diagnostic diag : new DiagnosticTreeIterator(diagnosticChain)) { converter.convertValidatorDiagnostic(diag, collector); } if(eObject instanceof PatternModel){ for(Pattern pattern :((PatternModel) eObject).getPatterns()){ patterns.add(pattern); } } } return new PatternParsingResults(patterns, collector); } }</code><technical_language>Instead of a custom validator, consider reusing PatternSetValidator patternlanguage.emf project</technical_language>

Target:
protected PatternParsingResults parse(InputStream in, URI uriToUse, Map<?, ?> options, ResourceSet resourceSet) { Resource resource = resource(in, uriToUse, options, resourceSet); EList<EObject> contents = resource.getContents(); PatternSetValidationDiagnostics diagnostics = validator.validate(resource); if (contents.isEmpty()) { return new PatternParsingResults(diagnostics); } else { List<Pattern> patterns = Lists.newArrayList(); for (EObject eObject : contents) { if(eObject instanceof PatternModel){ for(Pattern pattern :((PatternModel) eObject).getPatterns()){ patterns.add(pattern); } } } return new PatternParsingResults(patterns, diagnostics); } }
Source:
<code>public static List<String> getMissingDependencies(PrismHelper helper, String bundleID) throws OozieClientException { XOozieClient oozieClient = <START> new XOozieClient(readPropertiesFile(helper.getEnvFileName(), "prism.oozie_url")); <END> BundleJob bundleJob = oozieClient.getBundleJobInfo(bundleID); CoordinatorJob jobInfo = oozieClient.getCoordJobInfo(bundleJob.getCoordinators().get(0).getId()); List<CoordinatorAction> actions = jobInfo.getActions(); Util.print("conf from event: " + actions.get(0).getMissingDependencies()); String[] missingDependencies = actions.get(0).getMissingDependencies().split("#"); return new ArrayList<String>(Arrays.asList(missingDependencies)); }</code><technical_language>instead do helper.getcolohelper.get oozie client instead of reading properties file again. Otherwsise hard code clsuter prefix</technical_language>

Target:
public static List<String> getMissingDependencies(PrismHelper helper, String bundleID) throws OozieClientException { XOozieClient oozieClient = new XOozieClient(helper.getClusterHelper().getOozieURL()); BundleJob bundleJob = oozieClient.getBundleJobInfo(bundleID); CoordinatorJob jobInfo = oozieClient.getCoordJobInfo(bundleJob.getCoordinators().get(0).getId()); List<CoordinatorAction> actions = jobInfo.getActions(); Util.print("conf from event: " + actions.get(0).getMissingDependencies()); String[] missingDependencies = actions.get(0).getMissingDependencies().split("#"); return new ArrayList<String>(Arrays.asList(missingDependencies)); }
Source:
<code>private void testWalls(Grid grid) { int numWalls = 0; for (Entity entity : getEntities(grid)){ <START> if (entity instanceof Box && ((Box)entity).isDestructible()){ <END> numWalls++; } } assertTrue(numWalls > 0); }</code><technical_language>a separate wall class now, entity instanceof Wall</technical_language>

Target:
private void testWalls(Grid grid) { int numWalls = 0; for (Entity entity : getEntities(grid)){ if (entity instanceof Wall){ numWalls++; } } assertTrue(numWalls > 0); }
Source:
<code>VotingView(Map<Long,QuorumPeer.QuorumServer> view) { <START> this.stringRepresentation = view.entrySet().stream() <END> .sorted(Comparator.comparingLong(Map.Entry::getKey)) .filter(e -> e.getValue().addr != null) .map(e -> String.format("%s=%s:%d%s:%s%s", e.getKey().toString(), QuorumPeer.QuorumServer.delimitedHostString(e.getValue().addr), e.getValue().addr.getPort(), e.getValue().electionAddr == null ? "" : ":" + e.getValue().electionAddr.getPort(), e.getValue().type.equals(QuorumPeer.LearnerType.PARTICIPANT) ? "participant" : "observer", e.getValue().clientAddr ==null || e.getValue().isClientAddrFromStatic ? "" : String.format(";%s:%d", QuorumPeer.QuorumServer.delimitedHostString(e.getValue().clientAddr), e.getValue().clientAddr.getPort()))) .collect(Collectors.joining(", ")); }</code><technical_language>this variable a List\<String> Jackson serialize a json array add a getter</technical_language>

Target:
VotingView(Map<Long,QuorumPeer.QuorumServer> view) { this.view = view.entrySet().stream() .filter(e -> e.getValue().addr != null) .collect(Collectors.toMap(Map.Entry::getKey, e -> String.format("%s:%d%s:%s%s", QuorumPeer.QuorumServer.delimitedHostString(e.getValue().addr), e.getValue().addr.getPort(), e.getValue().electionAddr == null ? "" : ":" + e.getValue().electionAddr.getPort(), e.getValue().type.equals(QuorumPeer.LearnerType.PARTICIPANT) ? "participant" : "observer", e.getValue().clientAddr ==null || e.getValue().isClientAddrFromStatic ? "" : String.format(";%s:%d", QuorumPeer.QuorumServer.delimitedHostString(e.getValue().clientAddr), e.getValue().clientAddr.getPort())), (v1, v2) -> v1, TreeMap::new)); }
Source:
<code>private boolean isFromDeprecatedContainer(IndexEntry copyCandidate) { IndexValue copyCandidateValue = copyCandidate.getValue(); boolean isFromDeprecatedContainer = false; if (deprecatedContainers.contains( new Pair<>(copyCandidateValue.getAccountId(), copyCandidateValue.getContainerId()))) { <START> logger.trace("{} in segment in is from deleted container", copyCandidate, storeId); <END> isFromDeprecatedContainer = true; } return isFromDeprecatedContainer; }</code><technical_language>nit: in store is deprecated container. optional: change this debug level</technical_language>

Target:
private boolean isFromDeprecatedContainer(IndexEntry copyCandidate) { IndexValue copyCandidateValue = copyCandidate.getValue(); boolean isFromDeprecatedContainer = false; if (deprecatedContainers.contains( new Pair<>(copyCandidateValue.getAccountId(), copyCandidateValue.getContainerId()))) { logger.debug("{} in store is from deprecated container.", copyCandidate, storeId); isFromDeprecatedContainer = true; } return isFromDeprecatedContainer; }
Source:
<code>public InternalHiveBlock(long start, long end, List<HostAddress> addresses) { <START> checkArgument(start <= end, "block must not have negative length"); <END> this.start = start; this.end = end; this.addresses = addresses; }</code><technical_language>"block end block start"</technical_language>

Target:
public InternalHiveBlock(long start, long end, List<HostAddress> addresses) { checkArgument(start <= end, "block end cannot be before block start"); this.start = start; this.end = end; this.addresses = ImmutableList.copyOf(addresses); }
Source:
<code>public Gist updateGist(Gist gist) throws IOException { Assert.isNotNull(gist, "Gist cannot be null"); <START> String repo = gist.getId(); <END> Assert.isNotNull(repo, "Repository cannot be null"); StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS); uri.append('/').append(repo).append(IGitHubConstants.SUFFIX_JSON); return this.client.put(uri.toString(), gist, Gist.class); }</code><technical_language>repo renamed id</technical_language>

Target:
public Gist updateGist(Gist gist) throws IOException { Assert.isNotNull(gist, "Gist cannot be null"); String id = gist.getId(); Assert.isNotNull(id, "Gist id cannot be null"); StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_GISTS); uri.append('/').append(id).append(IGitHubConstants.SUFFIX_JSON); return this.client.put(uri.toString(), gist, Gist.class); }
Source:
<code><START> public static ClusterBasedJobCoordinator createFromConfigLoader(Config submissionConfig) { <END> JobConfig jobConfig = new JobConfig(submissionConfig); if (!jobConfig.getConfigLoaderFactory().isPresent()) { throw new SamzaException(JobConfig.CONFIG_LOADER_FACTORY + " is required to initialize job coordinator from config loader"); } MetricsRegistryMap metrics = new MetricsRegistryMap(); Config config = prepareJob(ConfigUtil.loadConfig(submissionConfig)); CoordinatorStreamUtil.writeConfigToCoordinatorStream(config, true); DiagnosticsUtil.createDiagnosticsStream(config); return new ClusterBasedJobCoordinator( metrics, new CoordinatorStreamStore(CoordinatorStreamUtil.buildCoordinatorStreamConfig(config), metrics), config); }</code><technical_language>this need public? If need in tests, package private mark VisibleForTesting</technical_language>

Target:
static ClusterBasedJobCoordinator createFromConfigLoader(Config submissionConfig) { JobConfig jobConfig = new JobConfig(submissionConfig); if (!jobConfig.getConfigLoaderFactory().isPresent()) { throw new SamzaException(JobConfig.CONFIG_LOADER_FACTORY + " is required to initialize job coordinator from config loader"); } MetricsRegistryMap metrics = new MetricsRegistryMap(); Config originalConfig = ConfigUtil.loadConfig(submissionConfig); ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc = ApplicationDescriptorUtil.getAppDescriptor(ApplicationUtil.fromConfig(originalConfig), originalConfig); RemoteJobPlanner planner = new RemoteJobPlanner(appDesc); List<JobConfig> jobConfigs = planner.prepareJobs(); if (jobConfigs.size() != 1) { throw new SamzaException("Only support single remote job is supported."); } Config config = jobConfigs.get(0); CoordinatorStreamUtil.writeConfigToCoordinatorStream(config, true); DiagnosticsUtil.createDiagnosticsStream(config); MetadataStore metadataStore = new CoordinatorStreamStore(CoordinatorStreamUtil.buildCoordinatorStreamConfig(config), metrics); metadataStore.init(); return new ClusterBasedJobCoordinator( metrics, metadataStore, config); }
Source:
<code><START> public void canClickWithModifierOnStyledText() throws Exception { <END> bot.checkBox("Listen").select(); styledText = bot.styledTextInGroup("StyledText"); styledText.setText("This is sample text"); bot.button("Clear").click(); styledText.click(0, 1, SWT.MOD1); SWTBotText text = bot.textInGroup("Listeners"); assertTextContains("MouseEnter [6]: MouseEvent{StyledText ", text.widget); assertTextContains("Activate [26]: ShellEvent{StyledText ", text.widget); assertTextContains("FocusIn [15]: FocusEvent{StyledText ", text.widget); assertEventMatches(text, "MouseDown [3]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.NONE | SWT.MOD1, styledText.widget) + " x=0 y=0 count=1"); assertEventMatches(text, "MouseUp [4]: MouseEvent{StyledText time=0 data=null button=1 stateMask=" + toStateMask(SWT.BUTTON1 | SWT.MOD1, styledText.widget) + " x=0 y=0 count=1"); }</code><technical_language>this test case testCtrlClickOffset()</technical_language>

Target:
public void canClickWithModifierOnStyledText() throws Exception { final int line = 0, column = 17; final String txtAtColumn = "x"; bot.checkBox("Listen").select(); styledText = bot.styledTextInGroup("StyledText"); styledText.setText("This is sample text"); display.syncExec(new Runnable() { @Override public void run() { styledText.widget.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { assertNotEquals(e.stateMask & SWT.MOD1, 0); Point absolutePosition = styledText.display.getCursorLocation(); Point relativePosition = styledText.widget.toControl(absolutePosition); int offset = styledText.widget.getOffsetAtPoint(relativePosition); assertEquals(offset, column); int offset2 = styledText.widget.getOffsetAtPoint(new Point(e.x, e.y)); assertEquals(offset, offset2); assertEquals(styledText.widget.getText(offset, offset), txtAtColumn); } }); } }); bot.button("Clear").click(); styledText.click(line, column, SWT.MOD1); assertEquals(new Position(line, column), styledText.cursorPosition(true)); verifyNotifyClick(SWT.MOD1); }
Source:
<code><START> public void dynamicallyConvertManagedToExternalTable() throws Throwable { <END> primary.run("use " + primaryDbName) .run("create table t1 (id int) stored as orc") .run("insert into table t1 values (1)") .run("create table t2 (id int) partitioned by (key int) stored as orc") .run("insert into table t2 partition(key=10) values (1)") .runFailure("alter table t1 set tblproperties('EXTERNAL'='true')") .runFailure("alter table t2 set tblproperties('EXTERNAL'='true')"); }</code><technical_language>I guess, though, some tests test this conversion. This set of tests side side tests. Also, I feel instead of full blown testcase WarehouseInstance, suffice test metastore APIs alone</technical_language>

Target:
public void dynamicallyConvertManagedToExternalTable() throws Throwable { primary.run("use " + primaryDbName) .run("create table t1 (id int) stored as orc") .run("insert into table t1 values (1)") .run("create table t2 (id int) partitioned by (key int) stored as orc") .run("insert into table t2 partition(key=10) values (1)") .runFailure("alter table t1 set tblproperties('EXTERNAL'='true')") .runFailure("alter table t1 set tblproperties('EXTERNAL'='true', 'TRANSACTIONAL'='false')") .runFailure("alter table t2 set tblproperties('EXTERNAL'='true')"); }
Source:
<code>public void testParceling() { IpPrefix p; p = new IpPrefix("2001:4860:db8::/64"); assertParcelingIsLossless(p); assertTrue(p.isIPv6()); p = new IpPrefix("192.0.2.0/25"); assertParcelingIsLossless(p); assertTrue(p.isIPv4()); <START> } <END></code><technical_language>do want assertFieldCountEquals here</technical_language>

Target:
public void testParceling() { IpPrefix p; p = new IpPrefix("2001:4860:db8::/64"); assertParcelingIsLossless(p); assertTrue(p.isIPv6()); p = new IpPrefix("192.0.2.0/25"); assertParcelingIsLossless(p); assertTrue(p.isIPv4()); assertFieldCountEquals(2, IpPrefix.class); }
Source:
<code>public static void main(String argv[]) { sServer = new WebViewZygoteServer(); try { Os.setpgid(0, 0); } catch (ErrnoException ex) { throw new RuntimeException("Failed to setpgid(0,0)", ex); } try { sServer.registerServerSocket("webview_zygote"); <START> Log.d(TAG, "Listening for WebView requests"); <END> sServer.runSelectLoop(TextUtils.join(",", Build.SUPPORTED_ABIS)); sServer.closeServerSocket(); } catch (Zygote.MethodAndArgsCaller caller) { caller.run(); } catch (RuntimeException e) { Log.e(TAG, "Fatal exception:", e); } Log.d(TAG, "Exiting webview_zygote server loop"); System.exit(0); }</code><technical_language>Logspam</technical_language>

Target:
public static void main(String argv[]) { sServer = new WebViewZygoteServer(); try { Os.setpgid(0, 0); } catch (ErrnoException ex) { throw new RuntimeException("Failed to setpgid(0,0)", ex); } try { sServer.registerServerSocket("webview_zygote"); sServer.runSelectLoop(TextUtils.join(",", Build.SUPPORTED_ABIS)); sServer.closeServerSocket(); } catch (Zygote.MethodAndArgsCaller caller) { caller.run(); } catch (RuntimeException e) { Log.e(TAG, "Fatal exception:", e); } System.exit(0); }
Source:
<code>public static int getMetadataContentSize(int keySize, int numberOfKeys) { return Version_Field_Size_In_Bytes + TOTAL_SIZE_FIELD_SIZE_IN_BYTES + NUM_OF_KEYS_FIELD_SIZE_IN_BYTES + ( <START> numberOfKeys * keySize * SIZE_OF_BLOB_FIELD_IN_BYTES); <END> }</code><technical_language>Correct if I wrong, I numberOfKeys * ( keySize + SIZE_OF_BLOB_FIELD_IN_BYTES )</technical_language>

Target:
public static int getMetadataContentSize(int keySize, int numberOfKeys) { return Version_Field_Size_In_Bytes + TOTAL_SIZE_FIELD_SIZE_IN_BYTES + NUM_OF_KEYS_FIELD_SIZE_IN_BYTES + numberOfKeys * (keySize + SIZE_OF_BLOB_FIELD_SIZE_IN_BYTES); }
Source:
<code>public void batchInsert(final List<DeviceData> deviceDataList) { final List<WriteRequest> writeRequestList = new LinkedList<>(); for (final DeviceData data : deviceDataList) { final HashMap<String, AttributeValue> item = deviceDataToAttributeMap(data); writeRequestList.add(new WriteRequest().withPutRequest(new PutRequest().withItem(item))); } Map<String, List<WriteRequest>> requestItems = new HashMap<>(); requestItems.put(this.tableName, writeRequestList); do { final BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest().withRequestItems(requestItems); final BatchWriteItemResult result = this.dynamoDBClient.batchWriteItem(batchWriteItemRequest); requestItems = result.getUnprocessedItems(); LOGGER.debug("Unprocessed put request count {}", requestItems.size()); <START> } while (requestItems.size() > 0); <END> }</code><technical_language>is potentially unbounded in time</technical_language>

Target:
public int batchInsert(final List<DeviceData> deviceDataList) { final List<WriteRequest> writeRequestList = Lists.newLinkedList(); for (final DeviceData data : deviceDataList) { final HashMap<String, AttributeValue> item = deviceDataToAttributeMap(data); writeRequestList.add(new WriteRequest().withPutRequest(new PutRequest().withItem(item))); } Map<String, List<WriteRequest>> requestItems = Maps.newHashMapWithExpectedSize(1); requestItems.put(this.tableName, writeRequestList); int numAttempts = 0; do { numAttempts++; final BatchWriteItemRequest batchWriteItemRequest = new BatchWriteItemRequest().withRequestItems(requestItems); final BatchWriteItemResult result = this.dynamoDBClient.batchWriteItem(batchWriteItemRequest); requestItems = result.getUnprocessedItems(); LOGGER.debug("Unprocessed put request count {}", requestItems.size()); } while ((!requestItems.isEmpty()) && (numAttempts < MAX_BATCH_WRITE_ATTEMPTS)); if (!requestItems.isEmpty()) { LOGGER.warn("Exceeded attempts to batch write to Dynamo. items left over.", MAX_BATCH_WRITE_ATTEMPTS, requestItems.size()); } return deviceDataList.size() - requestItems.size(); }
Source:
<code>private void header(@NonNull final BecauseYouReadCard card) { CardHeaderView header = new CardHeaderView(getContext()) .setTitle(card.title()) .setImage(R.drawable.ic_restore_black_24dp) .setImageCircleColor(R.color.gray_highlight) .setCard(card) .setCallback(getCallback()); header(header); OnClickListener listener = new SelectPageCallbackAdapter(card); CardLargeHeaderView largeHeader = new CardLargeHeaderView(getContext()) .setPageTitle(card.pageTitle()) .setSubtitle(card.subtitle()) .setImage(card.image()) .onClickListener(listener); <START> largeHeader.setOnClickListener(listener); <END> largeHeader(largeHeader); }</code><technical_language>Is this setting click listener twice? (see line this one)</technical_language>

Target:
private void header(@NonNull final BecauseYouReadCard card) { CardHeaderView header = new CardHeaderView(getContext()) .setTitle(card.title()) .setImage(R.drawable.ic_restore_black_24dp) .setImageCircleColor(R.color.gray_highlight) .setCard(card) .setCallback(getCallback()); header(header); CardLargeHeaderView largeHeader = new CardLargeHeaderView(getContext()) .setPageTitle(card.pageTitle()) .setSubtitle(card.subtitle()) .setImage(card.image()); largeHeader.setOnClickListener(new SelectPageCallbackAdapter(card)); largeHeader(largeHeader); }
Source:
<code>public static VmDevice addNetworkInterfaceDevice(VmDeviceId id, boolean plugged) { <START> return addManagedDevice(id, VmDeviceType.INTERFACE, VmDeviceType.BRIDGE, null, plugged, false, ""); <END> }</code><technical_language>please remove alias setting (should encapsulated in addManagedDevice</technical_language>

Target:
public static VmDevice addNetworkInterfaceDevice(VmDeviceId id, boolean plugged) { return addManagedDevice(id, VmDeviceType.INTERFACE, VmDeviceType.BRIDGE, null, plugged, false); }
Source:
<code>protected void destroyVm() { if (getVm().getStatus() == VMStatus.MigratingFrom && getVm().getMigratingToVds() != null) { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.DestroyVm, new DestroyVmVDSCommandParameters(new Guid(getVm().getMigratingToVds().toString()), getVmId(), true, false, 0)); } <START> if (getVm().getStatus() == VMStatus.Paused && getVm().getVmPauseStatus() == VmPauseStatus.NOERR) { <END> VmStatic vmStatic = getVm().getStaticData(); VmHandler.decreasePendingVms(getVm().getRunOnVds(), vmStatic.getNumOfCpus(), vmStatic.getMinAllocatedMem(), vmStatic.getName()); } setActionReturnValue(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.DestroyVm, new DestroyVmVDSCommandParameters(getVdsId(), getVmId(), false, false, 0)).getReturnValue()); }</code><technical_language>is problematic decrease pending resources actual call for vdsm. call vdsm fail increase pending values decreased. call DestoryVm if succeed, decrease pending resources</technical_language>

Target:
protected void destroyVm() { boolean wasPaused = false; VmStatic vmStatic = getVm().getStaticData(); if (getVm().getStatus() == VMStatus.MigratingFrom && getVm().getMigratingToVds() != null) { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.DestroyVm, new DestroyVmVDSCommandParameters(new Guid(getVm().getMigratingToVds().toString()), getVmId(), true, false, 0)); } if (getVm().getStatus() == VMStatus.Paused && getVm().getVmPauseStatus() == VmPauseStatus.NOERR) { wasPaused = true; } setActionReturnValue(Backend .getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.DestroyVm, new DestroyVmVDSCommandParameters(getVdsId(), getVmId(), false, false, 0)).getReturnValue()); if (wasPaused) { VmHandler.decreasePendingVms(getVm().getRunOnVds(), vmStatic.getNumOfCpus(), vmStatic.getMinAllocatedMem(), vmStatic.getName()); } }
Source:
<code>private void showMilestonePicker(TurboIssue issue) { <START> List<TurboMilestone> milestoneList = ui.logic.getRepo(issue.getRepoId()).getMilestones(); <END> MilestonePickerDialog dialog = new MilestonePickerDialog(stage, issue, milestoneList); Optional<Pair<ButtonType, Integer>> milestoneDialogResponse = dialog.showAndWait(); if (!milestoneDialogResponse.isPresent() || milestoneDialogResponse.get().getKey().equals(ButtonType.CANCEL)) { return; } Optional<Integer> newlyAssignedMilestone = Optional.ofNullable(milestoneDialogResponse.get().getValue()); if (!issue.getMilestone().equals(newlyAssignedMilestone)) { ui.undoController.addAction(issue, new ChangeMilestoneAction(ui.logic, issue.getMilestone(), newlyAssignedMilestone)); } }</code><technical_language>Types metadata/implementation details, left out of variable names</technical_language>

Target:
private void showMilestonePicker(TurboIssue issue) { List<TurboMilestone> milestones = ui.logic.getRepo(issue.getRepoId()).getMilestones(); Optional<MilestonePickerDialogResponse> milestoneDialogResponse = new MilestonePickerDialog(stage, issue, milestones).showAndWait(); if (wasCancelled(milestoneDialogResponse)) return; Optional<Integer> newlyAssignedMilestone = milestoneDialogResponse.get().getMilestoneId(); if (!issue.getMilestone().equals(newlyAssignedMilestone)) { addActionIfMilestoneChanged(issue, newlyAssignedMilestone); } }
Source:
<code>public synchronized void shutdown() { if (daemon == null) { return; } <START> log.info("Signalling background sweeper to shut down."); <END> daemon.interrupt(); try { daemon.join(); daemon = null; } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } }</code><technical_language>This logged WARN log.warn("Shutting background sweeper. Please restart service rerun background sweep.");.. this spammy</technical_language>

Target:
public synchronized void shutdown() { if (daemon == null) { return; } log.debug("Signalling background sweeper to shut down."); daemon.interrupt(); try { daemon.join(); daemon = null; } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } }
Source:
<code>private Filters getOptionType(String optionValue) { if <START> (optionValue.contains("?") || optionValue.contains("*")) { return Filters.REGREX; } <END> else if (optionValue.matches(CLASS_OR_METHOD_REGEX)) { return Filters.CLASSORMETHOD; } return Filters.PACKAGE; }</code><technical_language>This is a bit of odd definition: Technically: "hello world" is a proper regex. want top of this test, Pattern.compile(optionValue) ensure regex is properly formed</technical_language>

Target:
private Filters getOptionType(String optionValue) { if (REGULAR_EXPRESSION.matcher(optionValue).find()) { return Filters.REGEX; } else if (CLASS_OR_METHOD_REGEX.matcher(optionValue).find()) { return Filters.CLASS_OR_METHOD; } return Filters.PACKAGE; }
Source:
<code>private boolean isEmailSentDataDisplayCorrect() { if (emailPage.isElementPresent(By.className("table"))) { return isEmailSentTableHeaderCorrect(); } else { return false; <START> } <END> }</code><technical_language>This work fine? return a && b; for other versions</technical_language>

Target:
private boolean isEmailSentDataDisplayCorrect() { return emailPage.isElementPresent(By.className("table")) && isEmailTableHeaderCorrect(); }
Source:
<code>public String toString() { return "Card Payment{" + "paymentId='" + super.paymentId + '\'' + ", paymentProvider='" + paymentProvider + '\'' + ", cardBrandLabel='" + getCardBrand() + '\'' + ", amount=" + amount + ", state='" + state + '\'' + ", returnUrl='" + returnUrl + '\'' + ", reference='" + reference + '\'' + ", language='" + language.toString() + '\'' + <START> ", delayedCapture=" + (delayedCapture != null ? delayedCapture.toString() : "") + <END> ", createdDate='" + createdDate + '\'' + '}'; }</code><technical_language>need null check here: PP-4105 is done, connector return delayed_capture</technical_language>

Target:
public String toString() { return "Card Payment{" + "paymentId='" + super.paymentId + '\'' + ", paymentProvider='" + paymentProvider + '\'' + ", cardBrandLabel='" + getCardBrand() + '\'' + ", amount=" + amount + ", state='" + state + '\'' + ", returnUrl='" + returnUrl + '\'' + ", reference='" + reference + '\'' + ", language='" + language.toString() + '\'' + ", delayedCapture=" + delayedCapture + ", createdDate='" + createdDate + '\'' + '}'; }
Source:
<code>public AbstractPool(ConnectionManager cm, PoolConfiguration pc) { this.cm = cm; this.poolConfiguration = pc; this.pools = new ConcurrentHashMap<Credential, ManagedConnectionPool>(); this.transactionMap = new ConcurrentHashMap<Object, Map<ManagedConnectionPool, ConnectionListener>>(); this.semaphore = new Semaphore(poolConfiguration.getMaxSize()); <START> this.shouldPrefill = pc.isPrefill(); END> }</code><technical_language>Remove</technical_language>

Target:
public AbstractPool(ConnectionManager cm, PoolConfiguration pc) { this.cm = cm; this.poolConfiguration = pc; this.pools = new ConcurrentHashMap<Credential, ManagedConnectionPool>(); this.transactionMap = new ConcurrentHashMap<Object, Map<ManagedConnectionPool, ConnectionListener>>(); this.semaphore = new Semaphore(poolConfiguration.getMaxSize()); }
Source:
<code>INodeDirectory getMetaEnabledParent() throws TransactionContextException, StorageException { if(isDirectory()){ <START> INodeDirectory self = (INodeDirectory) this; <END> if(self.isMetaEnabled()){ return self; } } INodeDirectory dir = getParent(); while (!isRoot() && !dir.isRoot()) { if (dir.isMetaEnabled()) { return dir; } dir = dir.getParent(); } return null; }</code><technical_language>cleaner overwrite getMetaEnabledParent function in InodeDirectory</technical_language>

Target:
INodeDirectory getMetaEnabledParent() throws TransactionContextException, StorageException { INodeDirectory dir = getParent(); while (!isRoot() && !dir.isRoot()) { if (dir.isMetaEnabled()) { return dir; } dir = dir.getParent(); } return null; }
Source:
<code>private List<Disk> manualAggregateSnapshots() { List<Disk> <START> Param = <END> new ArrayList<>(); DiskImage diskWithSnaps = diskWithSnapshots; diskWithSnaps.getSnapshots().addAll(snapshotsList); Param.add(diskWithSnapshots); Param.add(diskWithoutSnapshots); Param.add(ovfImage); Param.add(cinderDisk); return Param; }</code><technical_language>Please Java conventions - param</technical_language>

Target:
private List<DiskImage> manualAggregateSnapshots() { DiskImage diskWithSnaps = diskWithSnapshots; diskWithSnaps.getSnapshots().addAll(snapshotsList); return Arrays.asList(diskWithSnapshots, diskWithoutSnapshots, ovfImage, cinderDisk); }
Source:
<code>protected boolean haveConnectorFactory(String domainType, String connectorType) { <START> String connectorFilter = String.format("(&(%s=%s)(%s=%s))", <END> org.openengsb.core.api.Constants.DOMAIN_KEY, domainType, org.openengsb.core.api.Constants.CONNECTOR_KEY, connectorType); try { Collection<ServiceReference<ConnectorInstanceFactory>> serviceReferences = bundleContext.getServiceReferences(ConnectorInstanceFactory.class, connectorFilter); return !serviceReferences.isEmpty(); } catch (InvalidSyntaxException e) { throw new RuntimeException(e); } }</code><technical_language>local constant</technical_language>

Target:
protected boolean haveConnectorFactory(String domainType, String connectorType) { String connectorFilter = String.format(DOMAIN_CONNECTOR_PATTERN, domainType, connectorType); try { Collection<ServiceReference<ConnectorInstanceFactory>> serviceReferences = bundleContext.getServiceReferences(ConnectorInstanceFactory.class, connectorFilter); return !serviceReferences.isEmpty(); } catch (InvalidSyntaxException e) { throw new RuntimeException(e); } }
Source:
<code>public void testCswUpdateByFilterConstraint() throws IOException, XPathExpressionException { Response firstResponse = ingestCswRecord(); Response secondResponse = ingestCswRecord(); given() .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML) .body(getFileContent(CSW_REQUEST_RESOURCE_PATH + "/CswUpdateByFilterConstraintRequest")) .post(CSW_PATH.getUrl()) .then() .body( hasXPath(" hasXPath(" hasXPath(" <START> String firstId; <END> String secondId; firstId = getMetacardIdFromCswInsertResponse(firstResponse); secondId = getMetacardIdFromCswInsertResponse(secondResponse); String firstUrl = REST_PATH.getUrl() + firstId; when() .get(firstUrl) .then() .log() .ifValidationFails() .assertThat() .body( hasXPath(" hasXPath(" hasXPath(" hasXPath( " is("Hydrography--Dictionaries"))); String secondUrl = REST_PATH.getUrl() + secondId; when() .get(secondUrl) .then() .log() .ifValidationFails() .assertThat() .body( hasXPath(" hasXPath(" hasXPath(" hasXPath( " is("Hydrography--Dictionaries"))); }</code><technical_language>Combine declaration instantiation</technical_language>

Target:
public void testCswUpdateByFilterConstraint() throws IOException, XPathExpressionException { Response firstResponse = ingestCswRecord(); Response secondResponse = ingestCswRecord(); given() .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML) .body(getFileContent(CSW_REQUEST_RESOURCE_PATH + "/CswUpdateByFilterConstraintRequest")) .post(CSW_PATH.getUrl()) .then() .body( hasXPath(" hasXPath(" hasXPath(" String firstId = getMetacardIdFromCswInsertResponse(firstResponse); String secondId = getMetacardIdFromCswInsertResponse(secondResponse); String firstUrl = REST_PATH.getUrl() + firstId; when() .get(firstUrl) .then() .log() .ifValidationFails() .assertThat() .body( hasXPath(" hasXPath(" hasXPath(" hasXPath( " is("Hydrography--Dictionaries"))); String secondUrl = REST_PATH.getUrl() + secondId; when() .get(secondUrl) .then() .log() .ifValidationFails() .assertThat() .body( hasXPath(" hasXPath(" hasXPath(" hasXPath( " is("Hydrography--Dictionaries"))); }
Source:
<code>private void verifyTopic(final String topic, final T data) { if (data != null) { final String key = topic + (isKey.get() ? "--key" : "--value"); if (topicTypeRegistry.containsKey(key)) { assertThat(String.format("key[%s] data[%s][%s]", key, data, data.getClass()), topicTypeRegistry.get(key), equalTo(data.getClass())); } else { <START> System.out.printf("storing key[%s] data[%s][%s]%n", key, data, data.getClass()); <END> topicTypeRegistry.put(key, data.getClass()); } } }</code><technical_language>Suggesting a commit PR? :P</technical_language>

Target:
private void verifyTopic(final String topic, final T data) { if (data != null) { final String key = topic + (isKey.get() ? "--key" : "--value"); if (topicTypeRegistry.containsKey(key)) { assertThat(String.format("key[%s] data[%s][%s]", key, data, data.getClass()), topicTypeRegistry.get(key), equalTo(data.getClass())); } else { topicTypeRegistry.put(key, data.getClass()); } } }
Source:
<code>public void deleteProject(@PathParam("project") final String projectName) throws HistoryException { Project project = env.getProjects().get(projectName); if (project == null) { <START> throw new IllegalStateException("cannot get project \"" + projectName + "\""); <END> } project.setIndexed(false); logger.log(Level.INFO, "deleting configuration for project {0}", projectName); deleteProjectData(projectName); for (Group group : project.getGroups()) { group.getRepositories().remove(project); group.getProjects().remove(project); } List<RepositoryInfo> repos = env.getProjectRepositoriesMap().get(project); if (repos != null) { env.getRepositories().removeAll(repos); } env.getProjectRepositoriesMap().remove(project); env.getProjects().remove(projectName, project); env.refreshSearcherManagerMap(); }</code><technical_language>this is necessary if consider removing</technical_language>

Target:
public void deleteProject(@PathParam("project") final String projectName) throws HistoryException { Project project = disableProject(projectName); logger.log(Level.INFO, "deleting configuration for project {0}", projectName); deleteProjectData(projectName); for (Group group : project.getGroups()) { group.getRepositories().remove(project); group.getProjects().remove(project); } List<RepositoryInfo> repos = env.getProjectRepositoriesMap().get(project); if (repos != null) { env.getRepositories().removeAll(repos); } env.getProjectRepositoriesMap().remove(project); env.getProjects().remove(projectName, project); env.refreshSearcherManagerMap(); }
Source:
<code>public static ListenerProtocol fromValue(String value) { <START> ListenerProtocol[] items = ListenerProtocol.values(); <END> for (ListenerProtocol item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } } return (ListenerProtocol) GetEnumValue.fromValueOrDefault(value, UNRECOGNIZED); }</code><technical_language>pattern is in <LINK_0></technical_language>

Target:
public static Protocol fromValue(String value) { return (Protocol) GetEnumValue.fromValueOrDefault(value, Protocol.UNRECOGNIZED); }
Source:
<code><START> public synchronized void putAll(Map<?, ?> t) { <END> for (Map.Entry<?, ?> entry : t.entrySet()) { this.put(entry.getKey(), entry.getValue()); } }</code><technical_language>conventions. Please spaces brackets method parameters, brackets new lines. checkstyle plugin crash build. try run "mvn install -P run-its"? long time complete build, cca hour</technical_language>

Target:
public synchronized void putAll( Map<?, ?> t ) { for ( Map.Entry<?, ?> entry : t.entrySet() ) { put( entry.getKey(), entry.getValue() ); } }
Source:
<code>double fractionOf( SearchEnvelope other ) { double fraction = 1.0; <START> for ( int i = 0; i < min.length; i++ ) <END> { long min = Math.max( this.min[i], other.min[i] ); long max = Math.min( this.max[i], other.max[i] ); final double innerFraction = (double) (max - min) / (double) (other.max[i] - other.min[i]); fraction *= innerFraction; } return fraction; }</code><technical_language>nbrDim instead of min.length</technical_language>

Target:
double fractionOf( SearchEnvelope other ) { double fraction = 1.0; for ( int i = 0; i < nbrDim; i++ ) { long min = Math.max( this.min[i], other.min[i] ); long max = Math.min( this.max[i], other.max[i] ); final double innerFraction = (double) (max - min) / (double) (other.max[i] - other.min[i]); fraction *= innerFraction; } return fraction; }
Source:
<code>public ProductDTO setProvidedProducts(Set<ProductDTO> providedProducts) { if (providedProducts != null) { if (this.providedProducts == null) { this.providedProducts = new HashSet<>(); } else { this.providedProducts.clear(); } for (ProductDTO dto : providedProducts) { if (isNullOrIncomplete(dto)) { throw new IllegalArgumentException( <START> "collection contains null or incomplete provided products"); <END> } } this.providedProducts.addAll(providedProducts); } else { this.providedProducts = null; } return this; }</code><technical_language>minor nit: exception message need provided products here, individual class of product, product's usage derived method generating exception</technical_language>

Target:
public ProductDTO setProvidedProducts(Set<ProductDTO> providedProducts) { if (providedProducts != null) { if (this.providedProducts == null) { this.providedProducts = new HashSet<>(); } else { this.providedProducts.clear(); } for (ProductDTO dto : providedProducts) { if (isNullOrIncomplete(dto)) { throw new IllegalArgumentException("Collection is null or incomplete"); } } this.providedProducts.addAll(providedProducts); } else { this.providedProducts = null; } return this; }
Source:
<code>public void setup(Context.OperatorContext context) { <START> if (store[0] == null) { <END> throw new RuntimeException("Left Store is Empty"); } if (store[1] == null) { throw new RuntimeException("Right Store is Empty"); } boolean isOuter = strategy.equals(JoinStrategy.LEFT_OUTER_JOIN) || strategy.equals(JoinStrategy.OUTER_JOIN); store[0].isOuterJoin(isOuter); isOuter = strategy.equals(JoinStrategy.RIGHT_OUTER_JOIN) || strategy.equals(JoinStrategy.OUTER_JOIN); store[1].isOuterJoin(isOuter); store[0].setup(); store[1].setup(); populateFields(); }</code><technical_language>@chaithu14 if store annotated @NotNull this validated launch. I store a 2 element array this is check run time. validation constraints explore this validation happen launch for array I suggest 2 stores fields</technical_language>

Target:
public void setup(Context.OperatorContext context) { boolean isOuter = strategy.equals(JoinStrategy.LEFT_OUTER_JOIN) || strategy.equals(JoinStrategy.OUTER_JOIN); leftStore.getStore().isOuterJoin(isOuter); isOuter = strategy.equals(JoinStrategy.RIGHT_OUTER_JOIN) || strategy.equals(JoinStrategy.OUTER_JOIN); rightStore.getStore().isOuterJoin(isOuter); leftStore.getStore().setup(context); rightStore.getStore().setup(context); populateFields(); windowTimeSec = (context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS) * 1.0) / 1000.0; }
Source:
<code>private static <T> T instantiatePage(SearchContext context, Class<T> pageClassToProxy) { try { Constructor<?>[] availableConstructors = pageClassToProxy.getDeclaredConstructors(); for (Constructor<?> c: availableConstructors){ Class<?>[] parameterTypes = c.getParameterTypes(); if (parameterTypes.length != 1) continue; Class<?> parameterClazz = parameterTypes[0]; if (!parameterClazz.isAssignableFrom(context.getClass())) continue; c.setAccessible(true); <START> return (T) c.newInstance(context); <END> } return pageClassToProxy.newInstance(); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } }</code><technical_language>_pageClassToProxy.cast_ address unchecked class cast warning</technical_language>

Target:
private static <T> T instantiatePage(SearchContext context, Class<T> pageClassToProxy) { try { Constructor<?>[] availableConstructors = pageClassToProxy.getDeclaredConstructors(); for (Constructor<?> c: availableConstructors) { Class<?>[] parameterTypes = c.getParameterTypes(); if (parameterTypes.length != 1) { continue; } Class<?> parameterClazz = parameterTypes[0]; if (!parameterClazz.isAssignableFrom(context.getClass())) { continue; } c.setAccessible(true); return pageClassToProxy.cast(c.newInstance(context)); } return pageClassToProxy.newInstance(); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException(e); } }
Source:
<code>private boolean flatten(Map<String, String> map, String prefix, String name, Object value, TypeDescriptor sourceType) { String key = StringUtils.isEmpty(prefix) ? name : prefix + "." + name; if (sourceType != null) { if (sourceType.getType().equals(Boolean.class)) { map.putAll(formattingBoolean(name, value)); return true; } } if (value == null) { String resetKey = "_" + key; <START> map.put(resetKey, ""); <END> return true; } Class<?> clazz = value.getClass(); if (value instanceof Iterable) { if (StringUtils.isEmpty(name)) { return true; } Iterable<?> iterable = (Iterable<?>) value; map.putAll(this.convert(key, iterable)); } else if (clazz.isArray()) { if (StringUtils.isEmpty(name)) { return true; } map.putAll(this.convert(key, arrayObjectToList(value))); } else if (value instanceof Map) { Map<?, ?> m = (Map<?, ?>) value; map.putAll(this.convert(key, m)); } else { TypeDescriptor descriptor = (sourceType != null) ? sourceType : TypeDescriptor.forObject(value); if (BeanUtils.isSimpleProperty(clazz) || conversionService .canConvert(descriptor, STRING_DESC)) { map.put(key, conversionService.convert(value, descriptor, STRING_DESC).toString()); } else { return false; } } return true; }</code><technical_language>I follows. map.put(resetKey, ""); formattingBoolean#map.put(name, ""); role. easier understand WebDataBinder#getEmptyValue. java String key = StringUtils.isEmpty(prefix) ? name : prefix + "." + name; if (value == null) { String resetKey = determineResetKey(key, sourceType); map.put(resetKey, ""); return true; } // omit // Determine convert null field marker. private String determineResetKey(String key, TypeDescriptor sourceType) { // convert Boolean null field marker. // WebDataBinder bind boolean & Boolean field marker false value. if (Boolean.class == sourceType.getType()) { return key; } return "_" + key; } do think</technical_language>

Target:
private boolean flatten(Map<String, String> map, String prefix, String name, Object value, TypeDescriptor sourceType) { String key = StringUtils.isEmpty(prefix) ? name : prefix + "." + name; if (value == null) { String resetKey = determineResetKey(key, sourceType); map.put(resetKey, ""); return true; } Class<?> clazz = value.getClass(); if (value instanceof Iterable) { if (StringUtils.isEmpty(name)) { return true; } Iterable<?> iterable = (Iterable<?>) value; map.putAll(this.convert(key, iterable)); } else if (clazz.isArray()) { if (StringUtils.isEmpty(name)) { return true; } map.putAll(this.convert(key, arrayObjectToList(value))); } else if (value instanceof Map) { Map<?, ?> m = (Map<?, ?>) value; map.putAll(this.convert(key, m)); } else { TypeDescriptor descriptor = (sourceType != null) ? sourceType : TypeDescriptor.forObject(value); if (BeanUtils.isSimpleProperty(clazz) || conversionService .canConvert(descriptor, STRING_DESC)) { map.put(key, conversionService.convert(value, descriptor, STRING_DESC).toString()); } else { return false; } } return true; }