auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void endWindow() { if(leftCount == maxTuplesPerWindow && rightCount == maxTuplesPerWindow) { byte[] leftBytes = lmd.digest(); byte[] rightBytes = rmd.digest(); if(!MessageDigest.isEqual(leftBytes, rightBytes)) { try { out.writeBytes("Error: Kafka and RandomGenerator data are not equal"); out.flush(); } catch (IOException e) { throw new RuntimeException(e); } } lmd.reset(); rmd.reset(); leftCount = lqueue.size(); rightCount = rqueue.size(); if(lqueue.size() != 0) { int size = lqueue.size(); for(int i = 0; i < size; i++) { byte[] x = lqueue.poll(); <START> lmd.update(x); <END> } } if(rqueue.size() != 0) { int size = rqueue.size(); for(int i = 0; i < size; i++) { byte[] x = rqueue.poll(); rmd.update(x); } } } }</code><technical_language>Check if bulk update is possible</technical_language>

Target:
public void endWindow() { if(leftCount == maxTuplesPerWindow && rightCount == maxTuplesPerWindow) { byte[] leftBytes = lmd.digest(); byte[] rightBytes = rmd.digest(); if(!MessageDigest.isEqual(leftBytes, rightBytes)) { try { out.writeBytes("Error: Kafka and RandomGenerator data are not equal"); out.flush(); } catch (IOException e) { throw new RuntimeException("Unable to write " + e); } } lmd.reset(); rmd.reset(); leftCount = lqueue.size(); rightCount = rqueue.size(); if(lqueue.size() != 0) { int size = lqueue.size(); for(int i = 0; i < size; i++) { byte[] x = lqueue.poll(); lmd.update(x); } } if(rqueue.size() != 0) { int size = rqueue.size(); for(int i = 0; i < size; i++) { byte[] x = rqueue.poll(); rmd.update(x); } } } }
Source:
<code>public String getAttribute(Attribute attribute) { if (attribute.startsWith("can_build") && attribute.hasContext(1)) { dLocation location = dLocation.valueOf(attribute.getContext(1)); if (location == null ) { return null; } if (wgp.canBuild(player, location)) { return Element.TRUE.getAttribute(attribute.fulfill(1)); } return Element.FALSE.getAttribute(attribute.fulfill(1)); } if (attribute.startsWith("can_pvp")) { ApplicableRegionSet set = getApplicableRegions(); if (set.testState(wgp.wrapPlayer(player), DefaultFlag.PVP)) { return Element.TRUE.getAttribute(attribute.fulfill(1)); } <START> return Element.FALSE.getAttribute(attribute.fulfill(1)); <END> } return null; }</code><technical_language>this static field</technical_language>

Target:
public String getAttribute(Attribute attribute) { if (!attribute.startsWith("worldguard") && !attribute.startsWith("wg") ) { return null; } attribute = attribute.fulfill(1); if (attribute.startsWith("can_build") && attribute.hasContext(1)) { dLocation location = dLocation.valueOf(attribute.getContext(1)); if (location == null) { return null; } if (wgp.canBuild(player, location)) { return new Element(true).getAttribute(attribute.fulfill(1)); } return new Element(false).getAttribute(attribute.fulfill(1)); } if (attribute.startsWith("test_flag")) { if (!attribute.hasContext(1)) { dB.echoError("The tag p@player.worlduard.test_flag[...] must have a value."); return null; } StateFlag flag = getStateFlag(attribute.getContext(1)); if (flag == null) { dB.echoError("The tag p@player.worlduard.test_flag[...] has an invalid value: " + attribute.getContext(1)); return null; } ApplicableRegionSet set = getApplicableRegions(); if (set.testState(wgp.wrapPlayer(player), flag)) { return new Element(true).getAttribute(attribute.fulfill(1)); } return new Element(false).getAttribute(attribute.fulfill(1)); } return null; }
Source:
<code>public ClosableIterator<AgnosticLightResultRow> getAllRows( Iterable<byte[]> rows, ColumnSelection columns, long ts, boolean includeValues) { <START> return getAllRows(rows, columns, ts, includeValues, null); <END> }</code><technical_language>Passing null is ugly - DavidS said, prefer some kind of enum here</technical_language>

Target:
public ClosableIterator<AgnosticLightResultRow> getAllRows( Iterable<byte[]> rows, ColumnSelection columns, long ts, boolean includeValues) { return getAllRows(rows, columns, ts, includeValues, Order.UNDEFINED); }
Source:
<code>public Status insert(String table, String key, HashMap<String, ByteIterator> values) { try { <START> if (defaultCollection == null) { <END> createCollection(table); } BaseDocument toInsert = new BaseDocument(key); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { toInsert.addAttribute(entry.getKey(), byteIteratorToString(entry.getValue())); } arangoDriver.createDocument(table, toInsert, true , waitForSync); return Status.OK; } catch (ArangoException e) { if (e.getErrorNumber() != ErrorNums.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED) { logger.error("Fail to insert: " + table + " " + key, e); } else { logger.debug("Trying to create document with duplicate key: {}", table, key); return Status.BAD_REQUEST; } } catch (Exception e) { logger.error("Exception while trying insert " + table + " " + key, e); } return Status.ERROR; }</code><technical_language>this initial check for null is good avoid synchronization check DB instances, needed variable instance variable. Also, do this null check properly variable volatile ensure JVM properly handled fact of lock</technical_language>

Target:
public Status insert(String table, String key, HashMap<String, ByteIterator> values) { try { BaseDocument toInsert = new BaseDocument(key); for (Map.Entry<String, ByteIterator> entry : values.entrySet()) { toInsert.addAttribute(entry.getKey(), byteIteratorToString(entry.getValue())); } arangoDriver.createDocument(table, toInsert, true , waitForSync); return Status.OK; } catch (ArangoException e) { if (e.getErrorNumber() != ErrorNums.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED) { logger.error("Fail to insert: with ex {}", table, key, e.toString()); } else { logger.debug("Trying to create document with duplicate key: {}", table, key); return Status.BAD_REQUEST; } } catch (RuntimeException e) { logger.error("Exception while trying insert with ex {}", table, key, e.toString()); } return Status.ERROR; }
Source:
<code><START> public void upgradeShouldGiveProgressMonitorProgressMessages() throws Exception <END> { fileSystem.deleteFile( new File( dbDirectory, INTERNAL_LOG_FILE ) ); PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = new UpgradableDatabase( fileSystem, new StoreVersionCheck( pageCache ), getRecordFormats() ); AssertableLogProvider logProvider = new AssertableLogProvider(); newUpgrader( upgradableDatabase, pageCache, allowMigrateConfig, new VisibleMigrationProgressMonitor( logProvider.getLog( "test" ) ) ).migrateIfNeeded( dbDirectory ); logProvider.assertContainsLogCallContaining( "Store files" ); logProvider.assertContainsLogCallContaining( "Indexes" ); logProvider.assertContainsLogCallContaining( "Count rebuilding" ); logProvider.assertContainsLogCallContaining( "Successfully finished" ); }</code><technical_language>Nice test! for case do rebuild counts store</technical_language>

Target:
public void upgradeShouldGiveProgressMonitorProgressMessages() throws Exception { PageCache pageCache = pageCacheRule.getPageCache( fileSystem ); UpgradableDatabase upgradableDatabase = new UpgradableDatabase( fileSystem, new StoreVersionCheck( pageCache ), getRecordFormats() ); AssertableLogProvider logProvider = new AssertableLogProvider(); newUpgrader( upgradableDatabase, pageCache, allowMigrateConfig, new VisibleMigrationProgressMonitor( logProvider.getLog( "test" ) ) ).migrateIfNeeded( dbDirectory ); logProvider.assertContainsLogCallContaining( "Store files" ); logProvider.assertContainsLogCallContaining( "Indexes" ); logProvider.assertContainsLogCallContaining( "Count rebuilding" ); logProvider.assertContainsLogCallContaining( "Successfully finished" ); }
Source:
<code><START> public RemoteBitrateEstimatorSingleStream getRemoteBitrateEstimator() <END> { return remoteBitrateEstimator; }</code><technical_language>question</technical_language>

Target:
public RemoteBitrateEstimator getRemoteBitrateEstimator() { return remoteBitrateEstimator; }
Source:
<code>public boolean isAggregator(String aggregatorName) { try { if( classToIncrementalAggregatorName.values().contains(aggregatorName) || nameToOTFAggregator.containsKey(aggregatorName)) return true; String aggregatorType = aggregatorName.split("-")[0]; return (AggregatorTopBottomType.valueOf(aggregatorType) != null); } <START> catch(Exception e) <END> { lOG.error(e.getMessage()); return false; } }</code><technical_language>catch exception</technical_language>

Target:
public boolean isAggregator(String aggregatorName) { if( classToIncrementalAggregatorName.values().contains(aggregatorName) || nameToOTFAggregator.containsKey(aggregatorName)) return true; String aggregatorType = aggregatorName.split("-")[0]; return (AggregatorTopBottomType.valueOf(aggregatorType) != null); }
Source:
<code>public void process() { List<CrewMember> otherPublisherPeople = getOtherPublisherPeople(film); if (otherPublisherPeople.isEmpty()) { film.setPeople(ImmutableList.copyOf( Iterables.concat( getActors(filmElement.getFirstChildElement("cast")), <START> getDirectors(filmElement.getFirstChildElement("direction")) <END> ))); } else { film.setPeople(otherPublisherPeople); } people = Lists.newArrayList( Iterables.concat( makeActors(filmElement.getFirstChildElement("cast")), makeDirectors(filmElement.getFirstChildElement("direction")), makeWriters(filmElement.getFirstChildElement("writing")) )); }</code><technical_language>extract strings constants</technical_language>

Target:
public void process() { List<CrewMember> otherPublisherPeople = getOtherPublisherPeople(film); if (otherPublisherPeople.isEmpty()) { film.setPeople(ImmutableList.copyOf( Iterables.concat( getActors(filmElement.getFirstChildElement(CAST)), getDirectors(filmElement.getFirstChildElement(DIRECTION)) ))); } else { film.setPeople(otherPublisherPeople); } people = Lists.newArrayList( Iterables.concat( makeActors(filmElement.getFirstChildElement(CAST)), makeDirectors(filmElement.getFirstChildElement(DIRECTION)), makeWriters(filmElement.getFirstChildElement(WRITING)) )); }
Source:
<code>public JwtDecoder createDecoder(ClientRegistration clientRegistration) { return this.jwtDecoders.computeIfAbsent(clientRegistration.getRegistrationId(), key -> { if (!StringUtils.hasText(clientRegistration.getProviderDetails().getJwkSetUri())) { OAuth2Error oauth2Error = new OAuth2Error( MISSING_SIGNATURE_VERIFIER_ERROR_CODE, "Failed to find a Signature Verifier for Client Registration: '" + clientRegistration.getRegistrationId() + "'. Check to ensure you have configured the JwkSet URI.", null ); throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString()); } String jwkSetUri = clientRegistration.getProviderDetails().getJwkSetUri(); NimbusJwtDecoder jwtDecoder = new NimbusJwtDecoder(withJwkSetUri(jwkSetUri).build()); <START> OAuth2TokenValidator<Jwt> jwtValidator = new DelegatingOAuth2TokenValidator<>(jwtValidatorFactory.apply(clientRegistration)); <END> jwtDecoder.setJwtValidator(jwtValidator); return jwtDecoder; }); }</code><technical_language>need DelegatingOAuth2TokenValidator assigning returned instance</technical_language>

Target:
public JwtDecoder createDecoder(ClientRegistration clientRegistration) { Assert.notNull(clientRegistration, "clientRegistration cannot be null."); return this.jwtDecoders.computeIfAbsent(clientRegistration.getRegistrationId(), key -> { if (!StringUtils.hasText(clientRegistration.getProviderDetails().getJwkSetUri())) { OAuth2Error oauth2Error = new OAuth2Error( MISSING_SIGNATURE_VERIFIER_ERROR_CODE, "Failed to find a Signature Verifier for Client Registration: '" + clientRegistration.getRegistrationId() + "'. Check to ensure you have configured the JwkSet URI.", null ); throw new OAuth2AuthenticationException(oauth2Error, oauth2Error.toString()); } String jwkSetUri = clientRegistration.getProviderDetails().getJwkSetUri(); NimbusJwtDecoder jwtDecoder = new NimbusJwtDecoder(withJwkSetUri(jwkSetUri).build()); OAuth2TokenValidator<Jwt> jwtValidator = jwtValidatorFactory.apply(clientRegistration); jwtDecoder.setJwtValidator(jwtValidator); return jwtDecoder; }); }
Source:
<code>public List<T> value(boolean forceRefresh) { if (forceRefresh) { m_value = null; <START> return value(); <END> } return value(); }</code><technical_language>remove line rely one</technical_language>

Target:
public List<T> value(boolean forceRefresh) { if (forceRefresh) { m_value = null; } return value(); }
Source:
<code>private List<NameInformation> getInterfaceNames() { if (interfaceNames == null) { findAllNames(); Set<IVariable> externalReads = getVariablesReadOutside(); Set<IASTName> declarations = new HashSet<>(); interfaceNames = new ArrayList<>(); for (NameInformation nameInfo : names) { IASTName declarationName = nameInfo.getDeclarationName(); if (declarations.add(declarationName)) { if (isDeclaredInSelection(nameInfo)) { if (externalReads.contains(nameInfo.getName().resolveBinding())) { nameInfo.setMustBeReturnValue(true); interfaceNames.add(nameInfo); } } else { IASTDeclarator declarator = (IASTDeclarator) declarationName.getParent(); if (!hasReferenceOperator(declarator)) { for (NameInformation n2 : names) { if (n2.getDeclarationName() == declarationName) { Optional<Integer> flag = CPPVariableReadWriteFlags.getReadWriteFlags(n2.getName()); <START> if (!flag.isPresent() || (flag.get() & PDOMName.WRITE_ACCESS) != 0) { <END> nameInfo.setWriteAccess(true); break; } } } if (nameInfo.isWriteAccess() && externalReads.contains(nameInfo.getName().resolveBinding())) { nameInfo.setOutput(true); } } interfaceNames.add(nameInfo); } } } } return interfaceNames; }</code><technical_language>This another place mayBeWriteAccess()</technical_language>

Target:
private List<NameInformation> getInterfaceNames() { if (interfaceNames == null) { findAllNames(); Set<IVariable> externalReads = getVariablesReadOutside(); Set<IASTName> declarations = new HashSet<>(); interfaceNames = new ArrayList<>(); for (NameInformation nameInfo : names) { IASTName declarationName = nameInfo.getDeclarationName(); if (declarations.add(declarationName)) { if (isDeclaredInSelection(nameInfo)) { if (externalReads.contains(nameInfo.getName().resolveBinding())) { nameInfo.setMustBeReturnValue(true); interfaceNames.add(nameInfo); } } else { IASTDeclarator declarator = (IASTDeclarator) declarationName.getParent(); if (!hasReferenceOperator(declarator)) { for (NameInformation n2 : names) { if (n2.getDeclarationName() == declarationName) { Optional<Integer> flags = CPPVariableReadWriteFlags.getReadWriteFlags(n2.getName()); if (CPPVariableReadWriteFlags.mayBeWriteAccess(flags)) { nameInfo.setWriteAccess(true); break; } } } if (nameInfo.isWriteAccess() && externalReads.contains(nameInfo.getName().resolveBinding())) { nameInfo.setOutput(true); } } interfaceNames.add(nameInfo); } } } } return interfaceNames; }
Source:
<code>public static void main(String[] args) { ZipkinTraceExporter.createAndRegister("http://localhost:9411/api/v2/spans", "tracing-to-zipkin-service"); TraceConfig traceConfig = Tracing.getTraceConfig(); TraceParams activeTraceParams = traceConfig.getActiveTraceParams(); traceConfig.updateActiveTraceParams(activeTraceParams.toBuilder().setSampler(Samplers.alwaysSample()).build()); Tracer tracer = Tracing.getTracer(); Scope scope = tracer.spanBuilder("user-parent-span").startScopedSpan(); try { String queueURL = String.format("<LINK_0>", ACCOUNT_NAME, QUEUE_NAME, SAS_TOKEN); QueueAsyncClient queueAsyncClient = new QueueClientBuilder().endpoint(queueURL).buildAsyncClient(); <START> queueAsyncClient.create() <END> .doOnSuccess(response -> queueAsyncClient.enqueueMessage("This is message 1")) .then(queueAsyncClient.enqueueMessage("This is message 2")) .subscriberContext(Context.of(OPENCENSUS_SPAN_KEY, tracer.getCurrentSpan())) .subscribe( response -> System.out.printf("Message successfully enqueued by queueAsyncClient. Message id: %s%n", response.getMessageId()), err -> System.out.printf("Error thrown when enqueue the message. Error message: %s%n", err.getMessage()), () -> System.out.println("The enqueue has been completed.")); } finally { scope.close(); } Tracing.getExportComponent().shutdown(); }</code><technical_language>subscribe is non-blocking. scope close immediately message is event sent</technical_language>

Target:
public static void main(String[] args) throws InterruptedException { ZipkinTraceExporter.createAndRegister("http://localhost:9411/api/v2/spans", "tracing-to-zipkin-service"); TraceConfig traceConfig = Tracing.getTraceConfig(); TraceParams activeTraceParams = traceConfig.getActiveTraceParams(); traceConfig.updateActiveTraceParams(activeTraceParams.toBuilder().setSampler(Samplers.alwaysSample()).build()); Tracer tracer = Tracing.getTracer(); Semaphore semaphore = new Semaphore(1); Scope scope = tracer.spanBuilder("user-parent-span").startScopedSpan(); semaphore.acquire(); String queueURL = String.format("<LINK_0>", ACCOUNT_NAME, QUEUE_NAME, "<GENERATED_SAS_TOKEN>"); QueueAsyncClient queueAsyncClient = new QueueClientBuilder().endpoint(queueURL).buildAsyncClient(); queueAsyncClient.create() .doOnSuccess(response -> queueAsyncClient.enqueueMessage("This is message 1")) .then(queueAsyncClient.enqueueMessage("This is message 2")) .subscriberContext(Context.of(OPENCENSUS_SPAN_KEY, tracer.getCurrentSpan())) .subscribe( response -> System.out.printf("Message successfully enqueued by queueAsyncClient. Message id: %s%n", response.getMessageId()), err -> { System.out.printf("Error thrown when enqueue the message. Error message: %s%n", err.getMessage()); scope.close(); semaphore.release(); }, () -> { scope.close(); semaphore.release(); System.out.println("The enqueue has been completed."); Tracing.getExportComponent().shutdown(); }); }
Source:
<code>public static void main(String[] args) throws Exception { final String clientId = "user"; final String clientSecret = "password"; final String idpEndpoint = "http://idp-host:idp-port/auth/realms/master/protocol/openid-connect/token"; <START> final String stsEndpoint = "http://sts-host:sts-port/sts"; <END> final String idpClientId = "minio-client-id"; final CredentialsProvider credentialsProvider = new WebIdentityCredentialsProvider( stsEndpoint, () -> getTokenAndExpiry(clientId, clientSecret, idpClientId, idpEndpoint)); final MinioClient minioClient = MinioClient.builder() .endpoint("http://minio-host:minio-port") .credentialsProvider(credentialsProvider) .build(); final List<Bucket> buckets = minioClient.listBuckets(); for (Bucket bucket : buckets) { System.out.print(bucket.name() + " created at "); System.out.println(bucket.creationDate()); } }</code><technical_language>suggestion final String stsEndpoint = "http://sts-host:sts-port/";</technical_language>

Target:
public static void main(String[] args) throws Exception { final String clientId = "user"; final String clientSecret = "password"; final String idpEndpoint = "http://idp-host:idp-port/auth/realms/master/protocol/openid-connect/token"; final String stsEndpoint = "http://sts-host:sts-port/"; final String idpClientId = "minio-client-id"; final Provider credentialsProvider = new WebIdentityProvider( stsEndpoint, () -> getTokenAndExpiry(clientId, clientSecret, idpClientId, idpEndpoint)); final MinioClient minioClient = MinioClient.builder() .endpoint("http://minio-host:minio-port") .credentialsProvider(credentialsProvider) .build(); final List<Bucket> buckets = minioClient.listBuckets(); for (Bucket bucket : buckets) { System.out.print(bucket.name() + " created at "); System.out.println(bucket.creationDate()); } }
Source:
<code><START> public DDF transformScaleStandard(List<String> columns, Boolean inPlace) throws DDFException { <END> Summary[] summaryArr = this.getDDF().getSummary(); StringBuilder sqlCmdBuffer = new StringBuilder("SELECT "); for (int colIndex = 0; colIndex < this.getDDF().getSchema().getNumColumns(); colIndex++) { Column col = this.getDDF().getSchema().getColumn(colIndex); if (!isColumnEligibleToScale(col, columns)) { sqlCmdBuffer.append(col.getName()).append(","); } else { if (summaryArr[colIndex] == null) { LOG.warn("Missing column summary. transformScaleStandard ignored for column: " + col.getName()); sqlCmdBuffer.append(col.getName()).append(" "); } else if (summaryArr[colIndex].stdev() == 0) { LOG.warn("standard deviation equals zero. transformScaleStandard ignored for column: " + col.getName()); sqlCmdBuffer.append(col.getName()).append(" "); } else { sqlCmdBuffer.append(String .format("((%s - %s) / %s) as %s ", col.getName(), summaryArr[colIndex].mean(), summaryArr[colIndex].stdev(), col.getName())); } sqlCmdBuffer.append(","); } } sqlCmdBuffer.setLength(sqlCmdBuffer.length() - 1); sqlCmdBuffer.append(" FROM ").append(this.getDDF().getTableName()); DDF newddf = this.getManager().sql2ddf(sqlCmdBuffer.toString(), this.getEngine()); newddf.getMetaDataHandler().copyFactor(this.getDDF()); return inPlace ? this.getDDF().updateInplace(newddf) : newddf; }</code><technical_language>Code pretty similar transformScaleMinmax. refactor this somehow</technical_language>

Target:
public DDF transformScaleStandard(List<String> columns, Boolean inPlace) throws DDFException { Summary[] summaryArr = this.getDDF().getSummary(); Schema schema = this.getDDF().getSchema(); StringBuilder sqlCmdBuffer = new StringBuilder("SELECT "); for (int colIndex = 0; colIndex < schema.getNumColumns(); colIndex++) { Column col = schema.getColumn(colIndex); String escapedColName = StringEscapeUtils.escapeJava(col.getName()); if (!isColumnEligibleToScale(col, columns)) { sqlCmdBuffer.append(escapedColName).append(","); } else { if (summaryArr[colIndex] == null) { LOG.warn("Missing column summary. transformScaleStandard ignored for column: " + col.getName()); sqlCmdBuffer.append(escapedColName).append(" "); } else if (summaryArr[colIndex].stdev() == 0) { LOG.warn("standard deviation equals zero. transformScaleStandard ignored for column: " + col.getName()); sqlCmdBuffer.append(escapedColName).append(" "); } else { sqlCmdBuffer.append(String .format("((%s - %s) / %s) as %s ", escapedColName, summaryArr[colIndex].mean(), summaryArr[colIndex].stdev(), escapedColName)); } sqlCmdBuffer.append(","); } } sqlCmdBuffer.setLength(sqlCmdBuffer.length() - 1); sqlCmdBuffer.append(" FROM ").append(StringEscapeUtils.escapeJava(schema.getTableName())); DDF newddf = this.getManager().sql2ddf(sqlCmdBuffer.toString(), this.getEngine()); newddf.getMetaDataHandler().copyFactor(this.getDDF()); return inPlace ? this.getDDF().updateInplace(newddf) : newddf; }
Source:
<code>void onRemove() { ConfirmationModel model = <START> (ConfirmationModel) getWindow(); <END> if (model.getProgress() != null) { return; } model.startProgress(); AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> { if (storagePools != null && !storagePools.isEmpty()) { StoragePool storagePool = storagePools.get(0); List<ActionParametersBase> prms = getRemoveUnregisteredEntityParams(storagePool.getId()); Frontend.getInstance().runMultipleAction(getRemoveActionType(), prms, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); } }), getEntity().getId()); }</code><technical_language>if (getWindow() != null ) {..}</technical_language>

Target:
private void onRemove() { if (getWindow() != null) { return; } ConfirmationModel model = (ConfirmationModel) getWindow(); if (model.getProgress() != null) { return; } model.startProgress(); AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> { if (storagePools != null && !storagePools.isEmpty()) { StoragePool storagePool = storagePools.get(0); List<ActionParametersBase> prms = getRemoveUnregisteredEntityParams(storagePool.getId()); Frontend.getInstance().runMultipleAction( getRemoveActionType(), prms, result -> { ConfirmationModel localModel = (ConfirmationModel) result.getState(); localModel.stopProgress(); cancel(); }, model); } }), getEntity().getId()); }
Source:
<code>public Builder services(Object... services) { if (services == null) { <START> this.services = new Object[0]; <END> } else { this.services = services; } return this; }</code><technical_language>I this is good behavior, services is equal null means called builder.services(null) forbidden. I allow case</technical_language>

Target:
public Builder services(Object... services) { checkNotNull(services); if (services != null) { this.services = services; } return this; }
Source:
<code>public NodeScheduler(NetworkTopology networkTopology, InternalNodeManager nodeManager, NodeSchedulerConfig config, NodeTaskMap nodeTaskMap) { <START> this(new NetworkLocationCache(networkTopology), networkTopology, nodeManager, config, nodeTaskMap, Duration.valueOf("5s")); <END> }</code><technical_language>nit: new Duration(5, SECONDS)</technical_language>

Target:
public NodeScheduler(NetworkTopology networkTopology, InternalNodeManager nodeManager, NodeSchedulerConfig config, NodeTaskMap nodeTaskMap) { this(new NetworkLocationCache(networkTopology), networkTopology, nodeManager, config, nodeTaskMap, new Duration(5, SECONDS)); }
Source:
<code>public void detectLowCoverageVertex() { VertexValueWritable vertex = getVertexValue(); <START> if (vertex.getAverageCoverage() <= minAverageCoverage || vertex.getAverageCoverage() >= maxAverageCoverage) { <END> broadcastKillself(); vertex.setState(State.DEAD_NODE); activate(); } else voteToHalt(); }</code><technical_language>v.cov < minAvgCov || c.cov > maxAvgCov</technical_language>

Target:
public void detectLowCoverageVertex() { VertexValueWritable vertex = getVertexValue(); if (vertex.getAverageCoverage() < minAverageCoverage || vertex.getAverageCoverage() > maxAverageCoverage) { broadcastKillself(); vertex.setState(State.DEAD_NODE); activate(); } else voteToHalt(); }
Source:
<code>static DateTimeDataValue toInstant(DataValueDescriptor s) throws StandardException { if(s == null) { return null; } <START> String hex = toHBaseEscaped(s.getString()); long value = Bytes.toLong(Bytes.toBytesBinary(hex)); long ts = System.currentTimeMillis() & (~TIMESTAMP_MASK); ts |= (value >> TIMESTAMP_SHIFT) & TIMESTAMP_MASK; return new SQLTimestamp(new Timestamp(ts)); <END> }</code><technical_language>this a static function. a unit test for toLongTimestamp public static long toLongTimestamp( String str, long time ) { String hex = toHBaseEscaped( str ); long = Bytes.toLong(Bytes.toBytesBinary(hex)); long ts = time & (~TIMESTAMP_MASK); ts |= (value >> TIMESTAMP_SHIFT) & TIMESTAMP_MASK; return ts; } static DateTimeDataValue toInstant(DataValueDescriptor s) throws StandardException { if(s == null) { return null; } long time = System.currentTimeMillis(); return new SQLTimestamp(new Timestamp( toLongTimestamp(s.getString(), time))); }</technical_language>

Target:
static DateTimeDataValue toInstant(DataValueDescriptor s) throws StandardException { if(s == null) { return null; } long value; try { String hex = toHBaseEscaped(s.getString()); value = Bytes.toLong(Bytes.toBytesBinary(hex)); } catch(IllegalArgumentException e) { throw StandardException.newException(SQLState.LANG_INVALID_FUNCTION_ARGUMENT, s, "TO_INSTANT"); } long ts = System.currentTimeMillis() & (~TIMESTAMP_MASK); ts |= (value >> TIMESTAMP_SHIFT) & TIMESTAMP_MASK; return new SQLTimestamp(new Timestamp(ts)); }
Source:
<code>public B setAccumuloUser(String user) { <START> Preconditions.checkNotNull(user, "User cannot be null."); <END> this.user = user; return confBuilder(); }</code><technical_language>checks happen build function delegated object building, a builder's set function. duplicate logic</technical_language>

Target:
public B setAccumuloUser(String user) { this.user = user; return confBuilder(); }
Source:
<code>public FetchGerritChangeWizard(Repository repository) { this(); <START> Assert.isNotNull(repository); <END> this.repository = repository; }</code><technical_language>replacing a NPE AssertionException ? try annotate method's parameter @NonNull watch out for "Null type safety" warnings in Eclipse fix them</technical_language>

Target:
public FetchGerritChangeWizard(Repository repository) { this(); this.repository = repository; }
Source:
<code>private void autosetEccFieldsForReleaseWithDownloadUrl(Release release, String contactPerson) { String url = release.getDownloadurl(); if (url != null && !url.isEmpty()) { if (CommonUtils.isValidUrl(url)) { autosetEccUpdaterInfo(release, contactPerson, ASSESSOR_DEFAULT_GROUP); EccInformation eccInfo = release.getEccInformation(); <START> eccInfo.setAL("N"); <END> eccInfo.setECCN("N"); eccInfo.setEccStatus(ECCStatus.APPROVED); } else { log.warn("Could not set ECC options for unmodified OSS because download url is not valid: " + url); } } }</code><technical_language>magic constant</technical_language>

Target:
private void autosetEccFieldsForReleaseWithDownloadUrl(Release release, String contactPerson) { String url = release.getDownloadurl(); if (!isNullOrEmpty(url)) { if (CommonUtils.isValidUrl(url)) { autosetEccUpdaterInfo(release, contactPerson, ASSESSOR_DEFAULT_GROUP); EccInformation eccInfo = release.getEccInformation(); eccInfo.setAL(ECC_AUTOSET_VALUE); eccInfo.setECCN(ECC_AUTOSET_VALUE); eccInfo.setEccStatus(ECCStatus.APPROVED); } else { log.warn("Could not set ECC options for unmodified OSS because download url is not valid: " + url); } } }
Source:
<code><START> protected void deleteUnexportedConfigurationsAfterCompletion(MigrationReport report) { <END> if (isValid) { Stream.concat( managedServicesToDelete.values().stream(), managedServiceFactoriesToDelete.values().stream().flatMap(List::stream)) .forEach(this::delete); } }</code><technical_language>simpler for next guy package private mistake</technical_language>

Target:
void deleteUnexportedConfigurationsAfterCompletion(MigrationReport report) { if (isValid) { Stream.concat( managedServicesToDelete.values().stream(), managedServiceFactoriesToDelete.values().stream().flatMap(List::stream)) .forEach(this::delete); } }
Source:
<code>protected void doAttack(double distanceToEntity) { npc.removeAITask(TASK_MOVE); if (getAttackDelay() <= 0) { npc.swingArm(EnumHand.MAIN_HAND); npc.attackEntityAsMob(getTarget()); setAttackDelay(getCoolDown()); npc.addExperience(AWNPCStatics.npcXpFromAttack); <START> if ((Math.random() < 0.2 && npc instanceof NpcFaction)) { <END> ((NpcFaction) npc).playAttackSound(); } } }</code><technical_language>play sounds in attackEntityAsMob AI. allow override attackEntityAsMob call play sound in addition calling super.attackEntityAsMob a need for instanceof check in case</technical_language>

Target:
protected void doAttack(double distanceToEntity) { npc.removeAITask(TASK_MOVE); if (getAttackDelay() <= 0) { npc.swingArm(EnumHand.MAIN_HAND); npc.attackEntityAsMob(getTarget()); setAttackDelay(getCoolDown()); npc.addExperience(AWNPCStatics.npcXpFromAttack); } }
Source:
<code>private Optional<NodeDocument> getNodeInfoFromMetadataContext(ContextKey contextKey, String value) { OnmsNode onmsNode = null; if (contextKey != null && !Strings.isNullOrEmpty(value)) { <START> final List<OnmsNode> nodes = nodeDao.findNodeWithMetaData(contextKey.getContext(), contextKey.getKey(), value); <END> if (!nodes.isEmpty()) { onmsNode = nodes.get(0); } } if (onmsNode != null) { return mapOnmsNodeToNodeDocument(onmsNode); } return Optional.empty(); }</code><technical_language>nice time this nodeLoadTimer too</technical_language>

Target:
private Optional<NodeDocument> getNodeInfoFromMetadataContext(ContextKey contextKey, String value) { List<OnmsNode> nodes = new ArrayList<>(); try (Timer.Context ctx = nodeLoadTimer.time()) { nodes = nodeDao.findNodeWithMetaData(contextKey.getContext(), contextKey.getKey(), value); } if(nodes.isEmpty()) { return Optional.empty(); } return mapOnmsNodeToNodeDocument(nodes.get(0)); }
Source:
<code>public void testIsComplexWrongExpression() { <START> assertTrue(!isComplexTemplate("${t${a:${cb}_${c:d}}")); <END> }</code><technical_language>assertFalse</technical_language>

Target:
public void testIsComplexWrongExpression() { assertFalse(isComplexTemplate("${t${a:${cb}_${c:d}}")); }
Source:
<code>public void failedDataProviderShouldCauseSkip() { InvokedMethodNameListener listener = run(DependentSample.class); <START> assertThat(listener.getSucceedMethodNames()).containsExactly("method1(ok)", "method2"); <END> assertThat(listener.getFailedMethodNames()).containsExactly("method1(not ok)"); }</code><technical_language>this change expected? sample retry analyzer method2 executed if I understand sample</technical_language>

Target:
public void failedDataProviderShouldCauseSkip() { InvokedMethodNameListener listener = run(DependentSample.class); assertThat(listener.getSucceedMethodNames()).containsExactly("method1(ok)"); assertThat(listener.getSkippedMethodNames()).containsExactly("method2"); assertThat(listener.getFailedMethodNames()).containsExactly("method1(not ok)"); }
Source:
<code>public static String parseIdFromPath(String path) { if (!Strings.isNullOrEmpty(path)) <START> return path.substring(path.indexOf(PROCESSOR_ID_PREFIX)); <END> return null; }</code><technical_language>This is hacky error-prone. is a leaf node, more sense parse string path splitter "/" return section</technical_language>

Target:
public static String parseIdFromPath(String path) { if (!Strings.isNullOrEmpty(path)) return path.substring(path.lastIndexOf("/") + 1); return null; }
Source:
<code>public CRC32CDigestManager(long ledgerId, boolean useV2Protocol, ByteBufAllocator allocator) { super(ledgerId, useV2Protocol, allocator); <START> if (!isSupported) { <END> return; } if (!Sse42Crc32C.isSupported()) { log.error("Sse42Crc32C is not supported, will use a slower CRC32C implementation."); isSupported = false; } }</code><technical_language>I isSupported is a good name. is a confusing name in this case. flag for telling CRC32C is support. flag for controlling error log message is printed not. I suggest renaming "nonSupportedMessagePrinted" default false. change logic to: if (!Sse42Crc32C.isSupported() && !nonSupportedMessagePrinted) { log.error("Sse42Crc32C is supported, a slower CRC32C implementation."); nonSupportedMessagePrinted = true; }</technical_language>

Target:
public CRC32CDigestManager(long ledgerId, boolean useV2Protocol, ByteBufAllocator allocator) { super(ledgerId, useV2Protocol, allocator); if (!Sse42Crc32C.isSupported() && !nonSupportedMessagePrinted) { log.warn("Sse42Crc32C is not supported, will use a slower CRC32C implementation."); nonSupportedMessagePrinted = true; } }
Source:
<code>public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeQueryBuilder filter = rangeQuery("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(matchAllQuery()) .setSize(recordcount) .execute() .actionGet(); <START> <END> HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return Status.OK; } catch (Exception e) { e.printStackTrace(); } return Status.ERROR; }</code><technical_language>setFilter() is missed here? is a reason for that</technical_language>

Target:
public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { try { final RangeQueryBuilder rangeQuery = rangeQuery("_id").gte(startkey); final SearchResponse response = client.prepareSearch(indexKey) .setTypes(table) .setQuery(rangeQuery) .setSize(recordcount) .execute() .actionGet(); HashMap<String, ByteIterator> entry; for (SearchHit hit : response.getHits()) { entry = new HashMap<String, ByteIterator>(fields.size()); for (String field : fields) { entry.put(field, new StringByteIterator((String) hit.getSource().get(field))); } result.add(entry); } return Status.OK; } catch (Exception e) { e.printStackTrace(); } return Status.ERROR; }
Source:
<code>AccountInfoMap(AccountServiceMetrics accountServiceMetrics, Map<String, String> accountMap) throws JSONException { nameToAccountMap = new HashMap<>(); idToAccountMap = new HashMap<>(); for (Map.Entry<String, String> entry : accountMap.entrySet()) { String idKey = entry.getKey(); String valueString = entry.getValue(); Account account; JSONObject accountJson = new JSONObject(valueString); if (idKey == null) { accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); throw new IllegalStateException( "Invalid account record when reading accountMap in ZNRecord because idKey=null"); } account = Account.fromJson(accountJson); <START> if (account.getId() != Short.valueOf(idKey)) { <END> accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); throw new IllegalStateException( "Invalid account record when reading accountMap in ZNRecord because idKey and accountId do not match. idKey=" + idKey + " accountId=" + account.getId()); } if (idToAccountMap.containsKey(account.getId()) || nameToAccountMap.containsKey(account.getName())) { throw new IllegalStateException( "Duplicate account id or name exists. id=" + account.getId() + " name=" + account.getName()); } idToAccountMap.put(account.getId(), account); nameToAccountMap.put(account.getName(), account); } }</code><technical_language>Intellij recommends Short.parseShort(idKey)</technical_language>

Target:
AccountInfoMap(AccountServiceMetrics accountServiceMetrics, Map<String, String> accountMap) throws JSONException { nameToAccountMap = new HashMap<>(); idToAccountMap = new HashMap<>(); for (Map.Entry<String, String> entry : accountMap.entrySet()) { String idKey = entry.getKey(); String valueString = entry.getValue(); Account account; JSONObject accountJson = new JSONObject(valueString); if (idKey == null) { accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); throw new IllegalStateException( "Invalid account record when reading accountMap in ZNRecord because idKey=null"); } account = Account.fromJson(accountJson); if (account.getId() != Short.parseShort(idKey)) { accountServiceMetrics.remoteDataCorruptionErrorCount.inc(); throw new IllegalStateException( "Invalid account record when reading accountMap in ZNRecord because idKey and accountId do not match. idKey=" + idKey + " accountId=" + account.getId()); } if (idToAccountMap.containsKey(account.getId()) || nameToAccountMap.containsKey(account.getName())) { throw new IllegalStateException( "Duplicate account id or name exists. id=" + account.getId() + " name=" + account.getName()); } idToAccountMap.put(account.getId(), account); nameToAccountMap.put(account.getName(), account); } }
Source:
<code>public void render(BaseViewHolder tag, DiscussionTopicDepth discussionTopic) { ViewHolder holder = (ViewHolder) tag; holder.discussionTopicNameTextView.setText(discussionTopic.getDiscussionTopic().getName()); <START> holder.discussionTopicNameTextView.setPadding(childPadding * (1 + discussionTopic.getDepth()), childPadding, childPadding, childPadding); <END> }</code><technical_language>relative padding in order support RTL mode, if allowed in API level</technical_language>

Target:
public void render(BaseViewHolder tag, DiscussionTopicDepth discussionTopic) { ViewHolder holder = (ViewHolder) tag; holder.discussionTopicNameTextView.setText(discussionTopic.getDiscussionTopic().getName()); ViewCompat.setPaddingRelative(holder.discussionTopicNameTextView, childPadding * (1 + discussionTopic.getDepth()), childPadding, childPadding, childPadding); }
Source:
<code>public DTreeUserInteraction expandAll(IProgressMonitor monitor) { for (DTreeItem child : tree.getOwnedTreeItems()) { <START> new DTreeItemUserInteraction(child, ctx).expandAll(monitor); <END> } return this; }</code><technical_language>a IProgressMonitor is reusable times</technical_language>

Target:
public DTreeUserInteraction expandAll(IProgressMonitor monitor) { try { monitor.beginTask("Tree item expandion", tree.getOwnedTreeItems().size()); for (DTreeItem child : tree.getOwnedTreeItems()) { new DTreeItemUserInteraction(child, ctx).expandAll(new SubProgressMonitor(monitor, 1)); } } finally { monitor.done(); } return this; }
Source:
<code>public void testCreatingProjectWithExistingName() { if (isMacOrWindowsOS()) { IProject project = createViewpointSpecificationProject(bot, VSM_PROJECT_NAME, VSM); assertTrue("The created VSM project should exist.", ResourcesPlugin.getWorkspace().getRoot().getProject(VSM_PROJECT_NAME).exists()); assertTrue("The created VSM project should be open.", ResourcesPlugin.getWorkspace().getRoot().getProject(VSM_PROJECT_NAME).isOpen()); createProjectWithExistingProjectName("A project with " + VSM_PROJECT_NAME + " name should <START> exists in <END> workspace and the Next button should not be enabled"); closeAllEditors(); try { project.delete(false, true, new NullProgressMonitor()); } catch (CoreException e) { fail("Cannot delete the VSM Project"); } SWTBotUtils.waitAllUiEvents(); createProjectWithExistingProjectName("A project with " + VSM_PROJECT_NAME + " name should exists on the disk and the Next button should not be enabled"); } }</code><technical_language>exist</technical_language>

Target:
public void testCreatingProjectWithExistingName() { if (isMacOrWindowsOS()) { IProject project = createViewpointSpecificationProject(bot, VSM_PROJECT_NAME, VSM); assertTrue("The created VSM project should exist.", ResourcesPlugin.getWorkspace().getRoot().getProject(VSM_PROJECT_NAME).exists()); assertTrue("The created VSM project should be open.", ResourcesPlugin.getWorkspace().getRoot().getProject(VSM_PROJECT_NAME).isOpen()); tryToCreateProjectWithExistingProjectName("A project with " + VSM_PROJECT_NAME + " name should exist in workspace and the Next button should not be enabled"); closeAllEditors(); try { project.delete(false, true, new NullProgressMonitor()); } catch (CoreException e) { fail("Cannot delete the VSM Project"); } SWTBotUtils.waitAllUiEvents(); tryToCreateProjectWithExistingProjectName("A project with " + VSM_PROJECT_NAME + " name should exist on the disk and the Next button should not be enabled"); } }
Source:
<code>private static void setStatus(ITmfStateSystemBuilder ss, long status, int curThreadNode, @Nullable Long cpu, long timestamp, long type) { ITmfStateValue value; if (ss.queryOngoingState(curThreadNode).isNull()) { value = ProcessStatus.getStatusFromStatedump(status).getStateValue(); ss.modifyAttribute(timestamp, value.unboxValue(), curThreadNode); if (status == LinuxValues.STATEDUMP_PROCESS_STATUS_WAIT_CPU) { setRunQueue(ss, curThreadNode, cpu, timestamp); } } if (type != 0) { int sysallQuark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.SYSTEM_CALL); <START> ss.modifyAttribute(timestamp, "", sysallQuark); END> } }</code><technical_language>update state</technical_language>

Target:
private static void setStatus(ITmfStateSystemBuilder ss, long status, int curThreadNode, @Nullable Long cpu, long timestamp, long type) { ITmfStateValue value; if (ss.queryOngoingState(curThreadNode).isNull()) { value = ProcessStatus.getStatusFromStatedump(status).getStateValue(); ss.modifyAttribute(timestamp, value.unboxValue(), curThreadNode); if (status == LinuxValues.STATEDUMP_PROCESS_STATUS_WAIT_CPU) { setRunQueue(ss, curThreadNode, cpu, timestamp); } } if (type != 0) { int sysallQuark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.SYSTEM_CALL); ss.updateOngoingState("", sysallQuark); } }
Source:
<code>static void initKerberosENV(String principal, String keytab, boolean debugEnabled) { try { Configuration conf = new Configuration(); conf.set("hadoop.security.authentication", "kerberos"); if (debugEnabled) { System.setProperty("sun.security.krb5.debug", "true"); } UserGroupInformation.setConfiguration(conf); UserGroupInformation.loginUserFromKeytab(principal, keytab); <START> log.info("Getting connection from kudu with kerberos"); <END> log.info("Current user: " + UserGroupInformation.getCurrentUser()); log.info("Login user: " + UserGroupInformation.getLoginUser()); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>nit: Connecting kudu kerberos authentication</technical_language>

Target:
static void initKerberosENV(String principal, String keytab, boolean debugEnabled) { try { Configuration conf = new Configuration(); conf.set("hadoop.security.authentication", "kerberos"); if (debugEnabled) { System.setProperty("sun.security.krb5.debug", "true"); } UserGroupInformation.setConfiguration(conf); UserGroupInformation.loginUserFromKeytab(principal, keytab); log.info("Connecting to kudu with kerberos authentication"); log.info("Current user: " + UserGroupInformation.getCurrentUser()); log.info("Login user: " + UserGroupInformation.getLoginUser()); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public void defaultLoggersAtInfo() { final Logger logger = LoggerFactory.getLogger("com.azure.cosmos.internal.query.aggregation"); final Logger logger2 = LoggerFactory.getLogger("com.azure.cosmos"); Assert.assertTrue(logger.isInfoEnabled()); Assert.assertTrue(logger2.isInfoEnabled()); Assert.assertFalse(logger.isDebugEnabled()); <START> Assert.assertFalse(logger2.isDebugEnabled()); <END> }</code><technical_language>ditto assertj for assertion, please this instead: import static org.assertj.core.api.Assertions.assertThat; assertThat(logger.isErrorEnabled()).isFase()</technical_language>

Target:
public void defaultLoggersAtInfo() { final Logger logger = LoggerFactory.getLogger("com.azure.cosmos.internal.query.aggregation"); final Logger logger2 = LoggerFactory.getLogger("com.azure.cosmos"); assertThat(logger.isInfoEnabled()).isTrue(); assertThat(logger2.isInfoEnabled()).isTrue(); assertThat(logger.isDebugEnabled()).isFalse(); assertThat(logger2.isDebugEnabled()).isFalse(); }
Source:
<code>private void trackUploadedStockMediaEvent(@NonNull List<MediaModel> mediaList) { if (mediaList.size() == 0) { AppLog.e(AppLog.T.MEDIA, "Cannot track uploaded stock media event if mediaList is empty"); return; } boolean isMultiselect = mediaList.size() > 1; for (MediaModel media : mediaList) { if (media.getUrl() != null) { Uri mediaUri = Uri.parse(media.getUrl()); <START> Map<String, Object> properties = <END> AnalyticsUtils.getMediaProperties(this, false, mediaUri, null); properties.put("is_part_of_multiselection", isMultiselect); if (isMultiselect) { properties.put("number_of_media_selected", mediaList.size()); } AnalyticsTracker.track(AnalyticsTracker.Stat.STOCK_MEDIA_UPLOADED, properties); } } }</code><technical_language>Nick, I suggest track media details noticed utility routine work for remote files. I suggest remove this call here, create empty properties Map. adding a TODO improve routine in consideration remote files local files. Other I ok ready merged</technical_language>

Target:
private void trackUploadedStockMediaEvent(@NonNull List<MediaModel> mediaList) { if (mediaList.size() == 0) { AppLog.e(AppLog.T.MEDIA, "Cannot track uploaded stock media event if mediaList is empty"); return; } boolean isMultiselect = mediaList.size() > 1; Map<String, Object> properties = new HashMap<>(); properties.put("is_part_of_multiselection", isMultiselect); properties.put("number_of_media_selected", mediaList.size()); AnalyticsTracker.track(AnalyticsTracker.Stat.STOCK_MEDIA_UPLOADED, properties); }
Source:
<code>private Element getAssertionElement() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new DOMUtils.NullResolver()); <START> return db.parse(SecureCxfClientFactoryTest.class.getResourceAsStream("/samlAssertion.xml")) <END> .getDocumentElement(); }</code><technical_language>rename this file SAMLAssertion.xml</technical_language>

Target:
private Element getAssertionElement() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(false); dbf.setIgnoringComments(false); dbf.setIgnoringElementContentWhitespace(true); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); db.setEntityResolver(new DOMUtils.NullResolver()); return db.parse(SecureCxfClientFactoryTest.class.getResourceAsStream("/SAMLAssertion.xml")) .getDocumentElement(); }