auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>Optional<Dataset<Row>> versionMarker(SparkSession spark) { if (marker == null) { return Optional.empty(); } Row row = RowFactory.create( <START> Collections.singletonList(Method.M0Run.ALGO), <END> wiki, MARKER_SCORE, MARKER_QUERY, marker); return Optional.of(spark.createDataFrame( Collections.singletonList(row), SuggestionAggregator.SCHEMA_OUT)); }</code><technical_language>nit: put methods here</technical_language>

Target:
Optional<Dataset<Row>> versionMarker(SparkSession spark) { if (marker == null) { return Optional.empty(); } Row row = RowFactory.create( Method.algos(), wiki, MARKER_SCORE, query, marker); return Optional.of(spark.createDataFrame( singletonList(row), SuggestionAggregator.SCHEMA_OUT)); }
Source:
<code>public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable { VersionedPrepareCommand versionedPrepareCommand = (VersionedPrepareCommand) command; if (ctx.isOriginLocal()) { versionedPrepareCommand.setVersionsSeen(ctx.getCacheTransaction().getVersionsRead()); } InvocationStage invocationStage = wrapEntriesForPrepare(ctx, command); if (invocationStage == null) { return prepareHandler.apply(ctx, command, null); } else { <START> return invocationStage.thenApply(ctx, command, prepareHandler); <END> } }</code><technical_language>decide a common if/else order in interceptors :)</technical_language>

Target:
public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable { VersionedPrepareCommand versionedPrepareCommand = (VersionedPrepareCommand) command; if (ctx.isOriginLocal()) { versionedPrepareCommand.setVersionsSeen(ctx.getCacheTransaction().getVersionsRead()); } return wrapEntriesForPrepareAndApply(ctx, command, prepareHandler); }
Source:
<code>public boolean needsProgressMonitor() { if (fResources != null && fResources.length > 0) return true; if (fJavaElements != null) { for (IJavaElement <START> fJavaElement : <END> fJavaElements) { int type= fJavaElement.getElementType(); if (type <= IJavaElement.CLASS_FILE) return true; } } return false; }</code><technical_language>rename javaElement element</technical_language>

Target:
public boolean needsProgressMonitor() { if (fResources != null && fResources.length > 0) return true; if (fJavaElements != null) { for (IJavaElement javaElement : fJavaElements) { int type= javaElement.getElementType(); if (type <= IJavaElement.CLASS_FILE) return true; } } return false; }
Source:
<code>public void testCreateTableInNonDefaultSchema() { assertUpdate(format("CREATE SCHEMA %s.schema1", CATALOG)); assertUpdate(format("CREATE SCHEMA %s.schema2", CATALOG)); assertQueryResult(format("SHOW SCHEMAS FROM %s", CATALOG), "default", "information_schema", "schema1", "schema2"); assertUpdate(format("CREATE TABLE %s.schema1.nation AS SELECT * FROM tpch.tiny.nation WHERE nationkey %% 2 = 0", CATALOG), "SELECT count(*) FROM nation WHERE MOD(nationkey, 2) = 0"); assertUpdate(format("CREATE TABLE %s.schema2.nation AS SELECT * FROM tpch.tiny.nation WHERE nationkey %% 2 = 1", CATALOG), "SELECT count(*) FROM nation WHERE MOD(nationkey, 2) = 1"); assertQueryResult(format("SELECT count(*) FROM %s.schema1.nation", CATALOG), 13L); assertQueryResult(format("SELECT count(*) FROM %s.schema2.nation", CATALOG), 12L); assertUpdate(format("DROP SCHEMA %s.schema1", CATALOG)); <START> assertUpdate(format("DROP SCHEMA %s.schema2", CATALOG)); <END> }</code><technical_language>\+ assertUpdate(format("DROP SCHEMA IF EXISTS %s.schema2", CATALOG));</technical_language>

Target:
public void testCreateTableInNonDefaultSchema() { assertUpdate("CREATE SCHEMA schema1"); assertUpdate("CREATE SCHEMA schema2"); assertQueryResult("SHOW SCHEMAS", "default", "information_schema", "schema1", "schema2"); assertUpdate("CREATE TABLE schema1.nation AS SELECT * FROM tpch.tiny.nation WHERE nationkey % 2 = 0", "SELECT count(*) FROM nation WHERE MOD(nationkey, 2) = 0"); assertUpdate("CREATE TABLE schema2.nation AS SELECT * FROM tpch.tiny.nation WHERE nationkey % 2 = 1", "SELECT count(*) FROM nation WHERE MOD(nationkey, 2) = 1"); assertQueryResult("SELECT count(*) FROM schema1.nation", 13L); assertQueryResult("SELECT count(*) FROM schema2.nation", 12L); }
Source:
<code>public boolean accepts(Class<?> aClass) { return aClass.isPrimitive() || aClass.isEnum() || Number.class.isAssignableFrom(aClass) || String.class.equals(aClass) || Character.class.equals(aClass) || Boolean.class.equals(aClass) || java.util.Date.class.isAssignableFrom(aClass) <START> || java.util.Calendar.class.isAssignableFrom(aClass); <END> }</code><technical_language>add _aClass.isEnum()_ end diff, is 1 line, instead of 7</technical_language>

Target:
public boolean accepts(Class<?> aClass) { return aClass.isPrimitive() || Number.class.isAssignableFrom(aClass) || String.class.equals(aClass) || Character.class.equals(aClass) || Boolean.class.equals(aClass) || java.util.Date.class.isAssignableFrom(aClass) || java.util.Calendar.class.isAssignableFrom(aClass) || aClass.isEnum(); }
Source:
<code>protected HealthCheckResult doCheckInternal() { String registryName = options.getMetricsScope(); <START> List<String> metricNames = new ArrayList<>(Arrays.asList(options.getMetricName().split(","))); <END> metricNames.removeAll(Arrays.asList("", null)); MetricsService metricsService = Globals.getDefaultBaseServiceLocator().getService(MetricsService.class); if (registryName.equalsIgnoreCase("application")) { registryName = options.getMetricsApplicationName(); } HealthCheckResult result = new HealthCheckResult(); List<String> metrics = collectMetrics(metricsService.getRegistry(registryName), metricNames); result.add(new HealthCheckResultEntry(metrics.isEmpty() ? WARNING : GOOD, metrics.isEmpty() ? "The metric you entered doesn't exist under " + registryName : metrics.stream().map(Object::toString).collect(Collectors.joining()))); return result; }</code><technical_language>remove extra whitespace</technical_language>

Target:
protected HealthCheckResult doCheckInternal() { List<MonitoredMetric> monitoredMetrics = options.getMonitoredMetrics(); HealthCheckResult result = new HealthCheckResult(); try { if (monitoredMetrics != null && !monitoredMetrics.isEmpty()) { final String data = write(); result.add(new HealthCheckResultEntry(data.isEmpty() ? WARNING : GOOD, data.isEmpty() ? "The metrics you have added for monitoring doesn't exist" : data)); } else { result.add(new HealthCheckResultEntry(CRITICAL, "No metric has been added for monitoring.")); } } catch (IOException ex) { result.add(new HealthCheckResultEntry(CRITICAL, "Failed to write metrics to stream.")); } return result; }
Source:
<code><START> GenericPreference getPreference(String filePath) { <END> String productID = ""; String userID = ""; Float score = 0.0f; BufferedReader reader; try { reader = new BufferedReader(new FileReader(filePath)); String line = reader.readLine(); while (line != null) { if (line.startsWith("product/productId:")) productID = line.split(" ")[1]; if (line.startsWith("review/userId:")) userID = line.split(" ")[1]; if (line.startsWith("review/score:")) { score = Float.parseFloat(line.split(" ")[1]); addPreference(userID, productID, score); } line = reader.readLine(); } reader.close(); } catch (IOException e) { e.printStackTrace(); } return null; }</code><technical_language>* Handle access modifier - Investigated kind of access do there</technical_language>

Target:
GenericPreference getPreference(String filePath) { String productID = ""; String userID = ""; Float score = 0.0f; try { BufferedReader reader = new BufferedReader(new FileReader(filePath)); String line = reader.readLine(); while (line != null) { if (line.startsWith("product/productId:")) productID = line.split(" ")[1]; if (line.startsWith("review/userId:")) userID = line.split(" ")[1]; if (line.startsWith("review/score:")) { score = Float.parseFloat(line.split(" ")[1]); addPreference(userID, productID, score); } line = reader.readLine(); } reader.close(); } catch (IOException e) { e.printStackTrace(); } return null; }
Source:
<code>public Airing[] getRelatedAirings(DBObject[] allAirs, boolean controlCPUUsage, boolean ignoreDisabledFlag, boolean legacyKeyword, Map<Integer, Airing[]> airingMap, Carny.CarnyCache cache, StringBuilder sbCache) { if (allAirs == null) return Pooler.EMPTY_AIRING_ARRAY; if (sbCache == null) sbCache = new StringBuilder(); List<Airing> rv = null; if (cache == null) rv = new ArrayList<Airing>(); else cache.airWorkCache.clear(); boolean keywordTest = !legacyKeyword && (this.agentMask&(KEYWORD_MASK)) == (KEYWORD_MASK); if(keywordTest) { Show[] shows = wiz.searchShowsByKeyword(getKeyword()); for (Show show : shows) { Airing[] airings = wiz.getAirings(show, 0); for (Airing a : airings) { if (followsTrend(a, true, sbCache, true, ignoreDisabledFlag)) { if (cache != null) cache.airWorkCache.add(a); else rv.add(a); } } } } else { if (cache != null) { optimizedFollowsTrend(true, controlCPUUsage, false, ignoreDisabledFlag, airingMap, allAirs, cache, false, "allAirs"); } else { for (int i = 0; i < allAirs.length; i++) { Airing a = (Airing) allAirs[i]; if (a == null) continue; <START> if (followsTrend(a, true, sbCache)) <END> rv.add(a); if ((i % CPU_CONTROL_MOD_COUNT) == 0 && controlCPUUsage) try {Thread.sleep(Carny.SLEEP_PERIOD);} catch (Exception e) } } } return cache != null ? Pooler.EMPTY_AIRING_ARRAY : rv.toArray(Pooler.EMPTY_AIRING_ARRAY); }</code><technical_language>this calling 5 argument variant "false, ignroeDisabledFlag" other 2 arguments</technical_language>

Target:
public Airing[] getRelatedAirings(DBObject[] allAirs, boolean controlCPUUsage, boolean ignoreDisabledFlag, boolean legacyKeyword, Map<Integer, Airing[]> airingMap, Carny.CarnyCache cache, StringBuilder sbCache) { if (allAirs == null) return Pooler.EMPTY_AIRING_ARRAY; if (sbCache == null) sbCache = new StringBuilder(); List<Airing> rv = null; if (cache == null) rv = new ArrayList<Airing>(); else cache.airWorkCache.clear(); boolean keywordTest = !legacyKeyword && (this.agentMask&(KEYWORD_MASK)) == (KEYWORD_MASK); if(keywordTest) { Show[] shows = wiz.searchShowsByKeyword(getKeyword()); for (Show show : shows) { Airing[] airings = wiz.getAirings(show, 0); if (cache != null) cache.airWorkCache.ensureAddCapacity(airings.length); for (Airing a : airings) { if (followsTrend(a, true, sbCache, true, ignoreDisabledFlag)) { if (cache != null) cache.airWorkCache.add(a); else rv.add(a); } } } } else { if (cache != null) { optimizedFollowsTrend(true, controlCPUUsage, false, ignoreDisabledFlag, airingMap, allAirs, cache, "allAirs"); } else { for (int i = 0; i < allAirs.length; i++) { Airing a = (Airing) allAirs[i]; if (a == null) continue; if (followsTrend(a, true, sbCache, true, ignoreDisabledFlag)) rv.add(a); if ((i % CPU_CONTROL_MOD_COUNT) == 0 && controlCPUUsage) try {Thread.sleep(Carny.SLEEP_PERIOD);} catch (Exception e) } } } return cache != null ? Pooler.EMPTY_AIRING_ARRAY : rv.toArray(Pooler.EMPTY_AIRING_ARRAY); }
Source:
<code>private void setFault(CompletionTime completionTime, List<BinaryAnnotation> binaryAnnotations) { List<HttpCodesUtil.HttpCode> errorCodes = HttpCodesUtil.getClientOrServerErrors(HttpCodesUtil.getHttpStatusCode(binaryAnnotations)); if (errorCodes.size() > 0) { <START> completionTime.setFault(errorCodes.iterator().next().getDescription()); <END> } }</code><technical_language>Is a reason return error description, instead of joining together</technical_language>

Target:
private void setFault(CompletionTime completionTime, List<BinaryAnnotation> binaryAnnotations) { List<HttpCodesUtil.HttpCode> errorCodes = HttpCodesUtil.getClientOrServerErrors(HttpCodesUtil.getHttpStatusCodes(binaryAnnotations)); if (errorCodes.size() > 0) { HttpCodesUtil.HttpCode errorCode = errorCodes.iterator().next(); completionTime.setFault(errorCode.getDescription()); completionTime.getProperties().add(new Property("http.status_code", String.valueOf(errorCode.getCode()))); } }
Source:
<code>private boolean haveNotExpiredFailedDestination(URI uri) { if(!failedDestinations.containsKey(uri)) return false; else { long failureTimestamp = failedDestinations.get(uri); long delta = System.currentTimeMillis() - failureTimestamp; <START> return delta < 5000; <END> } }</code><technical_language>Please, hard code of timeout</technical_language>

Target:
private boolean haveNotExpiredFailedDestination(URI uri) { if(!failedDestinations.containsKey(uri)) return false; else { long failureTimestamp = failedDestinations.get(uri); long delta = System.nanoTime() - failureTimestamp; return delta < DESTINATION_RECHECK_INTERVAL; } }
Source:
<code>private @Nullable Collection<@NonNull ISegment> getSegmentStore(long start, long end) { IAnalysisModule segmentStoreProviderModule = fSegmentStoreProviderModule; if (segmentStoreProviderModule == null) { <START> return null; <END> } ITmfTrace trace = getTrace(); if (!(segmentStoreProviderModule instanceof ISegmentStoreProvider) || (trace == null)) { return Collections.EMPTY_LIST; } segmentStoreProviderModule.waitForCompletion(); @Nullable ISegmentStore<@NonNull ISegment> segmentStore = ((ISegmentStoreProvider) segmentStoreProviderModule).getSegmentStore(); return segmentStore != null ? start != TmfTimeRange.ETERNITY.getStartTime().toNanos() || end != TmfTimeRange.ETERNITY.getEndTime().toNanos() ? (Collection<@NonNull ISegment>) segmentStore.getIntersectingElements(start, end) : segmentStore : Collections.EMPTY_LIST; }</code><technical_language>return null instead of letting return a Collections.EMPTY_LIST below. In case, return null also</technical_language>

Target:
private @Nullable Collection<@NonNull ISegment> getSegmentStore(long start, long end) { IAnalysisModule segmentStoreProviderModule = fSegmentStoreProviderModule; if (!(segmentStoreProviderModule instanceof ISegmentStoreProvider)) { return null; } segmentStoreProviderModule.waitForCompletion(); @Nullable ISegmentStore<@NonNull ISegment> segmentStore = ((ISegmentStoreProvider) segmentStoreProviderModule).getSegmentStore(); return segmentStore != null ? start != TmfTimeRange.ETERNITY.getStartTime().toNanos() || end != TmfTimeRange.ETERNITY.getEndTime().toNanos() ? (Collection<@NonNull ISegment>) segmentStore.getIntersectingElements(start, end) : segmentStore : Collections.EMPTY_LIST; }
Source:
<code>public void setStartDate(Date startDate) { <START> this.startDate = startDate; <END> }</code><technical_language>Date instances mutable, this.startDate a copy of startDate avoid side-effects</technical_language>

Target:
public void setStartDate(Date startDate) { this.startDate = startDate == null ? null : new Date(startDate.getTime()); }
Source:
<code>public void run(RefactoringWizard wizard, Shell parent) { try { RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation( wizard); <START> DeleteQ7ElementProcessor processor = (DeleteQ7ElementProcessor) wizard.getRefactoring() <END> .getAdapter(DeleteQ7ElementProcessor.class); if (processor == null || (processor != null && checkWritableRefrences(processor))) { operation.run(parent, wizard.getWindowTitle()); } } catch (InterruptedException exception) { } }</code><technical_language>suspicious. Refactoring extended adding new participants, downcasting. current approach lacks atomicity - user allow step reject ones, witch leave workspace in intermediate state. Lets talk refactoring more in person</technical_language>

Target:
public void run(RefactoringWizard wizard, Shell parent) { try { RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation( wizard); operation.run(parent, wizard.getWindowTitle()); } catch (InterruptedException exception) { } }
Source:
<code>protected Filter.FilterResults performFiltering(CharSequence constraint) { String filterString = constraint.toString().toLowerCase(); <START> final ArrayList<T> list = new ArrayList<T>(rowValueList.size()); <END> for (T item : rowValueList) { for (ListItemFilter filterCriteria : filterItemList) { if (filterCriteria.passes(item, filterString)) { list.add(item); } } } FilterResults results = new FilterResults(); results.values = list; results.count = list.size(); return results; }</code><technical_language>Do need create a list of size of entire original list</technical_language>

Target:
protected Filter.FilterResults performFiltering(CharSequence constraint) { String filterString = constraint.toString().toLowerCase(); final ArrayList<T> list = new ArrayList<T>(); for (T item : rowValueList) { if (listItemFilter.passes(item, filterString)) { list.add(item); } } FilterResults results = new FilterResults(); results.values = list; results.count = list.size(); return results; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.stats_loading_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setTitle(R.string.stats); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } String action = getIntent().getAction(); Uri uri = getIntent().getData(); AnalyticsUtils.trackWithDeepLinkData(AnalyticsTracker.Stat.DEEP_LINKED, action, uri); if (Intent.ACTION_VIEW.equals(action) && uri != null) { reason = uri.getQueryParameter("reason"); source = Source.fromString(uri.getQueryParameter("source")); if (mAccountStore.hasAccessToken()) { trackSuccess(source); <START> if (source == Source.STATS) { <END> showStats(); } else { finish(); } } else { Intent loginIntent = new Intent(this, LoginActivity.class); LoginMode.JETPACK_STATS.putInto(loginIntent); this.startActivityForResult(loginIntent, JETPACK_LOGIN); } } else { finish(); } }</code><technical_language>This code simplified improved a bit if extract a method: if (source == Source.STATS) { showStats(); } else { finish(); } Especially if (requestCode == RequestCodes.JETPACK_LOGIN && resultCode == RESULT_OK && source == Source.STATS) a tricky, else statement handle a result code, a event finish() activity. So, this work better: private void trackAndFinishActivity() { JetpackConnectionWebViewActivity.trackWithSource(AnalyticsTracker.Stat.SIGNED_INTO_JETPACK, source); if (source == Source.STATS) { showStats(); } else { finish(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.JETPACK_LOGIN && resultCode == RESULT_OK) { trackAndFinishActivity(); } } _The method name better_</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); setContentView(R.layout.stats_loading_activity); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setElevation(0); actionBar.setTitle(R.string.stats); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } String action = getIntent().getAction(); Uri uri = getIntent().getData(); AnalyticsUtils.trackWithDeepLinkData(Stat.DEEP_LINKED, action, uri); if (Intent.ACTION_VIEW.equals(action) && uri != null) { mReason = uri.getQueryParameter(REASON_PARAM); mSource = Source.fromString(uri.getQueryParameter(SOURCE_PARAM)); if (mAccountStore.hasAccessToken()) { trackResult(); finishAndGoBackToSource(); } else { Intent loginIntent = new Intent(this, LoginActivity.class); LoginMode.JETPACK_STATS.putInto(loginIntent); this.startActivityForResult(loginIntent, JETPACK_LOGIN); } } else { finish(); } }
Source:
<code>public void shouldGetAPluginAgentReportWhenPluginSupportsStatusReport() { final Capabilities capabilities = new Capabilities(false, true); final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false); elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities)); when(registry.getAgentStatusReport("cd.go.example.plugin", null, "some-id")) .thenReturn("<div>This is a agent status report snippet.</div>"); final String pluginStatusReport = service.getAgentStatusReport("cd.go.example.plugin", null, "some-id"); <START> assertThat(pluginStatusReport, is("<div>This is a agent status report snippet.</div>")); <END> }</code><technical_language>Rename variable agentStatusReport</technical_language>

Target:
public void shouldGetAPluginAgentReportWhenPluginSupportsStatusReport() { final Capabilities capabilities = new Capabilities(false, true); final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false); elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities)); when(registry.getAgentStatusReport("cd.go.example.plugin", null, "some-id")) .thenReturn("<div>This is a agent status report snippet.</div>"); final String agentStatusReport = service.getAgentStatusReport("cd.go.example.plugin", null, "some-id"); assertThat(agentStatusReport, is("<div>This is a agent status report snippet.</div>")); }
Source:
<code>protected void refresh(final boolean isFirst) { final int rpcseq = ++rpcSequence; script = null; comments = null; PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, scriptSettings, new GerritCallback<PatchScript>() { public void onSuccess(final PatchScript result) { if (rpcSequence == rpcseq) { script = result; onResult(); } } @Override public void onFailure(final Throwable caught) { if (rpcSequence == rpcseq) { <START> if (caught instanceof RemoteJsonException && !isFirst) { <END> historyTable.enableAll(true); showPatch(false); } else { super.onFailure(caught); } } } }); PatchUtil.DETAIL_SVC.patchComments(patchKey, idSideA, idSideB, new GerritCallback<CommentDetail>() { public void onSuccess(final CommentDetail result) { if (rpcSequence == rpcseq) { comments = result; onResult(); } } @Override public void onFailure(Throwable caught) { if (!isNoSuchEntity(caught) && rpcSequence == rpcseq) { super.onFailure(caught); } } }); }</code><technical_language>concerned this ignores RPC error. Also, I tell, show "No Differences" label anymore, reach showPatch(false) code path</technical_language>

Target:
protected void refresh(final boolean isFirst) { final int rpcseq = ++rpcSequence; script = null; comments = null; PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, scriptSettings, new GerritCallback<PatchScript>() { public void onSuccess(final PatchScript result) { if (rpcSequence == rpcseq) { script = result; onResult(); } } @Override public void onFailure(final Throwable caught) { if (rpcSequence == rpcseq) { super.onFailure(caught); } } }); PatchUtil.DETAIL_SVC.patchComments(patchKey, idSideA, idSideB, new GerritCallback<CommentDetail>() { public void onSuccess(final CommentDetail result) { if (rpcSequence == rpcseq) { comments = result; onResult(); } } @Override public void onFailure(Throwable caught) { if (!isNoSuchEntity(caught) && rpcSequence == rpcseq) { super.onFailure(caught); } } }); }
Source:
<code>public String render() { TypeSpec.Builder tableFactory = TypeSpec.classBuilder(getClassName()) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addAnnotation(AnnotationSpec.builder(Generated.class) .addMember("value", "$S", TableFactoryRenderer.class.getName()) .build()); <START> for (FieldSpec field : getFields()) { <END> tableFactory.addField(field); } for (TypeSpec subType : getSubTypes()) { tableFactory.addType(subType); } for (MethodSpec method : getConstructors()) { tableFactory.addMethod(method); } for (MethodSpec method : getMethods()) { tableFactory.addMethod(method); } JavaFile javaFile = JavaFile.builder(packageName, tableFactory.build()) .indent(" ") .build(); return javaFile.toString(); }</code><technical_language>able replace multiple for loops a method lambdas, replace for a call like: buildFactory(getFeilds(), TypeSpec.Builder::addField, tableFactory)</technical_language>

Target:
public String render() { TypeSpec.Builder tableFactory = TypeSpec.classBuilder(getClassName()) .addModifiers(Modifier.PUBLIC, Modifier.FINAL) .addAnnotation(AnnotationSpec.builder(Generated.class) .addMember("value", "$S", TableFactoryRenderer.class.getName()) .build()); buildFactory(this::getFields, tableFactory::addField); buildFactory(this::getSubTypes, tableFactory::addType); buildFactory(this::getConstructors, tableFactory::addMethod); buildFactory(this::getMethods, tableFactory::addMethod); JavaFile javaFile = JavaFile.builder(packageName, tableFactory.build()) .indent(" ") .build(); return javaFile.toString(); }
Source:
<code>KafkaConsumer cqlContentBootstrapWorker() { ContentBootstrapWorker worker = ContentBootstrapWorker.create( persistence.legacyContentResolver(), persistence.cqlContentStore(), metricsModule.metrics().timer("CqlContentBootstrapWorker"), metricsModule.metrics().meter("CqlContentBootstrapWorker.notWritten"), metricsModule.metrics().meter("CqlContentBootstrapWorker.errorRate") ); return bootstrapQueueFactory() .createConsumer( worker, new EntityUpdatedLegacyMessageSerializer(), contentChanges, "CqlContentBootstrap" ) .withConsumerSystem(consumerSystem) <START> .withDefaultConsumers(contentChangesNumOfConsumers) <END> .withMaxConsumers(contentChangesNumOfConsumers) .withPersistentRetryPolicy(persistence.databasedWriteMongo()) .build(); }</code><technical_language>Ideally separate configuration values tune this store's worker separately other one</technical_language>

Target:
KafkaConsumer cqlContentBootstrapWorker() { ContentBootstrapWorker worker = ContentBootstrapWorker.create( persistence.legacyContentResolver(), persistence.cqlContentStore(), metricsModule.metrics().timer("CqlContentBootstrapWorker"), metricsModule.metrics().meter("CqlContentBootstrapWorker.notWritten"), metricsModule.metrics().meter("CqlContentBootstrapWorker.errorRate") ); return bootstrapQueueFactory() .createConsumer( worker, new EntityUpdatedLegacyMessageSerializer(), contentChanges, "CqlContentBootstrap" ) .withConsumerSystem(consumerSystem) .withDefaultConsumers(cqlContentChangesNumOfConsumers) .withMaxConsumers(cqlContentChangesNumOfConsumers) .withPersistentRetryPolicy(persistence.databasedWriteMongo()) .build(); }
Source:
<code><START> String convert(Blob blob) { <END> if (blob.getLength() == 0L) { return ""; } try (InputStream stream = blob.getStream()) { Xml2TextHandler xml2text = new Xml2TextHandler(); return xml2text.parse(stream); } catch (IOException | SAXException | ParserConfigurationException e) { throw new ConversionException("Error during XML2Text conversion", e, blob); } }</code><technical_language>Please, do change method signature for compatibility, deprecate if needed add a new one</technical_language>

Target:
protected String convert(Blob blob) { if (blob.getLength() == 0L) { return ""; } try (InputStream stream = blob.getStream()) { Xml2TextHandler xml2text = new Xml2TextHandler(); return xml2text.parse(stream); } catch (IOException | SAXException | ParserConfigurationException e) { throw new ConversionException("Error during XML2Text conversion", blob, e); } }
Source:
<code>void asyncDiscardCheckpointAndCountCheckpoint(ThrowingConsumer<CompletedCheckpoint, Exception> discardCallback, Executor executor){ <START> cleanCallback.accept(() -> { try { discardCallback.accept(this); <END> } catch (Exception e) { LOG.warn("Could not discard completed checkpoint {}.", checkpointID, e); } }, checkpointCleaningFinishedCallback, executor); }</code><technical_language>This callback calling callback callback.accept(this) readable me. discardCallback, I see: 1. a call CompletedCheckpoint.doDiscard if some condition is true 1. condition evaluated early Therefore, get rid of by: 1. evaluating condition ASAP in ZooKeeperCompletedCheckpointStore (maybe extract methods CompletedCheckpoint.shouldDiscardOnShutdown OnSubsume) 1. passing boolean discard tryRemoveCompletedCheckpoint instead of callback 1. replacing discardCallback.accept(this); if (discard) this.doDiscard();. in CompletedCheckpoint.asyncDiscardCheckpointAndCountCheckpoint: WDYT</technical_language>

Target:
void asyncDiscardCheckpointAndCountCheckpoint(ThrowingConsumer<CompletedCheckpoint, Exception> discardCallback, Executor executor){ cleanupCallback.accept(() -> { try { discardCallback.accept(this); } catch (Exception e) { LOG.warn("Could not discard completed checkpoint {}.", checkpointID, e); } }, cleanupFinishedCallback, executor); }
Source:
<code>public void activate() { <START> logger.info("Activate DSC Alarm"); <END> }</code><technical_language>please decrease severity "debug"</technical_language>

Target:
public void activate() { logger.debug("Activate DSC Alarm"); }
Source:
<code>public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) <START> { <END> OGCGeometry leftGeometry = deserialize(leftBlock.getSlice(leftPosition, 0, leftBlock.getSliceLength(leftPosition))); OGCGeometry rightGeometry = deserialize(rightBlock.getSlice(rightPosition, 0, rightBlock.getSliceLength(rightPosition))); return leftGeometry.Equals(rightGeometry); }</code><technical_language>Do sense add EQUALS operator (and HASH) well? is clear is where, subject changed</technical_language>

Target:
public boolean equalTo(Block leftBlock, int leftPosition, Block rightBlock, int rightPosition) { if (leftBlock.isNull(leftPosition)) { return rightBlock.isNull(rightPosition); } if (rightBlock.isNull(rightPosition)) { return false; } OGCGeometry leftGeometry = deserialize(leftBlock.getSlice(leftPosition, 0, leftBlock.getSliceLength(leftPosition))); OGCGeometry rightGeometry = deserialize(rightBlock.getSlice(rightPosition, 0, rightBlock.getSliceLength(rightPosition))); return leftGeometry.Equals(rightGeometry); }
Source:
<code>public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, Set<TaskStatus> statusFilter, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException { String userName = null; if (mytasks) { <START> userName = frontendState.checkPermission("frontendState", "You do not have permission to use frontendState") <END> .getUsername(); } return dbManager.getTaskStates(from, to, taskTag, offset, limit, userName, statusFilter, sortParams); }</code><technical_language>This permission exist I "getTaskStates" in code</technical_language>

Target:
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, Set<TaskStatus> statusFilter, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException { String userName = null; if (mytasks) { userName = frontendState.checkPermission("getTaskStates", "You do not have permission to use frontendState") .getUsername(); } return dbManager.getTaskStates(from, to, taskTag, offset, limit, userName, statusFilter, sortParams); }
Source:
<code><START> public void testBrokenSymlinkAttributes() throws Exception { <END> if (!canCreateSymLinks()) return; makeLinkStructure(); ensureDoesNotExist(aDir); ensureDoesNotExist(aFile); fetchFileInfos(); assertFalse(ilFile.exists()); assertFalse(ilFile.isDirectory()); assertFalse(illFile.exists()); assertFalse(illFile.isDirectory()); assertFalse(ilDir.exists()); assertFalse(ilDir.isDirectory()); assertFalse(illDir.exists()); assertFalse(illDir.isDirectory()); assertEquals(ilFile.getLastModified(), 0); assertEquals(ilFile.getLength(), 0); assertEquals(ilDir.getLastModified(), 0); assertEquals(ilDir.getLength(), 0); assertEquals(illFile.getLastModified(), 0); assertEquals(illFile.getLength(), 0); assertEquals(illDir.getLastModified(), 0); assertEquals(illDir.getLength(), 0); assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }</code><technical_language>throws clause is needed here</technical_language>

Target:
public void testBrokenSymlinkAttributes() { if (!canCreateSymLinks()) return; makeLinkStructure(); ensureDoesNotExist(aDir); ensureDoesNotExist(aFile); fetchFileInfos(); assertFalse(ilFile.exists()); assertFalse(ilFile.isDirectory()); assertFalse(illFile.exists()); assertFalse(illFile.isDirectory()); assertFalse(ilDir.exists()); assertFalse(ilDir.isDirectory()); assertFalse(illDir.exists()); assertFalse(illDir.isDirectory()); assertEquals(ilFile.getLastModified(), 0); assertEquals(ilFile.getLength(), 0); assertEquals(ilDir.getLastModified(), 0); assertEquals(ilDir.getLength(), 0); assertEquals(illFile.getLastModified(), 0); assertEquals(illFile.getLength(), 0); assertEquals(illDir.getLastModified(), 0); assertEquals(illDir.getLength(), 0); assertTrue(ilFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aFile"); assertTrue(ilDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(ilDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "aDir"); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }
Source:
<code><START> public boolean doIsTablePresent(Connection conn, String tablesTable, String schemaColumn, String tableNameColumn, String schemaName, String tableName) throws JdbcException { <END> boolean isPresent = Boolean.FALSE; if (StringUtils.isNotEmpty(schemaName)) { if (StringUtils.isNotEmpty(schemaColumn)) { isPresent = this.isTablePresent(conn, tablesTable, schemaColumn); } else { throw new JdbcException("no schemaColumn present in table +tablesTable+ to test for presence of table +tableName+ in schema ["+schemaName+"]"); } } try { isPresent = this.isTablePresent(conn, tablesTable); } catch (Exception e) { log.warn("could not determine presence of table ["+tableName+"]",e); } return isPresent; }</code><technical_language>doIsTablePresent() public. is enable subclasses provide alternative implementation for isTablePresent, if generic implementation work for them. Please convert original implementation a literal query a query parameters. Please remove implementation of of isTablePresent(), (that call doIsTablePresent()) H2DbmsSupport, MsSqlServerDbmsSupport OracleDbmsSupport, default getMetaData()</technical_language>

Target:
protected boolean doIsTablePresent(Connection conn, String tablesTable, String schemaColumn, String tableNameColumn, String schemaName, String tableName) throws JdbcException { String query="select count(*) from "+tablesTable+" where upper("+tableNameColumn+")=?"; if (StringUtils.isNotEmpty(schemaName)) { if (StringUtils.isNotEmpty(schemaColumn)) { query+=" and upper("+schemaColumn+")='"+schemaName.toUpperCase()+"'"; } else { throw new JdbcException("no schemaColumn present in table +tablesTable+ to test for presence of table +tableName+ in schema ["+schemaName+"]"); } } try { return JdbcUtil.executeIntQuery(conn, query, tableName.toUpperCase())>=1; } catch (Exception e) { log.warn("could not determine presence of table ["+tableName+"]",e); return false; } }
Source:
<code>void handlePriorityChange(StreamPriority streamPriority) { System.out.println(getClass().getName() + ".handlePriorityChange(" + streamPriority + ")"); synchronized (conn) { Handler<StreamPriority> handler = streamPriorityHandler; if (handler != null) { if(streamPriority != null && !streamPriority.equals(getStreamPriority())) { setStreamPriority(streamPriority); <START> handler.handle(streamPriority); <END> } } } }</code><technical_language>read handler in synchronized block call handler of synchronized block</technical_language>

Target:
void handlePriorityChange(StreamPriority streamPriority) { Handler<StreamPriority> handler; boolean priorityChanged = false; synchronized (conn) { handler = streamPriorityHandler; if(streamPriority != null && !streamPriority.equals(streamPriority())) { priority(streamPriority); priorityChanged = true; } } if (handler != null && priorityChanged) { handler.handle(streamPriority); } }
Source:
<code>public static String encodeTo(String url, String text) { <START> text = text.replace('\n', ' '); <END> try { return new ModelHyperlinkNote(url,text.length()).encode()+text; } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to serialize "+ModelHyperlinkNote.class,e); return text; } }</code><technical_language>I necessary. If text \n\r method replaces \n, String weird somehow</technical_language>

Target:
public static String encodeTo(String url, String text) { return HyperlinkNote.encodeTo(url, text, ModelHyperlinkNote::new); }
Source:
<code>public CouchDBMapping build() { if (mapping.getDatabaseName() == null) <START> throw new IllegalStateException("A collection is not specified"); <END> return mapping; }</code><technical_language>add this application logging of Slf4j</technical_language>

Target:
public CouchDBMapping build() { if (mapping.getDatabaseName() == null) { LOG.error("A collection is not specified"); throw new IllegalStateException("A collection is not specified"); } return mapping; }
Source:
<code>public void prepare(CastContext context, ConfigurationSection parameters) { super.prepare(context, parameters); this.message = parameters.getString("message"); this.randomizedMessages = parameters.getStringList("randomized_messages"); this.translateAltColorCodes = parameters.getBoolean("translate_alt_color_codes", true); <START> this.altColorCode = parameters.getString("alt_color_code", "&").charAt(0); <END> }</code><technical_language>is this useful? user do a find replace if in a format</technical_language>

Target:
public void prepare(CastContext context, ConfigurationSection parameters) { super.prepare(context, parameters); this.message = context.getMessage(parameters.getString("message"), translate(parameters.getString("message"))); List<String> l = parameters.getStringList("randomized_messages"); if (!l.isEmpty()) this.message = translate(l.get(context.getRandom().nextInt(l.size()))); }
Source:
<code>public void populateOptions(WidgetConfig config, CodedWidget widget) { <START> List<Indicator> l = null; <END> String tag = config.getAttributeValue("tag", null); if (tag != null) { l = Context.getService(IndicatorService.class).getDefinitionsByTag(tag); } else { l = Context.getService(IndicatorService.class).getAllDefinitions(false); } for (Indicator d : l) { if (d instanceof CohortIndicator) { widget.addOption(new Option(d.getUuid(), d.getName(), null, d), config); } } }</code><technical_language>indicators a variable name l</technical_language>

Target:
public void populateOptions(WidgetConfig config, CodedWidget widget) { List<Indicator> listOfAllIndicators = null; String tag = config.getAttributeValue("tag", null); if (tag != null) { listOfAllIndicators = Context.getService(IndicatorService.class).getDefinitionsByTag(tag); } else { listOfAllIndicators = Context.getService(IndicatorService.class).getAllDefinitions(false); } for (Indicator indicator : listOfAllIndicators) { if (indicator instanceof CohortIndicator) { widget.addOption(new Option(indicator.getUuid(), indicator.getName(), null, indicator), config); } } }
Source:
<code>public URI uploadPackage() throws UploaderException { boolean fileExists = new File(topologyPackageLocation).isFile(); if (!fileExists) { throw new UploaderException( String.format("Topology file %s does not exist.", topologyPackageLocation)); } Path filePath = Paths.get(destTopologyFile); File parentDirectory = filePath.getParent().toFile(); assert parentDirectory != null; if (!parentDirectory.exists()) { LOG.fine("The working directory does not exist; creating it."); if (!parentDirectory.mkdirs()) { throw new UploaderException( String.format("Failed to create directory: %s", parentDirectory.getPath())); } } fileExists = new File(filePath.toString()).isFile(); if (fileExists) { LOG.fine("Target topology file " + filePath.toString() + " exists, overwriting..."); } LOG.fine("Copying topology " + topologyPackageLocation + " package to target working directory " + filePath.toString()); Path source = Paths.get(topologyPackageLocation); try { CopyOption[] options = new CopyOption[]{StandardCopyOption.REPLACE_EXISTING}; Files.copy(source, filePath, options); } catch (IOException ex) { <START> throw new UploaderException( <END> String.format("Unable to copy: %s %s", source.toString(), ex)); } return getUri(destTopologyFile); }</code><technical_language>cast caught exception a string, wrap UploaderException. include dest location: throw new UploaderException( String.format("Unable copy file %s %s", source.toString(), filePath), ex);</technical_language>

Target:
public URI uploadPackage() throws UploaderException { boolean fileExists = new File(topologyPackageLocation).isFile(); if (!fileExists) { throw new UploaderException( String.format("Topology package does not exist at '%s'", topologyPackageLocation)); } Path filePath = Paths.get(destTopologyFile); File parentDirectory = filePath.getParent().toFile(); assert parentDirectory != null; if (!parentDirectory.exists()) { LOG.fine(String.format( "Working directory does not exist. Creating it now at %s", parentDirectory.getPath())); if (!parentDirectory.mkdirs()) { throw new UploaderException( String.format("Failed to create directory for topology package at %s", parentDirectory.getPath())); } } fileExists = new File(filePath.toString()).isFile(); if (fileExists) { LOG.fine(String.format("Target topology package already exists at '%s'. Overwriting it now", filePath.toString())); } LOG.fine(String.format("Copying topology package at '%s' to target working directory '%s'", topologyPackageLocation, filePath.toString())); Path source = Paths.get(topologyPackageLocation); try { CopyOption[] options = new CopyOption[]{StandardCopyOption.REPLACE_EXISTING}; Files.copy(source, filePath, options); } catch (IOException e) { throw new UploaderException( String.format("Unable to copy topology file from '%s' to '%s'", source, filePath), e); } return getUri(destTopologyFile); }
Source:
<code>public void testHeaderIsValidWithBlankLines() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.blank-lines.header")); <START> checkConfig.addAttribute("ignoreLines", ""); <END> verify(checkConfig, getPath("InputHeaderBlankLines.java")); }</code><technical_language><LINK_0> ignoreLines empty default, mention</technical_language>

Target:
public void testHeaderIsValidWithBlankLines() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("InputHeaderjava.blank-lines.header")); verify(checkConfig, getPath("InputHeaderBlankLines.java")); }
Source:
<code>public AnnouncementCardView(Context context) { super(context); <START> inflate(getContext(), R.layout.view_card_announcement, <END> this); ButterKnife.bind(this); }</code><technical_language>context it</technical_language>

Target:
public AnnouncementCardView(Context context) { super(context); inflate(context, R.layout.view_card_announcement, this); ButterKnife.bind(this); }
Source:
<code>public void testSelectFloorOnTimeWithFilterOnFloorOnTime() { final String sql = "Select floor(\"__time\" to YEAR) as t from \"wikiticker\" " + "where floor(\"__time\" to YEAR) >= '2006-10-01 00:00:00 UTC' order by t limit 1"; final String druidQueryPart1 = "filter\":{\"type\":\"bound\",\"dimension\":\"__time\"," + "\"lower\":\"2006-10-01T00:00:00.000Z\",\"lowerStrict\":false," + "\"ordering\":\"lexicographic\",\"extractionFn\":{\"type\":\"timeFormat\"," + "\"format\":\"yyyy-MM-dd"; final String druidQueryPart2 = "\"granularity\":\"year\",\"timeZone\":\"UTC\"," + "\"locale\":\"en-US\"}},\"dimensions\":[],\"metrics\":[],\"granularity\":\"all\""; sql(sql, WIKI_AUTO2).queryContains(druidChecker(druidQueryPart1, druidQueryPart2)) <START> .returnsOrdered("T=1420070400000"); <END> }</code><technical_language>if this sense, query is Select floor(\"__time\" YEAR) result is T=1420070400000 expect 2006-10-01T00:00:00.000Z? Do add a cast? is SQL standard this Calcite handle queries? @jcamachor @nishantmonu51</technical_language>

Target:
public void testSelectFloorOnTimeWithFilterOnFloorOnTime() { final String sql = "Select cast(floor(\"timestamp\" to MONTH) as timestamp) as t from " + "\"foodmart\" where floor(\"timestamp\" to MONTH) >= '1997-05-01 00:00:00 UTC' order by t" + " limit 1"; final String druidQueryPart1 = "filter\":{\"type\":\"bound\",\"dimension\":\"__time\"," + "\"lower\":\"1997-05-01T00:00:00.000Z\",\"lowerStrict\":false," + "\"ordering\":\"lexicographic\",\"extractionFn\":{\"type\":\"timeFormat\"," + "\"format\":\"yyyy-MM-dd"; final String druidQueryPart2 = "\"granularity\":\"month\",\"timeZone\":\"UTC\"," + "\"locale\":\"en-US\"}},\"columns\":[\"__time\"],\"granularity\":\"all\""; sql(sql, FOODMART).queryContains(druidChecker(druidQueryPart1, druidQueryPart2)) .returnsOrdered("T=1997-05-01 00:00:00"); }
Source:
<code>public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { if (!getHelper().isPage200(msg)) { return; } String uri = msg.getRequestHeader().getURI().toString(); if (!msg.getResponseHeader().isImage() && !msg.getRequestHeader().isCss() && !msg.getResponseHeader().isCss()) { Repo repo = getRepo(); <START> if (repo == null) { <END> return; } Result result = getRepo().scanJS(msg); if (result == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("\tNo vulnerabilities found in record " + id + " with URL " + uri); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "\tVulnerabilities found in record " + id + " with URL:" + uri + " ,name:" + ((result.getFilename() == null) ? "" : result.getFilename()) + " and version:" + result.getVersion() + ", more info at:" + result.getInfo()); } String otherInfo = getDetails(Result.CVE, result.getInfo()); if (result.hasOtherInfo()) { otherInfo = otherInfo + result.getOtherinfo(); } buildAlert(result, otherInfo).raise(); } } }</code><technical_language>getRepo() == null, this done in initial if</technical_language>

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { if (!getHelper().isPage200(msg) || getRepo() == null) { return; } String uri = msg.getRequestHeader().getURI().toString(); if (!msg.getResponseHeader().isImage() && !msg.getRequestHeader().isCss() && !msg.getResponseHeader().isCss()) { Result result = getRepo().scanJS(msg); if (result == null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("\tNo vulnerabilities found in record " + id + " with URL " + uri); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "\tVulnerabilities found in record " + id + " with URL:" + uri + " ,name:" + ((result.getFilename() == null) ? "" : result.getFilename()) + " and version:" + result.getVersion() + ", more info at:" + result.getInfo()); } String otherInfo = getDetails(Result.CVE, result.getInfo()); if (result.hasOtherInfo()) { otherInfo = otherInfo + result.getOtherinfo(); } buildAlert(result, otherInfo).raise(); } } }
Source:
<code>public static void xmlClose(IBuffer result, String indent, String tag, String comment) { result.append(indent).append("</").append(tag).append(">") <START> .append(Strings.isNotNullAndNotEmpty(comment) ? comment : "") <END> .append(EOL); }</code><technical_language>add a method String getValueOrEmpty(String) return empty if null</technical_language>

Target:
public static void xmlClose(IBuffer result, String indent, String tag, String comment) { result.append(indent).append("</").append(tag).append(">") .append(Strings.getValueOrEmpty(comment)) .append(EOL); }