auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Resolution findMethod(Env env, String name, List<JavaType> argTypes, List<JavaType> typeParamTypes) { Resolution bestSoFar = unresolved(); Env env1 = env; while (env1.outer != null) { <START> Resolution res = findMethod(env1, env1.enclosingClass.getType(), env1.enclosingClass.getType(), name, argTypes, typeParamTypes); <END> if (res.symbol.kind < JavaSymbol.ERRONEOUS) { return res; } else if (res.symbol.kind < bestSoFar.symbol.kind) { bestSoFar = res; } env1 = env1.outer; } JavaSymbol sym = findInStaticImport(env, name, JavaSymbol.MTH); if (sym.kind < JavaSymbol.ERRONEOUS) { return Resolution.resolution(sym); } else if (sym.kind < bestSoFar.symbol.kind) { bestSoFar = Resolution.resolution(sym); } return bestSoFar; }</code><technical_language>changed</technical_language>

Target:
public Resolution findMethod(Env env, String name, List<JavaType> argTypes, List<JavaType> typeParamTypes) { Resolution bestSoFar = unresolved(); Env env1 = env; while (env1.outer != null) { Resolution res = findMethod(env1, env1.enclosingClass.getType(), name, argTypes, typeParamTypes); if (res.symbol.kind < JavaSymbol.ERRONEOUS) { return res; } else if (res.symbol.kind < bestSoFar.symbol.kind) { bestSoFar = res; } env1 = env1.outer; } JavaSymbol sym = findInStaticImport(env, name, JavaSymbol.MTH); if (sym.kind < JavaSymbol.ERRONEOUS) { return Resolution.resolution(sym); } else if (sym.kind < bestSoFar.symbol.kind) { bestSoFar = Resolution.resolution(sym); } return bestSoFar; }
Source:
<code>private static void saveCoverageFromLcovFiles(SensorContext context, List<File> lcovFiles) { LOG.info("Analysing {}", lcovFiles); FileSystem fileSystem = context.fileSystem(); FilePredicate mainFilePredicate = fileSystem.predicates().and( fileSystem.predicates().hasType(Type.MAIN), fileSystem.predicates().hasLanguages(JavaScriptLanguage.KEY, TypeScriptLanguage.KEY)); FileLocator fileLocator = new FileLocator(fileSystem.inputFiles(mainFilePredicate)); LCOVParser parser = LCOVParser.create(context, lcovFiles, fileLocator); Map<InputFile, NewCoverage> coveredFiles = parser.coverageByFile(); for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { NewCoverage fileCoverage = coveredFiles.get(inputFile); if (fileCoverage != null) { fileCoverage.save(); } } List<String> unresolvedPaths = parser.unresolvedPaths(); if (!unresolvedPaths.isEmpty()) { LOG.warn(String.format("Could not resolve %d file paths in %s", unresolvedPaths.size(), lcovFiles)); if (LOG.isDebugEnabled()) { LOG.debug("Unresolved paths:\n" + String.join("\n", unresolvedPaths)); } else { <START> LOG.warn("First unresolved path: " + unresolvedPaths.get(0)); <END> } } int inconsistenciesNumber = parser.inconsistenciesNumber(); if (inconsistenciesNumber > 0) { LOG.warn("Found inconsistencies in coverage report. Re-run analyse in debug mode to see details.", inconsistenciesNumber); } }</code><technical_language>add "Run in debug mode get full list of unresolved paths."</technical_language>

Target:
private static void saveCoverageFromLcovFiles(SensorContext context, List<File> lcovFiles) { LOG.info("Analysing {}", lcovFiles); FileSystem fileSystem = context.fileSystem(); FilePredicate mainFilePredicate = fileSystem.predicates().and( fileSystem.predicates().hasType(Type.MAIN), fileSystem.predicates().hasLanguages(JavaScriptLanguage.KEY, TypeScriptLanguage.KEY)); FileLocator fileLocator = new FileLocator(fileSystem.inputFiles(mainFilePredicate)); LCOVParser parser = LCOVParser.create(context, lcovFiles, fileLocator); Map<InputFile, NewCoverage> coveredFiles = parser.coverageByFile(); for (InputFile inputFile : fileSystem.inputFiles(mainFilePredicate)) { NewCoverage fileCoverage = coveredFiles.get(inputFile); if (fileCoverage != null) { fileCoverage.save(); } } List<String> unresolvedPaths = parser.unresolvedPaths(); if (!unresolvedPaths.isEmpty()) { LOG.warn(String.format("Could not resolve %d file paths in %s", unresolvedPaths.size(), lcovFiles)); if (LOG.isDebugEnabled()) { LOG.debug("Unresolved paths:\n" + String.join("\n", unresolvedPaths)); } else { LOG.warn("First unresolved path: " + unresolvedPaths.get(0) + " (Run in DEBUG mode to get full list of unresolved paths)"); } } int inconsistenciesNumber = parser.inconsistenciesNumber(); if (inconsistenciesNumber > 0) { LOG.warn("Found inconsistencies in coverage report. Re-run analyse in debug mode to see details.", inconsistenciesNumber); } }
Source:
<code>public void updateListFragment(List<Place> placeList) { adapterFactory.updateAdapterData(placeList, (RVRendererAdapter<Place>) rvNearbyList.getAdapter()); if (placeList.size() <= 0) { <START> noResultsView.setVisibility(View.VISIBLE); <END> } else { noResultsView.setVisibility(View.GONE); } }</code><technical_language>A ternary nice avoid repeating noResultsView.setVisibility(</technical_language>

Target:
public void updateListFragment(List<Place> placeList) { adapterFactory.updateAdapterData(placeList, (RVRendererAdapter<Place>) rvNearbyList.getAdapter()); noResultsView.setVisibility(placeList.size() <= 0 ? View.VISIBLE : View.GONE); }
Source:
<code>private void updateCounterOrMeter(Iterable<MetricResult<Long>> counters) { for (MetricResult<Long> metricResult : counters) { if (!isUserMetric(metricResult)) { continue; } String flinkMetricIdentifier = getFlinkMetricIdentifierString(metricResult.getKey()); ArrayList<String> scopeComponents = getNameSpaceArray(metricResult.getKey()); if ((scopeComponents.size() % 2) != 0) { Meter meter; <START> if (flinkMeterCache.containsKey(flinkMetricIdentifier)) { <END> meter = flinkMeterCache.get(flinkMetricIdentifier); } else { int timeSpanInSeconds = Integer.valueOf(scopeComponents.get(scopeComponents.size() - 1)); MetricGroup metricGroup = registerMetricGroup(metricResult.getKey(), baseMetricGroup); meter = metricGroup.meter( metricResult.getKey().metricName().getName(), new MeterView(timeSpanInSeconds)); flinkMeterCache.put(flinkMetricIdentifier, meter); } Long update = metricResult.getAttempted(); meter.markEvent(update); } else { Counter counter; if (flinkCounterCache.containsKey(flinkMetricIdentifier)) { counter = flinkCounterCache.get(flinkMetricIdentifier); } else { MetricGroup metricGroup = registerMetricGroup(metricResult.getKey(), baseMetricGroup); counter = metricGroup.counter(metricResult.getKey().metricName().getName()); flinkCounterCache.put(flinkMetricIdentifier, counter); } Long update = metricResult.getAttempted(); counter.inc(update - counter.getCount()); } } }</code><technical_language>Change lookup map once: counter = flinkCounterCache.get(flinkMetricIdentifier); if (counter == null) { XXX }</technical_language>

Target:
private void updateCounterOrMeter(Iterable<MetricResult<Long>> counters) { for (MetricResult<Long> metricResult : counters) { if (!isUserMetric(metricResult)) { continue; } String flinkMetricIdentifier = getFlinkMetricIdentifierString(metricResult.getKey()); ArrayList<String> scopeComponents = getNameSpaceArray(metricResult.getKey()); if ((scopeComponents.size() % 2) != 0) { Meter meter = flinkMeterCache.get(flinkMetricIdentifier); if (null == meter) { int timeSpanInSeconds = Integer.parseInt(scopeComponents.get(scopeComponents.size() - 1)); MetricGroup metricGroup = registerMetricGroup(metricResult.getKey(), baseMetricGroup); meter = metricGroup.meter( metricResult.getKey().metricName().getName(), new MeterView(timeSpanInSeconds)); flinkMeterCache.put(flinkMetricIdentifier, meter); } Long update = metricResult.getAttempted(); meter.markEvent(update); } else { Counter counter = flinkCounterCache.get(flinkMetricIdentifier); if (null == counter) { MetricGroup metricGroup = registerMetricGroup(metricResult.getKey(), baseMetricGroup); counter = metricGroup.counter(metricResult.getKey().metricName().getName()); flinkCounterCache.put(flinkMetricIdentifier, counter); } Long update = metricResult.getAttempted(); counter.inc(update - counter.getCount()); } } }
Source:
<code>private KafkaConsumer<byte[], byte[]> getKafkaConsumer() { final Properties props = new Properties(); props.setProperty("metadata.max.age.ms", "10000"); <START> props.setProperty("group.id", StringUtils.format("kafka-supervisor-%s", getRandomId())); <END> props.setProperty("max.poll.records", "1"); KafkaIndexTask.addConsumerPropertiesFromConfig(props, sortingMapper, consumerProperties); props.setProperty("enable.auto.commit", "false"); ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return new KafkaConsumer<>(props, new ByteArrayDeserializer(), new ByteArrayDeserializer()); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }</code><technical_language>This need change this record supplier is indexing task</technical_language>

Target:
private KafkaConsumer<byte[], byte[]> getKafkaConsumer() { final Properties props = new Properties(); props.setProperty("metadata.max.age.ms", "10000"); props.setProperty("group.id", StringUtils.format("kafka-supervisor-%s", RandomIdUtils.getRandomId())); addConsumerPropertiesFromConfig(props, sortingMapper, consumerProperties); props.setProperty("enable.auto.commit", "false"); ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return new KafkaConsumer<>(props, new ByteArrayDeserializer(), new ByteArrayDeserializer()); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }
Source:
<code>public RepositoryIndexer addRepositoryIndexer(String contextId, RepositoryIndexer value) { <START> logger.debug( <END> "RepositoryIndexManager = [{}]. Adding repository indexer. ContextId = [{}], RepositoryIndexer = [{}]", this, contextId, value); return indexes.put(contextId, value); }</code><technical_language>Please. parameter line indent chopped parameters it. (Could please fix this pull?) Also, logging operation blocks separate a line after... For example: doSomething(); i++; logger.debug(...); logger.debug(...); doSomethingElse(); like: doSomething(); i++; logger.debug(...); logger.debug(...); doSomethingElse();</technical_language>

Target:
public RepositoryIndexer addRepositoryIndexer(String contextId, RepositoryIndexer value) { return indexes.put(contextId, value); }
Source:
<code>public void testScalabilityDialogNotDismissedInadvertently() throws Exception { <START> String file= "/ceditor/src/large_main.cpp"; <END> fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false); IWorkbenchWindow window = EditorTestHelper.getActiveWorkbenchWindow(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell()); dialog.open(); setUpEditor(file); dialog.close(); boolean scalabilityDialogFound = false; Shell[] shells = Display.getCurrent().getShells(); for (Shell shell : shells) { scalabilityDialogFound |= shell.getText().equals(CEditorMessages.Scalability_info); } assertTrue(scalabilityDialogFound); EditorTestHelper.closeEditor(fEditor); }</code><technical_language>preferable create large_main.cpp fly part of test</technical_language>

Target:
public void testScalabilityDialogNotDismissedInadvertently() throws Exception { fCProject= EditorTestHelper.createCProject("ceditor", "resources/ceditor", false, false); String originalFile = "/ceditor/src/main.cpp"; String file= "/ceditor/src/large_main.cpp"; ResourceTestHelper.copy(originalFile, file); setUpEditor(file); StringBuilder buffer = new StringBuilder(fDocument.get()); buffer.append("unsigned long c[250000] = {\n"); for (int i = 0; i < 12499; i++) buffer.append(" 0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,\n"); buffer.append(" 0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1,0x0,0x1\n};\n"); fDocument.set(buffer.toString()); fEditor.doSave(new NullProgressMonitor()); EditorTestHelper.closeEditor(fEditor); IWorkbenchWindow window = EditorTestHelper.getActiveWorkbenchWindow(); ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell()); dialog.open(); setUpEditor(file); dialog.close(); Shell scalabilityDialog = null; Shell[] shells = Display.getCurrent().getShells(); for (Shell shell : shells) { if (shell.getText().equals(CEditorMessages.Scalability_info)) { scalabilityDialog = shell; break; } } assertNotNull(scalabilityDialog); scalabilityDialog.close(); EditorTestHelper.closeEditor(fEditor); }
Source:
<code>private static String typedNull(String prestoType) { <START> return format("CAST(null AS %s)", prestoType); <END> }</code><technical_language>nit: uppercase NULL</technical_language>

Target:
private static String typedNull(String prestoType) { return format("CAST(NULL AS %s)", prestoType); }
Source:
<code>public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException { long language = new Long(key.language); ContentletVersionInfo info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language); <START> if ((info == null || key.mode.showLive && info.getLiveInode() == null) && language != defaultLang && APILocator.getLanguageAPI().canDefaultContentToDefaultLanguage()) { <END> info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defaultLang); } if (info == null || key.mode.showLive && info.getLiveInode() == null) { throw new ResourceNotFoundException("cannot find content for: " + key); } Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.getWorkingInode(), APILocator.systemUser(), false); Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode()); if (null == contentlet) { throw new ResourceNotFoundException("cannot find content for: " + key); } return buildVelocity(contentlet, key.mode, key.path); }</code><technical_language>move this logic a private method</technical_language>

Target:
public InputStream writeObject(final VelocityResourceKey key) throws DotStateException, DotDataException, DotSecurityException { long language = new Long(key.language); ContentletVersionInfo info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, language); if (!isLiveVersionAvailable(key, info) && language != defaultLang && APILocator.getLanguageAPI().canDefaultContentToDefaultLanguage()) { info = APILocator.getVersionableAPI().getContentletVersionInfo(key.id1, defaultLang); } if (!isLiveVersionAvailable(key, info)) { throw new ResourceNotFoundException("cannot find content for: " + key); } Contentlet contentlet = (key.mode.showLive) ? APILocator.getContentletAPI().find(info.getLiveInode(), APILocator.systemUser(), false) : APILocator.getContentletAPI().find(info.getWorkingInode(), APILocator.systemUser(), false); Logger.debug(this, "DotResourceLoader:\tWriting out contentlet inode = " + contentlet.getInode()); if (null == contentlet) { throw new ResourceNotFoundException("cannot find content for: " + key); } return buildVelocity(contentlet, key.mode, key.path); }
Source:
<code>public void testConvertsPcOdToBrandIosUri() { map.put("dc:relation.programmeId", "338672-002"); <START> Assert.assertThat( <END> C4AtomApi.iOsUriFromPcUri("<LINK_0>", map), is("all4://views/brands?brand=come-dine-with-me&programme=338672-002")); }</code><technical_language>Needs a static import</technical_language>

Target:
public void testConvertsPcOdToBrandIosUri() { map.put("dc:relation.programmeId", "338672-002"); assertThat( C4AtomApi.iOsUriFromPcUri("<LINK_0>", map), is("all4://views/brands?brand=come-dine-with-me&programme=338672-002")); }
Source:
<code>public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { StackEntry oldEntry = peek(); if (oldEntry != null) { oldEntry.blank = false; if (oldEntry.isPWrapper) { <START> if (!isOnlyInline(localName)) { <END> ByteArrayOutputStream contents = popAndGetContents(); writePWrapper(oldEntry, contents); oldEntry = peek(); } } } if (oldEntry != null && oldEntry.needsPWrapping && isOnlyInline(localName)) { pushPWrapper(); } push(uri, localName, qName, atts); }</code><technical_language>squash ifs one</technical_language>

Target:
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { StackEntry oldEntry = peek(); if (oldEntry != null) { oldEntry.blank = false; if (oldEntry.isPWrapper && !isOnlyInline(localName)) { ByteArrayOutputStream contents = popAndGetContents(); writePWrapper(oldEntry, contents); oldEntry = peek(); } } if (oldEntry != null && oldEntry.needsPWrapping && isOnlyInline(localName)) { pushPWrapper(); } push(uri, localName, qName, atts); }
Source:
<code>public void dispose() { super.dispose(); DockerConnectionManager.getInstance().removeConnectionManagerListener(this); ((EnvironmentVariablesPageModel)envModel).dispose(); connection = null; project = null; dockerConnection = null; projects.clear(); volumes.clear(); portSpecs.clear(); if(imagePorts != null) { imagePorts.clear(); <START> } <END> }</code><technical_language>set reference imagePorts null (to consistent)? imagePorts = null</technical_language>

Target:
public void dispose() { super.dispose(); DockerConnectionManager.getInstance().removeConnectionManagerListener(this); ((EnvironmentVariablesPageModel)envModel).dispose(); connection = null; project = null; dockerConnection = null; projects.clear(); volumes.clear(); portSpecs.clear(); if(imagePorts != null) { imagePorts.clear(); imagePorts = null; } }
Source:
<code>private ByteArrayOutputStream getZipEntryContent( ZipInputStream zipStream, ZipEntry entry ) throws IOException { <START> ByteArrayOutputStream content = new ByteArrayOutputStream(); <END> byte[] bytes = new byte[(int) entry.getSize()]; int read; while ((read = zipStream.read(bytes, 0, bytes.length)) != -1) { content.write(bytes, 0, read); } content.flush(); return content; }</code><technical_language>try-with-resources cleaner</technical_language>

Target:
private ByteArrayOutputStream getZipEntryContent( ZipInputStream zipStream, ZipEntry entry ) throws IOException { try (ByteArrayOutputStream content = new ByteArrayOutputStream()) { byte[] bytes = new byte[(int) entry.getSize()]; int read; while ((read = zipStream.read(bytes, 0, bytes.length)) != -1) { content.write(bytes, 0, read); } return content; } }
Source:
<code>protected void onStart() { super.onStart(); if (!isSdkConfigured()) { new AlertDialog.Builder(this) .setTitle(R.string.configuration_incomplete_title) .setMessage(R.string.configuration_incomplete_message) .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(ListExamplesActivity.this, SettingsActivity.class)); } <START> }).show(); <END> return; } }</code><technical_language>Canceling dialog allows user choose some of examples. Handle cancel finishing activity</technical_language>

Target:
protected void onStart() { super.onStart(); if (!isSdkConfigured()) { new AlertDialog.Builder(this) .setTitle(R.string.configuration_incomplete_title) .setMessage(R.string.configuration_incomplete_message) .setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }) .setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(ListExamplesActivity.this, SettingsActivity.class)); } }).show(); return; } }
Source:
<code>private String getSpanName(ProcessKind processKind) { <START> String spanName = "Eventhubs."; <END> switch (processKind) { case SEND: spanName += "send"; break; case MESSAGE: spanName += "message"; break; case PROCESS: spanName += "process"; break; default: logger.warning("Unknown processKind type: {}", processKind); break; } return spanName; }</code><technical_language>EventHubs</technical_language>

Target:
private String getSpanName(ProcessKind processKind) { String spanName = "EventHubs."; switch (processKind) { case SEND: spanName += "send"; break; case MESSAGE: spanName += "message"; break; case PROCESS: spanName += "process"; break; default: logger.warning("Unknown processKind type: {}", processKind); break; } return spanName; }
Source:
<code>public String toString() { <START> return "WechatToken{" + super.toString() + " " + <END> "openid='" + openid + '\'' + ", unionid='" + unionid + '\'' + '}'; }</code><technical_language>CommonHelper.toNiceString method</technical_language>

Target:
public String toString() { return CommonHelper.toNiceString(WechatToken.class, "accessToken", getAccessToken(), "openid", openid, "unionid", unionid); }
Source:
<code><START> public ThrottleCategory(String categoryName, <END> Integer maxConcurrentPerNode, Integer maxConcurrentTotal, String blockingCategories, List<NodeLabeledPair> nodeLabeledPairs) { this.maxConcurrentPerNode = maxConcurrentPerNode == null ? 0 : maxConcurrentPerNode; this.maxConcurrentTotal = maxConcurrentTotal == null ? 0 : maxConcurrentTotal; this.categoryName = categoryName; this.blockingCategories = blockingCategories; this.nodeLabeledPairs = nodeLabeledPairs == null ? new ArrayList<NodeLabeledPair>() : nodeLabeledPairs; convertCategoriesToList(blockingCategories); }</code><technical_language>Please save previous constructor well. change affects binary compatibility previous versions</technical_language>

Target:
public ThrottleCategory(String categoryName, Integer maxConcurrentPerNode, Integer maxConcurrentTotal, String blockingCategories, List<NodeLabeledPair> nodeLabeledPairs) { this(categoryName, maxConcurrentPerNode, maxConcurrentTotal, nodeLabeledPairs); this.blockingCategories = blockingCategories; convertCategoriesToList(blockingCategories); }
Source:
<code>private String createCSVFile(String in_path) throws IOException, TasteException { File csv = new File("movies.csv"); <START> if (!csv.exists()) <END> { csv.createNewFile(); FileInputStream fileInput = new FileInputStream(path); GZIPInputStream gzis = new GZIPInputStream(fileInput); FileOutputStream fileOutput = new FileOutputStream(csv); byte[] buffer = new byte[1024]; int length; while ((length = gzis.read(buffer)) > 0) fileOutput.write(buffer, 0, length); fileInput.close(); gzis.close(); fileOutput.close(); } return csv.getAbsolutePath(); }</code><technical_language>so, if csv exist, update it</technical_language>

Target:
private String createCSVFile(String in_path) throws IOException, TasteException { File csv = new File("movies.csv"); if (csv.exists()) csv.delete(); csv.createNewFile(); FileInputStream fileInput = new FileInputStream(path); GZIPInputStream gzis = new GZIPInputStream(fileInput); FileOutputStream fileOutput = new FileOutputStream(csv); byte[] buffer = new byte[1024]; int length; while ((length = gzis.read(buffer)) > 0) fileOutput.write(buffer, 0, length); fileInput.close(); gzis.close(); fileOutput.close(); return csv.getAbsolutePath(); }
Source:
<code>public void testCompare() { ASCII ascii = new ASCII(true); String s0 = "abc"; String s1 = "xyz"; int returnedValue1 = ascii.compare(s0, s1); int returnedValue2 = ascii.compare(s1, s0); int returnedValue3 = ascii.compare(null, null); int returnedValue4 = ascii.compare(s0, null); int returnedValue5 = ascii.compare(null, s1); <START> assertEquals(returnedValue1, -1); <END> assertEquals(returnedValue2, 1); assertEquals(returnedValue3, 0); assertEquals(returnedValue4, 1); assertEquals(returnedValue5, -1); }</code><technical_language>argument is expected. <LINK_0></technical_language>

Target:
public void testCompare() { ASCII ascii = new ASCII(true); String s0 = "abc"; String s1 = "xyz"; int returnedValue1 = ascii.compare(s0, s1); int returnedValue2 = ascii.compare(s1, s0); int returnedValue3 = ascii.compare(null, null); int returnedValue4 = ascii.compare(s0, null); int returnedValue5 = ascii.compare(null, s1); assertEquals(-1, returnedValue1); assertEquals(1, returnedValue2); assertEquals(0, returnedValue3); assertEquals(1, returnedValue4); assertEquals(-1, returnedValue5); }
Source:
<code><START> private Integer prerequirementImgResource(String group) { <END> if (group.equalsIgnoreCase(AssignmentPrerequirement.RANK.toString())) { return R.drawable.rank_prerequirement; } else if (group.equalsIgnoreCase(AssignmentPrerequirement.MISSION.toString())) { return R.drawable.group_prerequirement; } else { return R.drawable.empty; } }</code><technical_language>returning Integer instead of plain int</technical_language>

Target:
private int prerequirementImgResource(String group) { if (group.equalsIgnoreCase(AssignmentPrerequirement.RANK.toString())) { return R.drawable.rank_prerequirement; } else if (group.equalsIgnoreCase(AssignmentPrerequirement.MISSION.toString())) { return R.drawable.group_prerequirement; } else { return R.drawable.empty; } }
Source:
<code>private void prepareResults(ProjectSearchResponseDto response) { List<SearchResultDto> results = response.getItemReferences(); <START> results.sort( <END> (o1, o2) -> { String ext1 = getFileExtension(o1.getItemReference().getName()); String ext2 = getFileExtension(o2.getItemReference().getName()); return ext1.compareToIgnoreCase(ext2); }); view.showItems(results); }</code><technical_language>create static comparator</technical_language>

Target:
private void prepareResults(ProjectSearchResponseDto response) { List<SearchResultDto> results = response.getItemReferences(); results.sort(SEARCH_COMPARATOR); view.showItems(results); }
Source:
<code>public Content update(Content content, ResolvedContent resolved) { Content resolvedContent = (Content)resolved.get(content.getCanonicalUri()).requireValue(); if (content instanceof Item) { Item resolvedItem = (Item)resolvedContent; Item contentItem = (Item)content; if (resolvedItem.getContainer() != null) { contentItem.setParentRef(resolvedItem.getContainer()); } contentWriter.createOrUpdate(ContentMerger.merge(resolvedItem, contentItem)); return resolvedItem; } else { <START> if (!Strings.nullToEmpty(resolvedContent.getDescription()) <END> .equals(Strings.nullToEmpty(resolvedContent.getDescription())) || !resolvedContent.getImages().equals(resolvedContent.getImages())) { ContentMerger.merge((Container)resolvedContent, (Container) content); contentWriter.createOrUpdate((Container)resolvedContent); } return resolvedContent; } }</code><technical_language>I this false</technical_language>

Target:
public Content update(Content content, ResolvedContent resolved) { Content resolvedContent = (Content)resolved.get(content.getCanonicalUri()).requireValue(); if (content instanceof Item) { Item resolvedItem = (Item)resolvedContent; Item contentItem = (Item)content; if (resolvedItem.getContainer() != null) { contentItem.setParentRef(resolvedItem.getContainer()); } contentWriter.createOrUpdate(ContentMerger.merge(resolvedItem, contentItem)); return resolvedItem; } else { return resolvedContent; } }
Source:
<code>public void handleDataChanged(DataChangedEvent... events) { if (!isEnabled()) { return; } for (DataChangedEvent e : events) { if (e.getUpdateState() != UpdateState.onlyInEditor) { handleChangedPo(e.getPo(), e.getDataState(), e.getUpdateState()); <START> } } <END> }</code><technical_language>if changes relevant in editor context</technical_language>

Target:
public void handleDataChanged(DataChangedEvent... events) { if (!isEnabled()) { return; } boolean isUpdateInEditor = true; for (DataChangedEvent e : events) { if (e.getUpdateState() != UpdateState.onlyInEditor) { handleChangedPo(e.getPo(), e.getDataState(), e.getUpdateState()); isUpdateInEditor = false; } } if (!isUpdateInEditor) { refresh(); addTeststyleProblems(); ProblemPropagator.INSTANCE.propagate(); } }
Source:
<code>public static Collection<Integer> getThreadIds(KernelAnalysisModule module) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return Collections.EMPTY_SET; } int threadQuark; try { threadQuark = ss.getQuarkAbsolute(Attributes.THREADS); Set<@NonNull Integer> tids = new TreeSet<>(); for (Integer quark : ss.getSubAttributes(threadQuark, false)) { final @NonNull String attributeName = ss.getAttributeName(quark); tids.add(attributeName.startsWith(Attributes.THREAD_0_PREFIX) ? 0 : Integer.parseInt(attributeName)); } return tids; } catch (AttributeNotFoundException e) { } <START> return Collections.EMPTY_SET; <END> }</code><technical_language>emptyList()</technical_language>

Target:
public static Collection<Integer> getThreadIds(KernelAnalysisModule module) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return Collections.emptySet(); } int threadQuark; try { threadQuark = ss.getQuarkAbsolute(Attributes.THREADS); Set<@NonNull Integer> tids = new TreeSet<>(); for (Integer quark : ss.getSubAttributes(threadQuark, false)) { final @NonNull String attributeName = ss.getAttributeName(quark); tids.add(attributeName.startsWith(Attributes.THREAD_0_PREFIX) ? 0 : Integer.parseInt(attributeName)); } return tids; } catch (AttributeNotFoundException e) { } return Collections.emptySet(); }
Source:
<code>public void doOnTerminateSuccess() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Single.just(1).doOnTerminate(new Action() { @Override public void run() throws Exception { atomicBoolean.set(true); } <START> }).subscribe(); <END> assertTrue(atomicBoolean.get()); }</code><technical_language>test().assertResult(1); instead</technical_language>

Target:
public void doOnTerminateSuccess() { final AtomicBoolean atomicBoolean = new AtomicBoolean(); Single.just(1).doOnTerminate(new Action() { @Override public void run() throws Exception { atomicBoolean.set(true); } }) .test() .assertResult(1); assertTrue(atomicBoolean.get()); }
Source:
<code>public void shouldInheritRepartitionTopicPartitionNumberFromUpstreamTopicWhenNumberOfPartitionsIsNotSpecified() throws InterruptedException, ExecutionException { final String repartitionName = "new-topic"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) <START> .repartition(Repartitioned.<Integer, String>as(repartitionName)) <END> .groupByKey() .count() .toStream() .to(outputTopic); startStreams(builder); validateReceivedMessages( new IntegerDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>(1, 1L), new KeyValue<>(2, 1L) ) ); final String repartitionTopicName = toRepartitionTopicName(repartitionName); assertTrue(topicExists(repartitionTopicName)); assertEquals(4, getNumberOfPartitionsForTopic(repartitionTopicName)); }</code><technical_language>generics inferred here</technical_language>

Target:
public void shouldInheritRepartitionTopicPartitionNumberFromUpstreamTopicWhenNumberOfPartitionsIsNotSpecified() throws Exception { final String repartitionName = "new-topic"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .repartition(Repartitioned.as(repartitionName)) .groupByKey() .count() .toStream() .to(outputTopic); startStreams(builder); validateReceivedMessages( new IntegerDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>(1, 1L), new KeyValue<>(2, 1L) ) ); final String repartitionTopicName = toRepartitionTopicName(repartitionName); assertTrue(topicExists(repartitionTopicName)); assertEquals(4, getNumberOfPartitionsForTopic(repartitionTopicName)); }
Source:
<code>private void saveToDisk(SaveRequest saveRequest) { <START> saveTask = new SaveTask(saveRequest, formSaver, formController, this, new SaveTask.Listener() { <END> @Override public void onProgressPublished(String progress) { saveResult.setValue(new SaveResult(SaveResult.State.SAVING, saveRequest, progress)); } @Override public void onComplete(SaveToDiskResult saveToDiskResult) { handleTaskResult(saveToDiskResult, saveRequest); } }, analytics).execute(); }</code><technical_language>Hmmm. worried viewmodel passed async task here... another awkward change I happen is a list of files save get passed save task. sense? In world need saveChanges (as handled in DiskFormSaver</technical_language>

Target:
private void saveToDisk(SaveRequest saveRequest) { saveTask = new SaveTask(saveRequest, formSaver, formController, mediaUtils, new SaveTask.Listener() { @Override public void onProgressPublished(String progress) { saveResult.setValue(new SaveResult(SaveResult.State.SAVING, saveRequest, progress)); } @Override public void onComplete(SaveToDiskResult saveToDiskResult) { handleTaskResult(saveToDiskResult, saveRequest); clearMediaFiles(); } }, analytics, new ArrayList<>(originalFiles.values())).execute(); }
Source:
<code>public ValueMatcher makeValueMatcher(final BaseDoubleColumnValueSelector selector, final String value) { <START> final Double matchVal = DimensionHandlerUtils.convertObjectToDouble(value, false); <END> if (matchVal == null) { return BooleanValueMatcher.of(false); } final long matchValLongBits = Double.doubleToLongBits(matchVal); return new ValueMatcher() { @Override public boolean matches() { return Double.doubleToLongBits(selector.getDouble()) == matchValLongBits; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; }</code><technical_language>nit: add a method DimensionHandlerUtils.convertObjectToDouble(value) internally calls DimensionHandlerUtils.convertObjectToDouble(value, false) for convenience</technical_language>

Target:
public ValueMatcher makeValueMatcher(final BaseDoubleColumnValueSelector selector, final String value) { final Double matchVal = DimensionHandlerUtils.convertObjectToDouble(value); if (matchVal == null) { return BooleanValueMatcher.of(false); } final long matchValLongBits = Double.doubleToLongBits(matchVal); return new ValueMatcher() { @Override public boolean matches() { return Double.doubleToLongBits(selector.getDouble()) == matchValLongBits; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { inspector.visit("selector", selector); } }; }
Source:
<code>public void getResourceUsage(final long queryId, final PipedOutputStream writerOutput) throws DbException { Schema schema = Schema.appendColumn(MyriaConstants.RESOURCE_SCHEMA, Type.INT_TYPE, "workerId"); TupleBuffer tb = new TupleBuffer(schema); TupleWriter writer = new CsvTupleWriter(writerOutput); boolean found = false; <START> for (SubQueryId subQueryId : resourceUsage.keySet()) { <END> if (subQueryId.getQueryId() == queryId) { found = true; Map<Integer, List<ResourceStats>> workerStats = resourceUsage.get(subQueryId); for (Integer workerId : workerStats.keySet()) { List<ResourceStats> statsList = workerStats.get(workerId); for (ResourceStats stats : statsList) { tb.putLong(0, stats.timestamp); tb.putInt(1, stats.opId); tb.putString(2, stats.measurement); tb.putLong(3, stats.value); tb.putLong(4, stats.queryId); tb.putLong(5, stats.subqueryId); tb.putInt(6, workerId); } } } } if (found) { try { writer.writeColumnHeaders(schema.getColumnNames()); writer.writeTuples(tb); writer.done(); } catch (IOException e) { throw new DbException(e); } return; } getResourceLog(queryId, writer); }</code><technical_language>do a blanket search this. fact suggests ResourceUsage tracking is in wrong place. of Query</technical_language>

Target:
public void getResourceUsage(final long queryId, final PipedOutputStream writerOutput) throws DbException { Schema schema = Schema.appendColumn(MyriaConstants.RESOURCE_SCHEMA, Type.INT_TYPE, "workerId"); TupleBuffer tb = new TupleBuffer(schema); TupleWriter writer = new CsvTupleWriter(writerOutput); if (queryManager.getResourceUsage(queryId, tb)) { try { writer.writeColumnHeaders(schema.getColumnNames()); writer.writeTuples(tb); writer.done(); } catch (IOException e) { throw new DbException(e); } return; } getResourceLog(queryId, writer); }
Source:
<code><START> protected PathAddress getAddress(){ <END> return address; }</code><technical_language>I this package protected</technical_language>

Target:
PathAddress getAddress(){ return address; }
Source:
<code>public boolean equals(Object o) { if (o instanceof EventSubprocess) { EventSubprocess other = (EventSubprocess) o; <START> return super.equals(other) && <END> isAsync.equals(other.isAsync) && processData.equals(other.processData); } return false; }</code><technical_language>tests for Equals hashCode methods</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof EventSubprocess) { EventSubprocess other = (EventSubprocess) o; return super.equals(other) && Objects.equals(isAsync, other.isAsync) && Objects.equals(processData, other.processData) && Objects.equals(labels, other.labels); } return false; }
Source:
<code>protected void enhanceSearchField() { addContent(getUserAccountData().getPerson().getFirstname()); addContent(getUserAccountData().getPerson().getLastname()); addContent(getUserAccountData().getLogin().getUsername()); addContent(getUserAccountData().getEmail()); <START> addContent(getTenant().fetchValue().getTenantData().getName()); <END> addContent(getTenant().fetchValue().getTenantData().getAccountNumber()); }</code><technical_language>cache</technical_language>

Target:
protected void enhanceSearchField() { addContent(getUserAccountData().getPerson().getFirstname()); addContent(getUserAccountData().getPerson().getLastname()); addContent(getUserAccountData().getLogin().getUsername()); addContent(getUserAccountData().getEmail()); tenants.fetchCachedTenant(getTenant()).ifPresent(tenant -> { addContent(tenant.getTenantData().getName()); addContent(tenant.getTenantData().getAccountNumber()); }); }
Source:
<code>private void streamData(String pidString, String datastream, boolean asAttachment, HttpServletRequest request, HttpServletResponse response) { PID pid = PIDs.get(pidString); AccessGroupSet principals = getAgentPrincipals().getPrincipals(); RepositoryObject updatedPid = repoObjLoader.getRepositoryObject(pid); <START> if (updatedPid.getClass() == WorkObject.class) { <END> pid = ((WorkObject) updatedPid).getPrimaryObject().getPid(); } try { fedoraContentService.streamData(pid, datastream, principals, asAttachment, response); recordDownloadEvent(pid, datastream, principals, request); } catch (IOException e) { log.error("Problem retrieving for {}", pid.toString(), datastream, e); } }</code><technical_language>instanceof</technical_language>

Target:
private void streamData(String pidString, String datastream, boolean asAttachment, HttpServletRequest request, HttpServletResponse response) { PID pid = PIDs.get(pidString); AccessGroupSet principals = getAgentPrincipals().getPrincipals(); RepositoryObject repoObj = repoObjLoader.getRepositoryObject(pid); if (repoObj instanceof WorkObject) { FileObject primaryObj = ((WorkObject) repoObj).getPrimaryObject(); if (primaryObj != null) { pid = primaryObj.getPid(); } } try { fedoraContentService.streamData(pid, datastream, principals, asAttachment, response); recordDownloadEvent(pid, datastream, principals, request); } catch (IOException e) { log.error("Problem retrieving for {}", pid.toString(), datastream, e); } }
Source:
<code>private void setVmToHeadlessMode() { VmStatic vmStatic = vmStaticDao.get(getParameters().getDev().getVmId()); if (vmStatic != null && vmStatic.getDefaultDisplayType() != DisplayType.none) { vmStatic.setDefaultDisplayType(DisplayType.none); vmStatic.setSingleQxlPci(false); <START> vmStaticDao.update(vmStatic); <END> } }</code><technical_language>needs done VmManager</technical_language>

Target:
private boolean setVmToHeadlessMode() { VmStatic vmStatic = vmStaticDao.get(getParameters().getDev().getVmId()); if (vmStatic != null && vmStatic.getDefaultDisplayType() != DisplayType.none) { vmStatic.setDefaultDisplayType(DisplayType.none); vmStatic.setSingleQxlPci(false); resourceManager.getVmManager(getParameters().getDev().getVmId()).update(vmStatic); return true; } return false; }
Source:
<code><START> protected void incrementFakeParticleTick() { <END> ChunkCoordinates coords = getBurstSourceChunkCoordinates(); TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); if(tile != null && tile instanceof IManaSpreader) { IManaSpreader spreader = (IManaSpreader) tile; spreader.setBurstParticleTick(spreader.getBurstParticleTick()+2); if(spreader.getLastBurstDeathTick() != -1 && spreader.getBurstParticleTick() > spreader.getLastBurstDeathTick()) spreader.setBurstParticleTick(0); } }</code><technical_language>deal</technical_language>

Target:
public void incrementFakeParticleTick() { ChunkCoordinates coords = getBurstSourceChunkCoordinates(); TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); if(tile != null && tile instanceof IManaSpreader) { IManaSpreader spreader = (IManaSpreader) tile; spreader.setBurstParticleTick(spreader.getBurstParticleTick()+2); if(spreader.getLastBurstDeathTick() != -1 && spreader.getBurstParticleTick() > spreader.getLastBurstDeathTick()) spreader.setBurstParticleTick(0); } }
Source:
<code>public void postComment() throws Exception { String file = "file"; String contents = "contents"; PushOneCommit push = pushFactory.create(db, admin.getIdent(), "first subject", file, contents); PushOneCommit.Result r = push.to(git, "refs/for/master"); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput input = new ReviewInput(); ReviewInput.CommentInput comment = newCommentInfo( file, Comment.Side.REVISION, 1, "comment 1"); input.comments = new HashMap<>(); input.comments.put(comment.path, Lists.newArrayList(comment)); revision(r).review(input); Map<String, List<CommentInfo>> result = getPublishedComments(changeId, revId); <START> assertThat(result.isEmpty()).isFalse(); <END> CommentInfo actual = Iterables.getOnlyElement(result.get(comment.path)); assertCommentInfo(comment, actual); }</code><technical_language>assertThat(result).isNotEmpty();</technical_language>

Target:
public void postComment() throws Exception { String file = "file"; String contents = "contents"; PushOneCommit push = pushFactory.create(db, admin.getIdent(), "first subject", file, contents); PushOneCommit.Result r = push.to(git, "refs/for/master"); String changeId = r.getChangeId(); String revId = r.getCommit().getName(); ReviewInput input = new ReviewInput(); ReviewInput.CommentInput comment = newCommentInfo( file, Comment.Side.REVISION, 1, "comment 1"); input.comments = new HashMap<>(); input.comments.put(comment.path, Lists.newArrayList(comment)); revision(r).review(input); Map<String, List<CommentInfo>> result = getPublishedComments(changeId, revId); assertThat(result).isNotEmpty(); CommentInfo actual = Iterables.getOnlyElement(result.get(comment.path)); assertCommentInfo(comment, actual); }
Source:
<code>public void publishInfo(ComponentInfoPublisher componentInfoPublisher) { components.forEach(component -> { <START> log.info("calling publishInfo on ", component); <END> component.publishInfo(componentInfoPublisher); }); }</code><technical_language>Debug</technical_language>

Target:
public void publishInfo(ComponentInfoPublisher componentInfoPublisher) { components.forEach(component -> { if (log.isDebugEnabled()) { log.debug("calling publishInfo on ", component); } component.publishInfo(componentInfoPublisher); }); }
Source:
<code>public void cleanup() { lock.lock(); try { boolean dirty = false; for (Iterator<Transaction> i = pending.values().iterator(); i.hasNext();) { Transaction tx = i.next(); if (isTransactionRisky(tx, null) && !acceptRiskyTransactions) { log.debug("Found risky transaction in wallet during cleanup.", tx.getHashAsString()); if (!tx.isAnyOutputSpent()) { tx.disconnectInputs(); i.remove(); transactions.remove(tx.getHash()); dirty = true; log.info("Removed transaction from pending pool during cleanup.", tx.getHashAsString()); } else { log.info( "Cannot remove transaction from pending pool during cleanup, as it's already spent partially.", tx.getHashAsString()); } } } <START> if (dirty) <END> saveLater(); } finally { lock.unlock(); } }</code><technical_language>Id a consistency check saving, other this function good (not a review though, :(</technical_language>

Target:
public void cleanup() { lock.lock(); try { boolean dirty = false; for (Iterator<Transaction> i = pending.values().iterator(); i.hasNext();) { Transaction tx = i.next(); if (isTransactionRisky(tx, null) && !acceptRiskyTransactions) { log.debug("Found risky transaction in wallet during cleanup.", tx.getHashAsString()); if (!tx.isAnyOutputSpent()) { tx.disconnectInputs(); i.remove(); transactions.remove(tx.getHash()); dirty = true; log.info("Removed transaction from pending pool during cleanup.", tx.getHashAsString()); } else { log.info( "Cannot remove transaction from pending pool during cleanup, as it's already spent partially.", tx.getHashAsString()); } } } if (dirty) { checkState(isConsistent()); saveLater(); } } finally { lock.unlock(); } }
Source:
<code>private List<ResponseMessage> responseMessages() { return new ArrayList<ResponseMessage>() {{ add(new ResponseMessageBuilder() .code(500) <START> .message("500 message") <END> .responseModel(new ModelRef("Error")) .build()); }}; }</code><technical_language>more meaningful. clear JaaS is failing</technical_language>

Target:
private List<ResponseMessage> responseMessages() { List<ResponseMessage> responseMessages = new ArrayList<>(); responseMessages .add(new ResponseMessageBuilder() .code(500) .message("500 - Interna server error.\n\n" + "There is a problem with the resource you are looking for, and it can not be dispayed.") .responseModel(new ModelRef("Error")) .build()); return responseMessages; }
Source:
<code>protected LifelineLabelHelper() { masks.put(SHOW_REPRESENT_NAME, "Show represent name"); masks.put(SHOW_REPRESENT_TYPE, "Show represent type"); masks.put(SHOW_UNDEFINED_TYPE, "Always show undefined type"); <START> masks.put(SHOW_LIFELINE_NAME, "Always show lifeline name"); <END> }</code><technical_language>masks label configurable user (Either Appearance properties view CSS). for selector label fragment</technical_language>

Target:
protected LifelineLabelHelper() { masks.put(SHOW_REPRESENT_NAME, "Show represent name"); masks.put(SHOW_REPRESENT_SELECTOR, "Show represent selector"); masks.put(SHOW_REPRESENT_TYPE, "Show represent type"); masks.put(SHOW_UNDEFINED_TYPE, "Always show undefined type"); masks.put(SHOW_LIFELINE_NAME, "Always show lifeline name"); }
Source:
<code>public void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames) { PatientData<Map<String, String>> data = patient.getData(getName()); if (data == null) { return; } Iterator<Map<String, String>> iterator = data.iterator(); if (iterator == null || !iterator.hasNext()) { return; } JSONArray container = null; while (iterator.hasNext()) { Map<String, String> item = iterator.next(); if (container == null) { json.put(getJsonPropertyName(), new JSONArray()); container = json.getJSONArray(getJsonPropertyName()); } if (item != null && "".equals(item.get(COMMENTS_KEY))) { item.remove(COMMENTS_KEY); } container.add(item); <START> container.add(item); <END> } }</code><technical_language>container.add(item)</technical_language>

Target:
public void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames) { PatientData<Map<String, String>> data = patient.getData(getName()); if (data == null) { return; } Iterator<Map<String, String>> iterator = data.iterator(); if (iterator == null || !iterator.hasNext()) { return; } JSONArray container = null; while (iterator.hasNext()) { Map<String, String> item = iterator.next(); if (container == null) { json.put(getJsonPropertyName(), new JSONArray()); container = json.getJSONArray(getJsonPropertyName()); } if (item != null && StringUtils.isBlank(item.get(COMMENTS_KEY))) { item.remove(COMMENTS_KEY); } container.add(item); } }